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

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

#include <libmythtv/mythdeinterlacer.h>

Collaboration diagram for MythDeinterlacer:
[legend]

Public Member Functions

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

Private Member Functions

bool Initialise (MythVideoFrame *Frame, MythDeintType Deinterlacer, bool DoubleRate, bool TopFieldFirst, MythVideoProfile *Profile)
 Initialise deinterlacing using the given MythDeintType. More...
 
void Cleanup ()
 
void OneField (MythVideoFrame *Frame, FrameScanType Scan)
 
void Blend (MythVideoFrame *Frame, FrameScanType Scan)
 
bool SetUpCache (MythVideoFrame *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 }
 
MythVideoFramem_bobFrame { nullptr }
 
SwsContext * m_swsContext { nullptr }
 
uint64_t m_discontinuityCounter { 0 }
 
bool m_autoFieldOrder { false }
 
uint64_t m_lastFieldChange { 0 }
 

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 15 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 ( MythVideoFrame Frame,
FrameScanType  Scan,
MythVideoProfile 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 MythAVUtil::DeinterlaceAVFrame(), MythPreviewPlayer::GetScreenGrabAtFrame(), MythVideoOutputNull::PrepareFrame(), MythVideoOutputGPU::PrepareFrame(), and MythVideoOutputGPU::UpdatePauseFrame().

◆ Initialise()

bool MythDeinterlacer::Initialise ( MythVideoFrame Frame,
MythDeintType  Deinterlacer,
bool  DoubleRate,
bool  TopFieldFirst,
MythVideoProfile Profile 
)
private

Initialise deinterlacing using the given MythDeintType.

Definition at line 296 of file mythdeinterlacer.cpp.

Referenced by Filter().

◆ Cleanup()

void MythDeinterlacer::Cleanup ( )
inlineprivate

Definition at line 273 of file mythdeinterlacer.cpp.

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

◆ OneField()

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

Definition at line 415 of file mythdeinterlacer.cpp.

Referenced by Filter().

◆ Blend()

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

Definition at line 631 of file mythdeinterlacer.cpp.

Referenced by Filter().

◆ SetUpCache()

bool MythDeinterlacer::SetUpCache ( MythVideoFrame Frame)
private

Definition at line 393 of file mythdeinterlacer.cpp.

Referenced by Blend(), and OneField().

Member Data Documentation

◆ m_inputType

VideoFrameType MythDeinterlacer::m_inputType { FMT_NONE }
private

Definition at line 34 of file mythdeinterlacer.h.

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

◆ m_inputFmt

AVPixelFormat MythDeinterlacer::m_inputFmt { AV_PIX_FMT_NONE }
private

Definition at line 35 of file mythdeinterlacer.h.

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

◆ m_width

int MythDeinterlacer::m_width { 0 }
private

Definition at line 36 of file mythdeinterlacer.h.

Referenced by Filter(), and Initialise().

◆ m_height

int MythDeinterlacer::m_height { 0 }
private

Definition at line 37 of file mythdeinterlacer.h.

Referenced by Filter(), and Initialise().

◆ m_deintType

MythDeintType MythDeinterlacer::m_deintType { DEINT_NONE }
private

Definition at line 38 of file mythdeinterlacer.h.

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

◆ m_doubleRate

bool MythDeinterlacer::m_doubleRate { false }
private

Definition at line 39 of file mythdeinterlacer.h.

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

◆ m_topFirst

bool MythDeinterlacer::m_topFirst { true }
private

Definition at line 40 of file mythdeinterlacer.h.

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

◆ m_frame

MythAVFrame MythDeinterlacer::m_frame
private

Definition at line 41 of file mythdeinterlacer.h.

Referenced by Filter(), and OneField().

◆ m_graph

AVFilterGraph* MythDeinterlacer::m_graph { nullptr }
private

Definition at line 42 of file mythdeinterlacer.h.

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

◆ m_source

AVFilterContext* MythDeinterlacer::m_source { nullptr }
private

Definition at line 43 of file mythdeinterlacer.h.

Referenced by Filter(), and Initialise().

◆ m_sink

AVFilterContext* MythDeinterlacer::m_sink { nullptr }
private

Definition at line 44 of file mythdeinterlacer.h.

Referenced by Filter(), and Initialise().

◆ m_bobFrame

MythVideoFrame* MythDeinterlacer::m_bobFrame { nullptr }
private

Definition at line 45 of file mythdeinterlacer.h.

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

◆ m_swsContext

SwsContext* MythDeinterlacer::m_swsContext { nullptr }
private

Definition at line 46 of file mythdeinterlacer.h.

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

◆ m_discontinuityCounter

uint64_t MythDeinterlacer::m_discontinuityCounter { 0 }
private

Definition at line 47 of file mythdeinterlacer.h.

Referenced by Cleanup(), and Filter().

◆ m_autoFieldOrder

bool MythDeinterlacer::m_autoFieldOrder { false }
private

Definition at line 48 of file mythdeinterlacer.h.

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

◆ m_lastFieldChange

uint64_t MythDeinterlacer::m_lastFieldChange { 0 }
private

Definition at line 49 of file mythdeinterlacer.h.

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


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