Skip to content

Commit

Permalink
[vaapi] Always deinterlace when an interlaced frame was encountered once
Browse files Browse the repository at this point in the history
PAFF video requires to run all frames through the deinterlacing filter
even if they are stored progressive.
After one interlaced frame was seen by the output, do not automatically
set the deinterlace method to NONE which would skip the filter.
Still, deinterlacing must be switched off if the user requests it.

Fixes xbmc#15817
  • Loading branch information
pkerling committed Mar 28, 2019
1 parent 03559d3 commit a927f33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
Expand Up @@ -1862,6 +1862,7 @@ bool COutput::Init()
m_config.processInfo->SetDeinterlacingMethodDefault(EINTERLACEMETHOD::VS_INTERLACEMETHOD_VAAPI_BOB);

m_vaError = false;
m_seenInterlaced = false;

return true;
}
Expand Down Expand Up @@ -1982,9 +1983,13 @@ void COutput::InitCycle()

EINTERLACEMETHOD method = m_config.processInfo->GetVideoSettings().m_InterlaceMethod;
bool interlaced = m_currentPicture.DVDPic.iFlags & DVP_FLAG_INTERLACED;
// Remember whether any interlaced frames were encountered already.
// If this is the case, the deinterlace method will never automatically be switched to NONE again in
// order to not change deint methods every few frames in PAFF streams.
m_seenInterlaced = m_seenInterlaced || interlaced;

if (!(flags & DVD_CODEC_CTRL_NO_POSTPROC) &&
interlaced &&
m_seenInterlaced &&
method != VS_INTERLACEMETHOD_NONE)
{
if (!m_config.processInfo->Supports(method))
Expand Down
2 changes: 2 additions & 0 deletions xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.h
Expand Up @@ -275,6 +275,8 @@ class COutput : private CThread
// extended state variables for state machine
int m_extTimeout;
bool m_vaError;
/// \brief Whether at least one interlaced frame was encountered in the video stream (indicating that more interlaced frames could potentially follow)
bool m_seenInterlaced;
CVaapiConfig m_config;
std::shared_ptr<CVaapiBufferPool> m_bufferPool;
CVaapiDecodedPicture m_currentPicture;
Expand Down

0 comments on commit a927f33

Please sign in to comment.