Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2016-03-12 13:21:09 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2016-03-12 13:24:18 +0300
commitd3c65779ab8beef9a7891d27478ee88579b49815 (patch)
treeff09778eac99dc9bc364729c6c5cafbac636fea9 /decoder
parent5ae687357e0fb58ba516fa0a2055fbe196315c27 (diff)
Only allow to guess the interlaced flag for the media type, not for software deinterlacing.
This could result in unwanted frame rate changes in progressive content, which was initially guessed as interlaced due to lack of more information.
Diffstat (limited to 'decoder')
-rw-r--r--decoder/LAVVideo/DecodeThread.h2
-rw-r--r--decoder/LAVVideo/Filtering.cpp2
-rw-r--r--decoder/LAVVideo/LAVVideo.cpp16
-rw-r--r--decoder/LAVVideo/LAVVideo.h2
-rw-r--r--decoder/LAVVideo/decoders/DecBase.h2
-rw-r--r--decoder/LAVVideo/decoders/ILAVDecoder.h2
-rw-r--r--decoder/LAVVideo/decoders/avcodec.cpp4
-rw-r--r--decoder/LAVVideo/decoders/avcodec.h2
-rw-r--r--decoder/LAVVideo/decoders/cuvid.cpp2
-rw-r--r--decoder/LAVVideo/decoders/cuvid.h2
-rw-r--r--decoder/LAVVideo/decoders/msdk_mvc.h2
-rw-r--r--decoder/LAVVideo/decoders/quicksync.cpp2
-rw-r--r--decoder/LAVVideo/decoders/quicksync.h2
-rw-r--r--decoder/LAVVideo/decoders/wmv9.cpp2
-rw-r--r--decoder/LAVVideo/decoders/wmv9.h2
-rw-r--r--decoder/LAVVideo/decoders/wmv9mft.cpp2
-rw-r--r--decoder/LAVVideo/decoders/wmv9mft.h2
17 files changed, 25 insertions, 25 deletions
diff --git a/decoder/LAVVideo/DecodeThread.h b/decoder/LAVVideo/DecodeThread.h
index 96801745..ed52ec23 100644
--- a/decoder/LAVVideo/DecodeThread.h
+++ b/decoder/LAVVideo/DecodeThread.h
@@ -35,7 +35,7 @@ public:
// Parts of ILAVDecoder
STDMETHODIMP_(const WCHAR*) GetDecoderName() { return m_pDecoder ? m_pDecoder->GetDecoderName() : nullptr; }
STDMETHODIMP_(long) GetBufferCount() { return m_pDecoder ? m_pDecoder->GetBufferCount() : 4; }
- STDMETHODIMP_(BOOL) IsInterlaced() { return m_pDecoder ? m_pDecoder->IsInterlaced() : TRUE; }
+ STDMETHODIMP_(BOOL) IsInterlaced(BOOL bAllowGuess) { return m_pDecoder ? m_pDecoder->IsInterlaced(bAllowGuess) : TRUE; }
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp) { ASSERT(m_pDecoder); return m_pDecoder->GetPixelFormat(pPix, pBpp); }
STDMETHODIMP_(REFERENCE_TIME) GetFrameDuration() { ASSERT(m_pDecoder); return m_pDecoder->GetFrameDuration(); }
STDMETHODIMP HasThreadSafeBuffers() { return m_pDecoder ? m_pDecoder->HasThreadSafeBuffers() : S_FALSE; }
diff --git a/decoder/LAVVideo/Filtering.cpp b/decoder/LAVVideo/Filtering.cpp
index 5d625ba1..6867e92a 100644
--- a/decoder/LAVVideo/Filtering.cpp
+++ b/decoder/LAVVideo/Filtering.cpp
@@ -42,7 +42,7 @@ HRESULT CLAVVideo::Filter(LAVFrame *pFrame)
{
int ret = 0;
BOOL bFlush = pFrame->flags & LAV_FRAME_FLAG_FLUSH;
- if (m_Decoder.IsInterlaced() && m_settings.DeintMode != DeintMode_Disable
+ if (m_Decoder.IsInterlaced(FALSE) && m_settings.DeintMode != DeintMode_Disable
&& (m_settings.SWDeintMode == SWDeintMode_YADIF || m_settings.SWDeintMode == SWDeintMode_W3FDIF_Simple || m_settings.SWDeintMode == SWDeintMode_W3FDIF_Complex)
&& ((bFlush && m_pFilterGraph) || pFrame->format == LAVPixFmt_YUV420 || pFrame->format == LAVPixFmt_YUV422 || pFrame->format == LAVPixFmt_NV12)) {
AVPixelFormat ff_pixfmt = (pFrame->format == LAVPixFmt_YUV420) ? AV_PIX_FMT_YUV420P : (pFrame->format == LAVPixFmt_YUV422) ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_NV12;
diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp
index 0fd77b73..a49b9101 100644
--- a/decoder/LAVVideo/LAVVideo.cpp
+++ b/decoder/LAVVideo/LAVVideo.cpp
@@ -547,21 +547,21 @@ HRESULT CLAVVideo::GetMediaType(int iPosition, CMediaType *pMediaType)
videoFormatTypeHandler(mtIn.Format(), mtIn.FormatType(), &pBIH, &rtAvgTime, &dwAspectX, &dwAspectY);
// Adjust for deinterlacing
- if (m_Decoder.IsInterlaced() && m_settings.DeintMode != DeintMode_Disable) {
+ if (m_Decoder.IsInterlaced(FALSE) && m_settings.DeintMode != DeintMode_Disable) {
BOOL bFramePerField = (m_settings.SWDeintMode == SWDeintMode_YADIF && m_settings.SWDeintOutput == DeintOutput_FramePerField)
|| m_settings.SWDeintMode == SWDeintMode_W3FDIF_Simple || m_settings.SWDeintMode == SWDeintMode_W3FDIF_Complex;
if (bFramePerField)
rtAvgTime /= 2;
}
- m_PixFmtConverter.GetMediaType(pMediaType, index, pBIH->biWidth, pBIH->biHeight, dwAspectX, dwAspectY, rtAvgTime, IsInterlaced(), bVIH1);
+ m_PixFmtConverter.GetMediaType(pMediaType, index, pBIH->biWidth, pBIH->biHeight, dwAspectX, dwAspectY, rtAvgTime, IsInterlacedOutput(), bVIH1);
return S_OK;
}
-BOOL CLAVVideo::IsInterlaced()
+BOOL CLAVVideo::IsInterlacedOutput()
{
- return (m_settings.SWDeintMode == SWDeintMode_None || m_filterPixFmt == LAVPixFmt_None) && m_Decoder.IsInterlaced() && !(m_settings.DeintMode == DeintMode_Disable);
+ return (m_settings.SWDeintMode == SWDeintMode_None || m_filterPixFmt == LAVPixFmt_None) && m_Decoder.IsInterlaced(TRUE) && !(m_settings.DeintMode == DeintMode_Disable);
}
static const LPWSTR stream_ar_blacklist[] = {
@@ -703,7 +703,7 @@ HRESULT CLAVVideo::CheckDirectMode()
m_Decoder.GetPixelFormat(&pix, &bpp);
BOOL bDirect = (pix == LAVPixFmt_NV12 || pix == LAVPixFmt_P010);
- if (pix == LAVPixFmt_NV12 && m_Decoder.IsInterlaced() && m_settings.SWDeintMode != SWDeintMode_None)
+ if (pix == LAVPixFmt_NV12 && m_Decoder.IsInterlaced(FALSE) && m_settings.SWDeintMode != SWDeintMode_None)
bDirect = FALSE;
else if (pix == LAVPixFmt_NV12 && m_pOutput->CurrentMediaType().subtype != MEDIASUBTYPE_NV12 && m_pOutput->CurrentMediaType().subtype != MEDIASUBTYPE_YV12)
bDirect = FALSE;
@@ -1040,7 +1040,7 @@ HRESULT CLAVVideo::ReconnectOutput(int width, int height, AVRational ar, DXVA2_E
// Determine Interlaced flags
// - madVR handles the flags properly, so properly indicate forced deint, adaptive deint and progressive
// - The OverlayMixer fails at interlaced support, so completely disable interlaced flags for it
- BOOL bInterlaced = IsInterlaced();
+ BOOL bInterlaced = IsInterlacedOutput();
DWORD dwInterlacedFlags = 0;
if (m_bMadVR) {
if (bInterlaced && (m_settings.DeintMode == DeintMode_Force || m_settings.DeintMode == DeintMode_Aggressive)) {
@@ -1287,7 +1287,7 @@ HRESULT CLAVVideo::NegotiatePixelFormat(CMediaType &outMt, int width, int height
CMediaType mt;
for (i = 0; i < m_PixFmtConverter.GetNumMediaTypes(); ++i) {
- m_PixFmtConverter.GetMediaType(&mt, i, width, height, dwAspectX, dwAspectY, rtAvg, m_Decoder.IsInterlaced(), bVIH1);
+ m_PixFmtConverter.GetMediaType(&mt, i, width, height, dwAspectX, dwAspectY, rtAvg, IsInterlacedOutput(), bVIH1);
//hr = m_pOutput->GetConnected()->QueryAccept(&mt);
receiveconnection:
hr = m_pOutput->GetConnected()->ReceiveConnection(m_pOutput, &mt);
@@ -1507,7 +1507,7 @@ STDMETHODIMP CLAVVideo::Deliver(LAVFrame *pFrame)
// Only perform filtering if we have to.
// DXVA Native generally can't be filtered, and the only filtering we currently support is software deinterlacing
if ( pFrame->format == LAVPixFmt_DXVA2
- || !(m_Decoder.IsInterlaced() && m_settings.SWDeintMode != SWDeintMode_None)
+ || !(m_Decoder.IsInterlaced(FALSE) && m_settings.SWDeintMode != SWDeintMode_None)
|| pFrame->flags & LAV_FRAME_FLAG_REDRAW) {
return DeliverToRenderer(pFrame);
} else {
diff --git a/decoder/LAVVideo/LAVVideo.h b/decoder/LAVVideo/LAVVideo.h
index 47ff8f22..2caea20e 100644
--- a/decoder/LAVVideo/LAVVideo.h
+++ b/decoder/LAVVideo/LAVVideo.h
@@ -206,7 +206,7 @@ private:
HRESULT SetFrameFlags(IMediaSample* pMS, LAVFrame *pFrame);
HRESULT NegotiatePixelFormat(CMediaType &mt, int width, int height);
- BOOL IsInterlaced();
+ BOOL IsInterlacedOutput();
HRESULT CheckDirectMode();
HRESULT DeDirectFrame(LAVFrame *pFrame, bool bDisableDirectMode = true);
diff --git a/decoder/LAVVideo/decoders/DecBase.h b/decoder/LAVVideo/decoders/DecBase.h
index e5cc1536..7ca5bcd3 100644
--- a/decoder/LAVVideo/decoders/DecBase.h
+++ b/decoder/LAVVideo/decoders/DecBase.h
@@ -35,7 +35,7 @@ public:
STDMETHODIMP InitInterfaces(ILAVVideoSettings *pSettings, ILAVVideoCallback *pCallback) { m_pSettings = pSettings; m_pCallback = pCallback; return Init(); }
STDMETHODIMP Check() { return S_FALSE; }
STDMETHODIMP_(REFERENCE_TIME) GetFrameDuration() { return 0; }
- STDMETHODIMP_(BOOL) IsInterlaced() { return TRUE; }
+ STDMETHODIMP_(BOOL) IsInterlaced(BOOL bAllowGuess) { return TRUE; }
STDMETHODIMP InitAllocator(IMemAllocator **ppAlloc) { return E_NOTIMPL; }
STDMETHODIMP PostConnect(IPin *pPin) { return S_FALSE; }
STDMETHODIMP_(long) GetBufferCount() { return 2; }
diff --git a/decoder/LAVVideo/decoders/ILAVDecoder.h b/decoder/LAVVideo/decoders/ILAVDecoder.h
index 6ec64dff..53acbeaf 100644
--- a/decoder/LAVVideo/decoders/ILAVDecoder.h
+++ b/decoder/LAVVideo/decoders/ILAVDecoder.h
@@ -365,7 +365,7 @@ interface ILAVDecoder
* Query whether the format can potentially be interlaced.
* This function should return false if the format can 100% not be interlaced, and true if it can be interlaced (but also progressive).
*/
- STDMETHOD_(BOOL, IsInterlaced)() PURE;
+ STDMETHOD_(BOOL, IsInterlaced)(BOOL bAllowGuess) PURE;
/**
* Allows the decoder to handle an allocator.
diff --git a/decoder/LAVVideo/decoders/avcodec.cpp b/decoder/LAVVideo/decoders/avcodec.cpp
index aca38425..1ae33d43 100644
--- a/decoder/LAVVideo/decoders/avcodec.cpp
+++ b/decoder/LAVVideo/decoders/avcodec.cpp
@@ -1059,7 +1059,7 @@ STDMETHODIMP_(REFERENCE_TIME) CDecAvcodec::GetFrameDuration()
return 0;
}
-STDMETHODIMP_(BOOL) CDecAvcodec::IsInterlaced()
+STDMETHODIMP_(BOOL) CDecAvcodec::IsInterlaced(BOOL bAllowGuess)
{
- return (m_iInterlaced != 0 || m_pSettings->GetDeinterlacingMode() == DeintMode_Force);
+ return (bAllowGuess && m_iInterlaced) || (m_iInterlaced > 0) || m_pSettings->GetDeinterlacingMode() == DeintMode_Force;
}
diff --git a/decoder/LAVVideo/decoders/avcodec.h b/decoder/LAVVideo/decoders/avcodec.h
index 39862c7d..c3efa64d 100644
--- a/decoder/LAVVideo/decoders/avcodec.h
+++ b/decoder/LAVVideo/decoders/avcodec.h
@@ -43,7 +43,7 @@ public:
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
STDMETHODIMP_(REFERENCE_TIME) GetFrameDuration();
- STDMETHODIMP_(BOOL) IsInterlaced();
+ STDMETHODIMP_(BOOL) IsInterlaced(BOOL bAllowGuess);
STDMETHODIMP_(const WCHAR*) GetDecoderName() { return L"avcodec"; }
STDMETHODIMP HasThreadSafeBuffers() { return S_OK; }
STDMETHODIMP SyncToProcessThread() { return m_pAVCtx && m_pAVCtx->active_thread_type ? S_OK : S_FALSE; }
diff --git a/decoder/LAVVideo/decoders/cuvid.cpp b/decoder/LAVVideo/decoders/cuvid.cpp
index a8af956a..eb385418 100644
--- a/decoder/LAVVideo/decoders/cuvid.cpp
+++ b/decoder/LAVVideo/decoders/cuvid.cpp
@@ -1297,7 +1297,7 @@ STDMETHODIMP_(REFERENCE_TIME) CDecCuvid::GetFrameDuration()
return 0;
}
-STDMETHODIMP_(BOOL) CDecCuvid::IsInterlaced()
+STDMETHODIMP_(BOOL) CDecCuvid::IsInterlaced(BOOL bAllowGuess)
{
return (m_bInterlaced || m_pSettings->GetDeinterlacingMode() == DeintMode_Force) && (m_VideoDecoderInfo.DeinterlaceMode == cudaVideoDeinterlaceMode_Weave);
}
diff --git a/decoder/LAVVideo/decoders/cuvid.h b/decoder/LAVVideo/decoders/cuvid.h
index 0ec9ecfb..68fc2312 100644
--- a/decoder/LAVVideo/decoders/cuvid.h
+++ b/decoder/LAVVideo/decoders/cuvid.h
@@ -50,7 +50,7 @@ public:
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
STDMETHODIMP_(REFERENCE_TIME) GetFrameDuration();
- STDMETHODIMP_(BOOL) IsInterlaced();
+ STDMETHODIMP_(BOOL) IsInterlaced(BOOL bAllowGuess);
STDMETHODIMP_(const WCHAR*) GetDecoderName() { return L"cuvid"; }
STDMETHODIMP GetHWAccelActiveDevice(BSTR *pstrDeviceName);
diff --git a/decoder/LAVVideo/decoders/msdk_mvc.h b/decoder/LAVVideo/decoders/msdk_mvc.h
index 48c26015..38042a40 100644
--- a/decoder/LAVVideo/decoders/msdk_mvc.h
+++ b/decoder/LAVVideo/decoders/msdk_mvc.h
@@ -58,7 +58,7 @@ public:
STDMETHODIMP Flush();
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp) { if (pPix) *pPix = LAVPixFmt_NV12; if (pBpp) *pBpp = 8; return S_OK; }
- STDMETHODIMP_(BOOL) IsInterlaced() { return FALSE; }
+ STDMETHODIMP_(BOOL) IsInterlaced(BOOL bAllowGuess) { return FALSE; }
STDMETHODIMP_(const WCHAR*) GetDecoderName() { return L"msdk mvc"; }
STDMETHODIMP HasThreadSafeBuffers() { return S_OK; }
diff --git a/decoder/LAVVideo/decoders/quicksync.cpp b/decoder/LAVVideo/decoders/quicksync.cpp
index 87ad806b..cfaf141e 100644
--- a/decoder/LAVVideo/decoders/quicksync.cpp
+++ b/decoder/LAVVideo/decoders/quicksync.cpp
@@ -685,7 +685,7 @@ STDMETHODIMP_(REFERENCE_TIME) CDecQuickSync::GetFrameDuration()
return (m_bInterlaced && m_bDI && m_pSettings->GetHWAccelDeintOutput() == DeintOutput_FramePerField) ? rtDuration / 2 : rtDuration;
}
-STDMETHODIMP_(BOOL) CDecQuickSync::IsInterlaced()
+STDMETHODIMP_(BOOL) CDecQuickSync::IsInterlaced(BOOL bAllowGuess)
{
return (m_bInterlaced || m_pSettings->GetDeinterlacingMode() == DeintMode_Force) && !m_bDI;
}
diff --git a/decoder/LAVVideo/decoders/quicksync.h b/decoder/LAVVideo/decoders/quicksync.h
index 9b94d2bc..a4bf261e 100644
--- a/decoder/LAVVideo/decoders/quicksync.h
+++ b/decoder/LAVVideo/decoders/quicksync.h
@@ -42,7 +42,7 @@ public:
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
STDMETHODIMP_(REFERENCE_TIME) GetFrameDuration();
- STDMETHODIMP_(BOOL) IsInterlaced();
+ STDMETHODIMP_(BOOL) IsInterlaced(BOOL bAllowGuess);
STDMETHODIMP_(const WCHAR*) GetDecoderName() { return L"quicksync"; }
STDMETHODIMP PostConnect(IPin *pPin);
diff --git a/decoder/LAVVideo/decoders/wmv9.cpp b/decoder/LAVVideo/decoders/wmv9.cpp
index 0be59f6e..1b81fe87 100644
--- a/decoder/LAVVideo/decoders/wmv9.cpp
+++ b/decoder/LAVVideo/decoders/wmv9.cpp
@@ -604,7 +604,7 @@ STDMETHODIMP_(REFERENCE_TIME) CDecWMV9::GetFrameDuration()
return 0;
}
-STDMETHODIMP_(BOOL) CDecWMV9::IsInterlaced()
+STDMETHODIMP_(BOOL) CDecWMV9::IsInterlaced(BOOL bAllowGuess)
{
return (m_bInterlaced || m_pSettings->GetDeinterlacingMode() == DeintMode_Force);
}
diff --git a/decoder/LAVVideo/decoders/wmv9.h b/decoder/LAVVideo/decoders/wmv9.h
index c0842055..d41ec670 100644
--- a/decoder/LAVVideo/decoders/wmv9.h
+++ b/decoder/LAVVideo/decoders/wmv9.h
@@ -46,7 +46,7 @@ public:
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
STDMETHODIMP_(REFERENCE_TIME) GetFrameDuration();
- STDMETHODIMP_(BOOL) IsInterlaced();
+ STDMETHODIMP_(BOOL) IsInterlaced(BOOL bAllowGuess);
STDMETHODIMP_(const WCHAR*) GetDecoderName() { return L"wmv9 dmo"; }
STDMETHODIMP HasThreadSafeBuffers() { return S_OK; }
diff --git a/decoder/LAVVideo/decoders/wmv9mft.cpp b/decoder/LAVVideo/decoders/wmv9mft.cpp
index 73a5816a..ef4b9b4e 100644
--- a/decoder/LAVVideo/decoders/wmv9mft.cpp
+++ b/decoder/LAVVideo/decoders/wmv9mft.cpp
@@ -629,7 +629,7 @@ STDMETHODIMP CDecWMV9MFT::GetPixelFormat(LAVPixelFormat *pPix, int *pBpp)
return S_OK;
}
-STDMETHODIMP_(BOOL) CDecWMV9MFT::IsInterlaced()
+STDMETHODIMP_(BOOL) CDecWMV9MFT::IsInterlaced(BOOL bAllowGuess)
{
return (m_bInterlaced || m_pSettings->GetDeinterlacingMode() == DeintMode_Force);
}
diff --git a/decoder/LAVVideo/decoders/wmv9mft.h b/decoder/LAVVideo/decoders/wmv9mft.h
index 490e300f..d3855877 100644
--- a/decoder/LAVVideo/decoders/wmv9mft.h
+++ b/decoder/LAVVideo/decoders/wmv9mft.h
@@ -63,7 +63,7 @@ public:
STDMETHODIMP Flush();
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
- STDMETHODIMP_(BOOL) IsInterlaced();
+ STDMETHODIMP_(BOOL) IsInterlaced(BOOL bAllowGuess);
STDMETHODIMP_(const WCHAR*) GetDecoderName() { return L"wmv9 mft"; }
STDMETHODIMP HasThreadSafeBuffers() { return S_OK; }