From 69f2e196321ce155f61e7253c8abd2b0fcc6c94c Mon Sep 17 00:00:00 2001 From: Thomas Reufer Date: Tue, 30 Dec 2014 17:11:18 +0100 Subject: manually overriding interlaced flag when detected frame rate looks implausible --- omx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/omx.c b/omx.c index 3c728ce..c7ff045 100644 --- a/omx.c +++ b/omx.c @@ -241,6 +241,17 @@ void cOmx::HandlePortSettingsChanged(unsigned int portId) m_videoFormat.interlaced = interlace.eMode != OMX_InterlaceProgressive; m_videoFormat.frameRate = ALIGN_UP(portdef.format.video.xFramerate, 1 << 16) >> 16; + + // workaround for progressive streams detected as interlaced video by + // the decoder due to missing SEI parsing + // see: https://github.com/raspberrypi/firmware/issues/283 + if (m_videoFormat.interlaced && m_videoFormat.frameRate >= 50) + { + DLOG("%di looks implausible, manually overriding interlaced flag", + m_videoFormat.frameRate * 2); + m_videoFormat.interlaced = false; + } + if (m_videoFormat.interlaced) m_videoFormat.frameRate = m_videoFormat.frameRate * 2; @@ -261,8 +272,14 @@ void cOmx::HandlePortSettingsChanged(unsigned int portId) bool fastDeinterlace = portdef.format.video.nFrameWidth * portdef.format.video.nFrameHeight > 576 * 720; - filterparam.nNumParams = 1; + filterparam.nNumParams = fastDeinterlace ? 1 : 2; filterparam.nParams[0] = 3; + + // explicitly set frame interval for advanced deinterlacer + // see: https://github.com/raspberrypi/firmware/issues/234 + filterparam.nParams[1] = 1000000 / + (portdef.format.video.xFramerate >> 16); + filterparam.eImageFilter = fastDeinterlace ? OMX_ImageFilterDeInterlaceFast : OMX_ImageFilterDeInterlaceAdvanced; -- cgit v1.2.3