diff options
author | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-21 07:23:13 +0400 |
---|---|---|
committer | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-21 07:23:13 +0400 |
commit | 2f3e47055017d851b693a9fbcfcca25d03648c81 (patch) | |
tree | 8a826c3f947c0132f948337283d19ab3f02fd0fa /src/filters/transform/Mpeg2DecFilter | |
parent | 37f62abd654047d060c86d6c76cd2f6862f89b94 (diff) |
Added new ELA deinterlacing to MPEG2 codec
First corrupted frame with deintrlacing fixed with MPEG2 codec
MPEG2 setting check box fixed
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1908 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/Mpeg2DecFilter')
4 files changed, 37 insertions, 10 deletions
diff --git a/src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h b/src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h index c4112dcc1..dea9aa3df 100644 --- a/src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h +++ b/src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h @@ -21,7 +21,7 @@ #pragma once
-typedef enum {DIAuto, DIWeave, DIBlend, DIBob, DIFieldShift} ditype;
+typedef enum {DIAuto, DIWeave, DIBlend, DIBob, DIFieldShift, DIELA} ditype;
[uuid("0ABEAA65-0317-47B9-AE1D-D9EA905AFD25")]
interface IMpeg2DecFilter : public IUnknown
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp index 7eb4f94b5..edadff652 100644 --- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp +++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp @@ -193,6 +193,7 @@ CMpeg2DecFilterApp theApp; CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr)
: CBaseVideoFilter(NAME("CMpeg2DecFilter"), lpunk, phr, __uuidof(this), 1)
, m_fWaitForKeyFrame(true)
+ , m_fInitializedBuffer(true)
{
delete m_pInput;
// delete m_pOutput;
@@ -385,7 +386,7 @@ void CMpeg2DecFilter::SetDeinterlaceMethod() {
m_fb.di = GetDeinterlaceMethod();
- if(m_fb.di == DIAuto || m_fb.di != DIWeave && m_fb.di != DIBlend && m_fb.di != DIBob && m_fb.di != DIFieldShift)
+ if(m_fb.di == DIAuto || m_fb.di != DIWeave && m_fb.di != DIBlend && m_fb.di != DIBob && m_fb.di != DIFieldShift && m_fb.di != DIELA)
{
if(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
m_fb.di = DIWeave; // hurray!
@@ -508,7 +509,10 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn) int pitch = (m_dec->m_info.m_sequence->width + 31) & ~31;
if(m_fb.w != w || m_fb.h != h || m_fb.pitch != pitch)
+ {
m_fb.Alloc(w, h, pitch);
+ m_fInitializedBuffer = false;
+ }
// start - end
@@ -523,9 +527,13 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn) SetDeinterlaceMethod();
- if(S_OK != (hr = DeliverFast())
- && S_OK != (hr = DeliverNormal()))
+ hr = DeliverFast();
+ if(hr != S_OK)
+ hr = DeliverNormal();
+ if(hr != S_OK)
return hr;
+ if(hr == S_OK && !m_fWaitForKeyFrame)
+ m_fInitializedBuffer = true;
}
}
break;
@@ -649,7 +657,7 @@ HRESULT CMpeg2DecFilter::DeliverFast() HRESULT CMpeg2DecFilter::DeliverNormal()
{
- HRESULT hr;
+ HRESULT hr = S_OK;
CAutoLock cAutoLock(&m_csReceive);
@@ -695,6 +703,12 @@ HRESULT CMpeg2DecFilter::DeliverNormal() BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[1] + doffset/2, dpitch, 8, fbuf->buf[1] + soffset/2, spitch, 8);
BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[2] + doffset/2, dpitch, 8, fbuf->buf[2] + soffset/2, spitch, 8);
}
+ else if(m_fb.di == DIELA)
+ {
+ DeinterlaceELA(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, tff);
+ DeinterlaceELA(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, tff);
+ DeinterlaceELA(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, tff);
+ }
// postproc
@@ -702,8 +716,12 @@ HRESULT CMpeg2DecFilter::DeliverNormal() // deliver
- if(FAILED(hr = Deliver(false)))
- return hr;
+ if (m_fb.di == DIWeave || m_fInitializedBuffer)
+ {
+ hr = Deliver(false);
+ if(FAILED(hr))
+ return hr;
+ }
if(m_fb.di == DIBob)
{
@@ -720,8 +738,7 @@ HRESULT CMpeg2DecFilter::DeliverNormal() // deliver
- if(FAILED(hr = Deliver(false)))
- return hr;
+ hr = Deliver(false);
}
else if(m_fb.di == DIFieldShift)
{
@@ -731,8 +748,14 @@ HRESULT CMpeg2DecFilter::DeliverNormal() BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[1] + doffset/2, dpitch, 8, fbuf->buf[1] + soffset/2, spitch, 8);
BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[2] + doffset/2, dpitch, 8, fbuf->buf[2] + soffset/2, spitch, 8);
}
+ else if(m_fb.di == DIELA)
+ {
+ DeinterlaceELA(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, !tff);
+ DeinterlaceELA(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, !tff);
+ DeinterlaceELA(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, !tff);
+ }
- return S_OK;
+ return hr;
}
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h index 66a0acdd6..77eb9f0c6 100644 --- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h +++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h @@ -45,6 +45,7 @@ class CMpeg2DecFilter REFERENCE_TIME m_AvgTimePerFrame;
bool m_fWaitForKeyFrame;
+ bool m_fInitializedBuffer;
struct framebuf
{
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp index 101e126d3..da85591a0 100644 --- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp +++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp @@ -99,11 +99,14 @@ bool CMpeg2DecSettingsWnd::OnActivate() m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Blend")), (DWORD)DIBlend);
m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Bob")), (DWORD)DIBob);
m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Field Shift")), (DWORD)DIFieldShift);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("ELA")), (DWORD)DIELA);
m_ditype_combo.SetCurSel(0);
for(int i = 0; i < m_ditype_combo.GetCount(); i++)
if((int)m_ditype_combo.GetItemData(i) == m_ditype)
m_ditype_combo.SetCurSel(i);
+ m_ditype_combo.EnableWindow(!IsDlgButtonChecked(m_interlaced_check.GetDlgCtrlID()));
+
p.y += m_fontheight + 20;
for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_procamp_slider); i++, p.y += h)
|