MythTV  master
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MythDeinterlacer Class Reference

Handles software based deinterlacing of video frames. More...

#include <mythdeinterlacer.h>

Collaboration diagram for MythDeinterlacer:
Collaboration graph
[legend]

Public Member Functions

 MythDeinterlacer ()=default
 
 ~MythDeinterlacer ()
 
void Filter (VideoFrame *Frame, FrameScanType Scan, VideoDisplayProfile *Profile, bool Force=false)
 Deinterlace Frame if needed. More...
 

Private Member Functions

bool Initialise (VideoFrame *Frame, MythDeintType Deinterlacer, bool DoubleRate, bool TopFieldFirst, VideoDisplayProfile *Profile)
 Initialise deinterlacing using the given MythDeintType. More...
 
void Cleanup (void)
 
void OneField (VideoFrame *Frame, FrameScanType Scan)
 
void Blend (VideoFrame *Frame, FrameScanType Scan)
 
bool SetUpCache (VideoFrame *Frame)
 

Private Attributes

VideoFrameType m_inputType { FMT_NONE }
 
AVPixelFormat m_inputFmt { AV_PIX_FMT_NONE }
 
int m_width { 0 }
 
int m_height { 0 }
 
MythDeintType m_deintType { DEINT_NONE }
 
bool m_doubleRate { false }
 
bool m_topFirst { true }
 
MythAVFrame m_frame { }
 
AVFilterGraph * m_graph { nullptr }
 
AVFilterContext * m_source { nullptr }
 
AVFilterContext * m_sink { nullptr }
 
VideoFramem_bobFrame { nullptr }
 
SwsContext * m_swsContext { nullptr }
 
long long m_discontinuityCounter { 0 }
 
bool m_autoFieldOrder { false }
 
long long m_lastFieldChange { 0 }
 

Static Private Attributes

static bool s_haveSIMD = false
 

Detailed Description

Handles software based deinterlacing of video frames.

Based upon the deinterlacing preferences passed in through the video frame, MythDeinterlacer will deinterlace the given frame using the appropriate quality and using single or double frame rate.

The following deinterlacers are used: Basic - onefield/bob using libswcale Medium - linearblend with custom code (SSE2 and Neon assisted where available) High - libavfilter's yadif (with multithreading)

Note
libavfilter frame doubling filters expect frames to be presented in the correct order and will break if they do not receive a frame followed by the retrieval of 2 'fields'.
There is no support for deinterlacig NV12 frame formats in libavilter

Definition at line 14 of file mythdeinterlacer.h.

Constructor & Destructor Documentation

◆ MythDeinterlacer()

MythDeinterlacer::MythDeinterlacer ( )
default

◆ ~MythDeinterlacer()

MythDeinterlacer::~MythDeinterlacer ( )

Definition at line 47 of file mythdeinterlacer.cpp.

Member Function Documentation

◆ Filter()

void MythDeinterlacer::Filter ( VideoFrame Frame,
FrameScanType  Scan,
VideoDisplayProfile Profile,
bool  Force = false 
)

Deinterlace Frame if needed.

Software deinterlacing is the choice of last resort i.e. shader or driver based deinterlacers are always preferred if available.

If using double rate deinterlacing, the frame must be presented in the correct order i.e. kScan_Interlaced followed by kScan_Intr2ndField.

The appropriate field to deinterlace is determined by the scan type and the flags for interlaced_reverse and top_field_first in VideoFrame.

libavilter's must be recreated if any parameter is changed as there is no method to select the field 'on the fly'.

Parameters
ForceSet to true to ensure a deinterlaced frame is always returned. Used for preview images.

Definition at line 69 of file mythdeinterlacer.cpp.

Referenced by MythPlayer::GetScreenGrabAtFrame(), MythVideoOutputOpenGL::ProcessFrame(), and MythVideoOutputOpenGL::UpdatePauseFrame().

◆ Initialise()

bool MythDeinterlacer::Initialise ( VideoFrame Frame,
MythDeintType  Deinterlacer,
bool  DoubleRate,
bool  TopFieldFirst,
VideoDisplayProfile Profile 
)
private

Initialise deinterlacing using the given MythDeintType.

Definition at line 292 of file mythdeinterlacer.cpp.

Referenced by Filter().

◆ Cleanup()

void MythDeinterlacer::Cleanup ( void  )
inlineprivate

Definition at line 268 of file mythdeinterlacer.cpp.

Referenced by Filter(), Initialise(), and ~MythDeinterlacer().

◆ OneField()

void MythDeinterlacer::OneField ( VideoFrame Frame,
FrameScanType  Scan 
)
private

Definition at line 418 of file mythdeinterlacer.cpp.

Referenced by Filter().

◆ Blend()

void MythDeinterlacer::Blend ( VideoFrame Frame,
FrameScanType  Scan 
)
private

Definition at line 634 of file mythdeinterlacer.cpp.

Referenced by Filter().

◆ SetUpCache()

bool MythDeinterlacer::SetUpCache ( VideoFrame Frame)
private

Definition at line 386 of file mythdeinterlacer.cpp.

Referenced by Blend(), and OneField().

Member Data Documentation

◆ m_inputType

VideoFrameType MythDeinterlacer::m_inputType { FMT_NONE }
private

Definition at line 35 of file mythdeinterlacer.h.

Referenced by Filter(), Initialise(), and OneField().

◆ m_inputFmt

AVPixelFormat MythDeinterlacer::m_inputFmt { AV_PIX_FMT_NONE }
private

Definition at line 36 of file mythdeinterlacer.h.

Referenced by Filter(), Initialise(), and OneField().

◆ m_width

int MythDeinterlacer::m_width { 0 }
private

Definition at line 37 of file mythdeinterlacer.h.

Referenced by Filter(), and Initialise().

◆ m_height

int MythDeinterlacer::m_height { 0 }
private

Definition at line 38 of file mythdeinterlacer.h.

Referenced by Filter(), and Initialise().

◆ m_deintType

MythDeintType MythDeinterlacer::m_deintType { DEINT_NONE }
private

Definition at line 39 of file mythdeinterlacer.h.

Referenced by Cleanup(), Filter(), and Initialise().

◆ m_doubleRate

bool MythDeinterlacer::m_doubleRate { false }
private

Definition at line 40 of file mythdeinterlacer.h.

Referenced by Blend(), Filter(), and Initialise().

◆ m_topFirst

bool MythDeinterlacer::m_topFirst { true }
private

Definition at line 41 of file mythdeinterlacer.h.

Referenced by Blend(), Filter(), Initialise(), and OneField().

◆ m_frame

MythAVFrame MythDeinterlacer::m_frame { }
private

Definition at line 42 of file mythdeinterlacer.h.

Referenced by Filter(), and OneField().

◆ m_graph

AVFilterGraph* MythDeinterlacer::m_graph { nullptr }
private

Definition at line 43 of file mythdeinterlacer.h.

Referenced by Cleanup(), Filter(), and Initialise().

◆ m_source

AVFilterContext* MythDeinterlacer::m_source { nullptr }
private

Definition at line 44 of file mythdeinterlacer.h.

Referenced by Filter(), and Initialise().

◆ m_sink

AVFilterContext* MythDeinterlacer::m_sink { nullptr }
private

Definition at line 45 of file mythdeinterlacer.h.

Referenced by Filter(), and Initialise().

◆ m_bobFrame

VideoFrame* MythDeinterlacer::m_bobFrame { nullptr }
private

Definition at line 46 of file mythdeinterlacer.h.

Referenced by Blend(), Cleanup(), OneField(), and SetUpCache().

◆ m_swsContext

SwsContext* MythDeinterlacer::m_swsContext { nullptr }
private

Definition at line 47 of file mythdeinterlacer.h.

Referenced by Cleanup(), Initialise(), and OneField().

◆ m_discontinuityCounter

long long MythDeinterlacer::m_discontinuityCounter { 0 }
private

Definition at line 48 of file mythdeinterlacer.h.

Referenced by Cleanup(), and Filter().

◆ m_autoFieldOrder

bool MythDeinterlacer::m_autoFieldOrder { false }
private

Definition at line 49 of file mythdeinterlacer.h.

Referenced by Cleanup(), Filter(), and Initialise().

◆ m_lastFieldChange

long long MythDeinterlacer::m_lastFieldChange { 0 }
private

Definition at line 50 of file mythdeinterlacer.h.

Referenced by Cleanup(), Filter(), and Initialise().

◆ s_haveSIMD

bool MythDeinterlacer::s_haveSIMD = false
staticprivate

Definition at line 51 of file mythdeinterlacer.h.

Referenced by Blend().


The documentation for this class was generated from the following files: