19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: CXvidDecoder.cpp,v 1.1.2.10 2004-01-09 04:37:59 syskin Exp $ |
* $Id: CXvidDecoder.cpp,v 1.1.2.15 2004-01-30 13:13:10 syskin Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
63 |
|
|
64 |
// Externs defined here |
// Externs defined here |
65 |
PostProcessing_Settings PPSettings; |
PostProcessing_Settings PPSettings; |
66 |
|
unsigned int supported_4cc; |
67 |
int rgb_flip; |
int rgb_flip; |
68 |
|
|
69 |
|
|
70 |
bool USE_IYUV; |
bool USE_IYUV; |
71 |
bool USE_YV12; |
bool USE_YV12; |
72 |
bool USE_YUY2; |
bool USE_YUY2; |
85 |
{ &MEDIATYPE_Video, &CLSID_DIVX_UC }, |
{ &MEDIATYPE_Video, &CLSID_DIVX_UC }, |
86 |
{ &MEDIATYPE_Video, &CLSID_DX50 }, |
{ &MEDIATYPE_Video, &CLSID_DX50 }, |
87 |
{ &MEDIATYPE_Video, &CLSID_DX50_UC }, |
{ &MEDIATYPE_Video, &CLSID_DX50_UC }, |
88 |
|
{ &MEDIATYPE_Video, &CLSID_MP4V }, |
89 |
}; |
}; |
90 |
|
|
91 |
const AMOVIESETUP_MEDIATYPE sudOutputPinTypes[] = |
const AMOVIESETUP_MEDIATYPE sudOutputPinTypes[] = |
254 |
|
|
255 |
// Set the default post-processing settings |
// Set the default post-processing settings |
256 |
REG_GET_N("Brightness", PPSettings.nBrightness, 25) |
REG_GET_N("Brightness", PPSettings.nBrightness, 25) |
257 |
REG_GET_N("Deblock_Y", PPSettings.bDeblock_Y, 1) |
REG_GET_N("Deblock_Y", PPSettings.nDeblock_Y, 0) |
258 |
REG_GET_N("Deblock_UV", PPSettings.bDeblock_UV, 1) |
REG_GET_N("Deblock_UV", PPSettings.nDeblock_UV, 0) |
259 |
REG_GET_N("Dering", PPSettings.bDering, 1) |
REG_GET_N("Dering", PPSettings.nDering, 0) |
260 |
REG_GET_N("FilmEffect", PPSettings.bFilmEffect, 1) |
REG_GET_N("FilmEffect", PPSettings.nFilmEffect, 0) |
261 |
REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0) |
REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0) |
262 |
|
REG_GET_N("FlipVideo", PPSettings.nFlipVideo, 0) |
263 |
|
REG_GET_N("Supported_4CC", supported_4cc, 0) |
264 |
|
|
265 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
266 |
|
|
371 |
|
|
372 |
switch(hdr->biCompression) |
switch(hdr->biCompression) |
373 |
{ |
{ |
374 |
|
|
375 |
|
case FOURCC_MP4V: |
376 |
|
if (!(supported_4cc & SUPPORT_MP4V)) return VFW_E_TYPE_NOT_ACCEPTED; |
377 |
|
break; |
378 |
|
case FOURCC_DIVX : |
379 |
|
if (!(supported_4cc & SUPPORT_DIVX)) return VFW_E_TYPE_NOT_ACCEPTED; |
380 |
|
break; |
381 |
|
case FOURCC_DX50 : |
382 |
|
if (!(supported_4cc & SUPPORT_DX50)) return VFW_E_TYPE_NOT_ACCEPTED; |
383 |
case FOURCC_XVID : |
case FOURCC_XVID : |
|
// case FOURCC_DIVX : |
|
|
// case FOURCC_DX50 : |
|
384 |
break; |
break; |
385 |
|
|
386 |
|
|
387 |
default : |
default : |
388 |
DPRINTF("Unknown fourcc: 0x%08x (%c%c%c%c)", |
DPRINTF("Unknown fourcc: 0x%08x (%c%c%c%c)", |
389 |
hdr->biCompression, |
hdr->biCompression, |
393 |
(hdr->biCompression>>24)&0xff); |
(hdr->biCompression>>24)&0xff); |
394 |
return VFW_E_TYPE_NOT_ACCEPTED; |
return VFW_E_TYPE_NOT_ACCEPTED; |
395 |
} |
} |
|
|
|
396 |
return S_OK; |
return S_OK; |
397 |
} |
} |
398 |
|
|
548 |
if (subtype == CLSID_MEDIASUBTYPE_IYUV) |
if (subtype == CLSID_MEDIASUBTYPE_IYUV) |
549 |
{ |
{ |
550 |
DPRINTF("IYUV"); |
DPRINTF("IYUV"); |
551 |
|
rgb_flip = 0; |
552 |
m_frame.output.csp = XVID_CSP_I420; |
m_frame.output.csp = XVID_CSP_I420; |
553 |
m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3; /* planar format fix */ |
m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3; /* planar format fix */ |
554 |
} |
} |
555 |
else if (subtype == MEDIASUBTYPE_YV12) |
else if (subtype == MEDIASUBTYPE_YV12) |
556 |
{ |
{ |
557 |
DPRINTF("YV12"); |
DPRINTF("YV12"); |
558 |
|
rgb_flip = 0; |
559 |
m_frame.output.csp = XVID_CSP_YV12; |
m_frame.output.csp = XVID_CSP_YV12; |
560 |
m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3; /* planar format fix */ |
m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3; /* planar format fix */ |
561 |
} |
} |
562 |
else if (subtype == MEDIASUBTYPE_YUY2) |
else if (subtype == MEDIASUBTYPE_YUY2) |
563 |
{ |
{ |
564 |
DPRINTF("YUY2"); |
DPRINTF("YUY2"); |
565 |
|
rgb_flip = 0; |
566 |
m_frame.output.csp = XVID_CSP_YUY2; |
m_frame.output.csp = XVID_CSP_YUY2; |
567 |
} |
} |
568 |
else if (subtype == MEDIASUBTYPE_YVYU) |
else if (subtype == MEDIASUBTYPE_YVYU) |
569 |
{ |
{ |
570 |
DPRINTF("YVYU"); |
DPRINTF("YVYU"); |
571 |
|
rgb_flip = 0; |
572 |
m_frame.output.csp = XVID_CSP_YVYU; |
m_frame.output.csp = XVID_CSP_YVYU; |
573 |
} |
} |
574 |
else if (subtype == MEDIASUBTYPE_UYVY) |
else if (subtype == MEDIASUBTYPE_UYVY) |
575 |
{ |
{ |
576 |
DPRINTF("UYVY"); |
DPRINTF("UYVY"); |
577 |
|
rgb_flip = 0; |
578 |
m_frame.output.csp = XVID_CSP_UYVY; |
m_frame.output.csp = XVID_CSP_UYVY; |
579 |
} |
} |
580 |
else if (subtype == MEDIASUBTYPE_RGB32) |
else if (subtype == MEDIASUBTYPE_RGB32) |
720 |
if (pIn->IsDiscontinuity() == S_OK) |
if (pIn->IsDiscontinuity() == S_OK) |
721 |
m_frame.general = XVID_DISCONTINUITY; |
m_frame.general = XVID_DISCONTINUITY; |
722 |
|
|
723 |
if (PPSettings.bDeblock_Y) |
if (PPSettings.nDeblock_Y) |
724 |
m_frame.general |= XVID_DEBLOCKY; |
m_frame.general |= XVID_DEBLOCKY; |
725 |
|
|
726 |
if (PPSettings.bDeblock_UV) |
if (PPSettings.nDeblock_UV) |
727 |
m_frame.general |= XVID_DEBLOCKUV; |
m_frame.general |= XVID_DEBLOCKUV; |
728 |
/* |
/* |
729 |
if (PPSettings.bDering) |
if (PPSettings.nDering) |
730 |
m_frame.general |= XVID_DERING; |
m_frame.general |= XVID_DERING; |
731 |
*/ |
*/ |
732 |
if (PPSettings.bFilmEffect) |
if (PPSettings.nFilmEffect) |
733 |
m_frame.general |= XVID_FILMEFFECT; |
m_frame.general |= XVID_FILMEFFECT; |
734 |
|
|
735 |
m_frame.output.csp &= ~XVID_CSP_VFLIP; |
m_frame.output.csp &= ~XVID_CSP_VFLIP; |
736 |
m_frame.output.csp |= rgb_flip^(PPSettings.bFlipVideo ? XVID_CSP_VFLIP : 0); |
m_frame.output.csp |= rgb_flip^(PPSettings.nFlipVideo ? XVID_CSP_VFLIP : 0); |
737 |
|
|
738 |
repeat : |
repeat : |
739 |
|
|
771 |
m_frame.general = tmp_gen; |
m_frame.general = tmp_gen; |
772 |
} |
} |
773 |
|
|
774 |
if (stats.type == XVID_TYPE_NOTHING) { |
if (stats.type == XVID_TYPE_NOTHING && length > 0) { |
775 |
DPRINTF("B-Frame decoder lag"); |
DPRINTF("B-Frame decoder lag"); |
776 |
return S_FALSE; |
return S_FALSE; |
777 |
} |
} |