Skip to content

Commit

Permalink
MythDeinterlacer: Reset libavfilter deinterlacers after discontinuity
Browse files Browse the repository at this point in the history
- this brings them in line with the other GLSL and driver based, multi-
frame deinterlacers
  • Loading branch information
mark-kendall committed Feb 14, 2020
1 parent d323d60 commit e3528a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mythtv/libs/libmythtv/mythdeinterlacer.cpp
Expand Up @@ -115,7 +115,19 @@ void MythDeinterlacer::Filter(VideoFrame *Frame, FrameScanType Scan, bool Force)
Cleanup();
return;
}
Force = true;
}
else if ((abs(Frame->frameCounter - m_discontinuityCounter) > 1) && (m_deintType != DEINT_BASIC))
{
if (!Initialise(Frame, deinterlacer, doublerate, topfieldfirst))
{
Cleanup();
return;
}
Force = true;
}

m_discontinuityCounter = Frame->frameCounter;

// Set in use deinterlacer for debugging
Frame->deinterlace_inuse = m_deintType | DEINT_CPU;
Expand Down Expand Up @@ -271,6 +283,7 @@ void MythDeinterlacer::Cleanup(void)
avfilter_graph_free(&m_graph);
sws_freeContext(m_swsContext);
m_swsContext = nullptr;
m_discontinuityCounter = 0;

if (m_bobFrame)
{
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/mythdeinterlacer.h
Expand Up @@ -43,6 +43,7 @@ class MythDeinterlacer
AVFilterContext* m_sink { nullptr };
VideoFrame* m_bobFrame { nullptr };
SwsContext* m_swsContext { nullptr };
long long m_discontinuityCounter { 0 };
};

#endif // MYTHDEINTERLACER_H

0 comments on commit e3528a0

Please sign in to comment.