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.3 2004-04-01 11:11:28 suxen_drol Exp $ |
* $Id: CXvidDecoder.cpp,v 1.15 2005-09-15 10:52:28 suxen_drol Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
36 |
place these paths at the top of the Tools|Options|Directories list |
place these paths at the top of the Tools|Options|Directories list |
37 |
|
|
38 |
headers: |
headers: |
39 |
C:\DXVCSDK\include |
C:\DX90SDK\Include |
40 |
C:\DXVCSDK\samples\Multimedia\DirectShow\BaseClasses |
C:\DX90SDK\Samples\C++\DirectShow\BaseClasses |
41 |
|
|
42 |
libraries (optional): |
C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\Release |
43 |
C:\DXVCSDK\samples\Multimedia\DirectShow\BaseClasses\Release |
C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\Debug |
44 |
*/ |
*/ |
45 |
|
|
46 |
|
|
204 |
#define XVID_DLL_NAME "xvidcore.dll" |
#define XVID_DLL_NAME "xvidcore.dll" |
205 |
|
|
206 |
CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) : |
CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) : |
207 |
CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID) |
CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID), m_hdll (NULL) |
208 |
{ |
{ |
209 |
DPRINTF("Constructor"); |
DPRINTF("Constructor"); |
210 |
|
|
211 |
|
xvid_decore_func = NULL; // Hmm, some strange errors appearing if I try to initialize... |
212 |
|
xvid_global_func = NULL; // ...this in constructor's init-list. So, they assigned here. |
213 |
|
|
214 |
|
LoadRegistryInfo(); |
215 |
|
|
216 |
|
*phr = OpenLib(); |
217 |
|
} |
218 |
|
|
219 |
|
HRESULT CXvidDecoder::OpenLib() |
220 |
|
{ |
221 |
|
DPRINTF("OpenLib"); |
222 |
|
|
223 |
|
if (m_hdll != NULL) |
224 |
|
return E_UNEXPECTED; // Seems, that library already opened. |
225 |
|
|
226 |
xvid_gbl_init_t init; |
xvid_gbl_init_t init; |
227 |
memset(&init, 0, sizeof(init)); |
memset(&init, 0, sizeof(init)); |
228 |
init.version = XVID_VERSION; |
init.version = XVID_VERSION; |
229 |
|
|
|
ar_x = ar_y = 0; |
|
|
|
|
230 |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
231 |
if (m_hdll == NULL) { |
if (m_hdll == NULL) { |
232 |
DPRINTF("dll load failed"); |
DPRINTF("dll load failed"); |
233 |
MessageBox(0, XVID_DLL_NAME " not found","Error", 0); |
MessageBox(0, XVID_DLL_NAME " not found","Error", MB_TOPMOST); |
234 |
return; |
return E_FAIL; |
235 |
} |
} |
236 |
|
|
237 |
xvid_global_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global"); |
xvid_global_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global"); |
238 |
if (xvid_global_func == NULL) { |
if (xvid_global_func == NULL) { |
239 |
MessageBox(0, "xvid_global() not found", "Error", 0); |
FreeLibrary(m_hdll); |
240 |
return; |
m_hdll = NULL; |
241 |
|
MessageBox(0, "xvid_global() not found", "Error", MB_TOPMOST); |
242 |
|
return E_FAIL; |
243 |
} |
} |
244 |
|
|
245 |
xvid_decore_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_decore"); |
xvid_decore_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_decore"); |
246 |
if (xvid_decore_func == NULL) { |
if (xvid_decore_func == NULL) { |
247 |
MessageBox(0, "xvid_decore() not found", "Error", 0); |
xvid_global_func = NULL; |
248 |
return; |
FreeLibrary(m_hdll); |
249 |
|
m_hdll = NULL; |
250 |
|
MessageBox(0, "xvid_decore() not found", "Error", MB_TOPMOST); |
251 |
|
return E_FAIL; |
252 |
} |
} |
253 |
|
|
254 |
if (xvid_global_func(0, XVID_GBL_INIT, &init, NULL) < 0) |
if (xvid_global_func(0, XVID_GBL_INIT, &init, NULL) < 0) |
255 |
{ |
{ |
256 |
MessageBox(0, "xvid_global() failed", "Error", 0); |
xvid_global_func = NULL; |
257 |
return; |
xvid_decore_func = NULL; |
258 |
|
FreeLibrary(m_hdll); |
259 |
|
m_hdll = NULL; |
260 |
|
MessageBox(0, "xvid_global() failed", "Error", MB_TOPMOST); |
261 |
|
return E_FAIL; |
262 |
} |
} |
263 |
|
|
264 |
memset(&m_create, 0, sizeof(m_create)); |
memset(&m_create, 0, sizeof(m_create)); |
268 |
memset(&m_frame, 0, sizeof(m_frame)); |
memset(&m_frame, 0, sizeof(m_frame)); |
269 |
m_frame.version = XVID_VERSION; |
m_frame.version = XVID_VERSION; |
270 |
|
|
|
LoadRegistryInfo(); |
|
|
|
|
271 |
USE_IYUV = false; |
USE_IYUV = false; |
272 |
USE_YV12 = false; |
USE_YV12 = false; |
273 |
USE_YUY2 = false; |
USE_YUY2 = false; |
305 |
USE_RGB32 = true; |
USE_RGB32 = true; |
306 |
break; |
break; |
307 |
} |
} |
|
} |
|
|
|
|
308 |
|
|
309 |
|
switch (g_config.aspect_ratio) |
310 |
|
{ |
311 |
|
case 0: |
312 |
|
case 1: |
313 |
|
break; |
314 |
|
case 2: |
315 |
|
ar_x = 4; |
316 |
|
ar_y = 3; |
317 |
|
break; |
318 |
|
case 3: |
319 |
|
ar_x = 16; |
320 |
|
ar_y = 9; |
321 |
|
break; |
322 |
|
case 4: |
323 |
|
ar_x = 47; |
324 |
|
ar_y = 20; |
325 |
|
break; |
326 |
|
} |
327 |
|
|
328 |
/* destructor */ |
return S_OK; |
329 |
|
} |
330 |
|
|
331 |
CXvidDecoder::~CXvidDecoder() |
void CXvidDecoder::CloseLib() |
332 |
{ |
{ |
333 |
DPRINTF("Destructor"); |
DPRINTF("CloseLib"); |
334 |
|
|
335 |
if (m_create.handle != NULL) |
if ((m_create.handle != NULL) && (xvid_decore_func != NULL)) |
336 |
{ |
{ |
337 |
xvid_decore_func(m_create.handle, XVID_DEC_DESTROY, 0, 0); |
xvid_decore_func(m_create.handle, XVID_DEC_DESTROY, 0, 0); |
338 |
m_create.handle = NULL; |
m_create.handle = NULL; |
339 |
} |
} |
340 |
|
|
341 |
if (m_hdll != NULL) |
if (m_hdll != NULL) { |
|
{ |
|
342 |
FreeLibrary(m_hdll); |
FreeLibrary(m_hdll); |
343 |
m_hdll = NULL; |
m_hdll = NULL; |
344 |
} |
} |
345 |
|
xvid_decore_func = NULL; |
346 |
|
xvid_global_func = NULL; |
347 |
|
} |
348 |
|
|
349 |
|
/* destructor */ |
350 |
|
|
351 |
|
CXvidDecoder::~CXvidDecoder() |
352 |
|
{ |
353 |
|
DPRINTF("Destructor"); |
354 |
|
CloseLib(); |
355 |
} |
} |
356 |
|
|
357 |
|
|
363 |
DPRINTF("CheckInputType"); |
DPRINTF("CheckInputType"); |
364 |
BITMAPINFOHEADER * hdr; |
BITMAPINFOHEADER * hdr; |
365 |
|
|
366 |
|
ar_x = ar_y = 0; |
367 |
|
|
368 |
if (*mtIn->Type() != MEDIATYPE_Video) |
if (*mtIn->Type() != MEDIATYPE_Video) |
369 |
{ |
{ |
370 |
DPRINTF("Error: Unknown Type"); |
DPRINTF("Error: Unknown Type"); |
371 |
|
CloseLib(); |
372 |
|
return VFW_E_TYPE_NOT_ACCEPTED; |
373 |
|
} |
374 |
|
|
375 |
|
if (m_hdll == NULL) |
376 |
|
{ |
377 |
|
HRESULT hr = OpenLib(); |
378 |
|
|
379 |
|
if (FAILED(hr) || (m_hdll == NULL)) // Paranoid checks. |
380 |
return VFW_E_TYPE_NOT_ACCEPTED; |
return VFW_E_TYPE_NOT_ACCEPTED; |
381 |
} |
} |
382 |
|
|
384 |
{ |
{ |
385 |
VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format(); |
VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format(); |
386 |
hdr = &vih->bmiHeader; |
hdr = &vih->bmiHeader; |
|
/* PAR (x:y) is (1/ppm_X):(1/ppm_Y) where ppm is pixels-per-meter |
|
|
which is equal to ppm_Y:ppm_X */ |
|
|
ar_x = vih->bmiHeader.biYPelsPerMeter * abs(hdr->biWidth); |
|
|
ar_y = vih->bmiHeader.biXPelsPerMeter * abs(hdr->biHeight); |
|
|
DPRINTF("VIDEOINFOHEADER PAR: %d:%d -> AR %d:%d", |
|
|
vih->bmiHeader.biYPelsPerMeter,vih->bmiHeader.biXPelsPerMeter, ar_x, ar_y); |
|
387 |
} |
} |
388 |
else if (*mtIn->FormatType() == FORMAT_VideoInfo2) |
else if (*mtIn->FormatType() == FORMAT_VideoInfo2) |
389 |
{ |
{ |
390 |
VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format(); |
VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format(); |
391 |
hdr = &vih2->bmiHeader; |
hdr = &vih2->bmiHeader; |
392 |
|
if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { |
393 |
ar_x = vih2->dwPictAspectRatioX; |
ar_x = vih2->dwPictAspectRatioX; |
394 |
ar_y = vih2->dwPictAspectRatioY; |
ar_y = vih2->dwPictAspectRatioY; |
395 |
|
} |
396 |
DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y); |
DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y); |
397 |
} |
} |
398 |
else |
else |
399 |
{ |
{ |
400 |
DPRINTF("Error: Unknown FormatType"); |
DPRINTF("Error: Unknown FormatType"); |
401 |
|
CloseLib(); |
402 |
return VFW_E_TYPE_NOT_ACCEPTED; |
return VFW_E_TYPE_NOT_ACCEPTED; |
403 |
} |
} |
404 |
|
|
414 |
{ |
{ |
415 |
|
|
416 |
case FOURCC_MP4V: |
case FOURCC_MP4V: |
417 |
if (!(g_config.supported_4cc & SUPPORT_MP4V)) return VFW_E_TYPE_NOT_ACCEPTED; |
if (!(g_config.supported_4cc & SUPPORT_MP4V)) { |
418 |
|
CloseLib(); |
419 |
|
return VFW_E_TYPE_NOT_ACCEPTED; |
420 |
|
} |
421 |
break; |
break; |
422 |
case FOURCC_DIVX : |
case FOURCC_DIVX : |
423 |
if (!(g_config.supported_4cc & SUPPORT_DIVX)) return VFW_E_TYPE_NOT_ACCEPTED; |
if (!(g_config.supported_4cc & SUPPORT_DIVX)) { |
424 |
|
CloseLib(); |
425 |
|
return VFW_E_TYPE_NOT_ACCEPTED; |
426 |
|
} |
427 |
break; |
break; |
428 |
case FOURCC_DX50 : |
case FOURCC_DX50 : |
429 |
if (!(g_config.supported_4cc & SUPPORT_DX50)) return VFW_E_TYPE_NOT_ACCEPTED; |
if (!(g_config.supported_4cc & SUPPORT_DX50)) { |
430 |
|
CloseLib(); |
431 |
|
return VFW_E_TYPE_NOT_ACCEPTED; |
432 |
|
} |
433 |
case FOURCC_XVID : |
case FOURCC_XVID : |
434 |
break; |
break; |
435 |
|
|
441 |
(hdr->biCompression>>8)&0xff, |
(hdr->biCompression>>8)&0xff, |
442 |
(hdr->biCompression>>16)&0xff, |
(hdr->biCompression>>16)&0xff, |
443 |
(hdr->biCompression>>24)&0xff); |
(hdr->biCompression>>24)&0xff); |
444 |
|
CloseLib(); |
445 |
return VFW_E_TYPE_NOT_ACCEPTED; |
return VFW_E_TYPE_NOT_ACCEPTED; |
446 |
} |
} |
447 |
return S_OK; |
return S_OK; |
472 |
if (ar_x != 0 && ar_y != 0) { |
if (ar_x != 0 && ar_y != 0) { |
473 |
vih->dwPictAspectRatioX = ar_x; |
vih->dwPictAspectRatioX = ar_x; |
474 |
vih->dwPictAspectRatioY = ar_y; |
vih->dwPictAspectRatioY = ar_y; |
475 |
|
forced_ar = true; |
476 |
} else { // just to be safe |
} else { // just to be safe |
477 |
vih->dwPictAspectRatioX = m_create.width; |
vih->dwPictAspectRatioX = m_create.width; |
478 |
vih->dwPictAspectRatioY = abs(m_create.height); |
vih->dwPictAspectRatioY = abs(m_create.height); |
479 |
|
forced_ar = false; |
480 |
} |
} |
|
|
|
481 |
} else { |
} else { |
482 |
|
|
483 |
VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER)); |
VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER)); |
585 |
|
|
586 |
|
|
587 |
/* (internal function) change colorspace */ |
/* (internal function) change colorspace */ |
588 |
|
#define CALC_BI_STRIDE(width,bitcount) ((((width * bitcount) + 31) & ~31) >> 3) |
589 |
|
|
590 |
HRESULT CXvidDecoder::ChangeColorspace(GUID subtype, GUID formattype, void * format) |
HRESULT CXvidDecoder::ChangeColorspace(GUID subtype, GUID formattype, void * format) |
591 |
{ |
{ |
592 |
|
DWORD biWidth; |
593 |
|
|
594 |
if (formattype == FORMAT_VideoInfo) |
if (formattype == FORMAT_VideoInfo) |
595 |
{ |
{ |
596 |
VIDEOINFOHEADER * vih = (VIDEOINFOHEADER * )format; |
VIDEOINFOHEADER * vih = (VIDEOINFOHEADER * )format; |
597 |
m_frame.output.stride[0] = (((vih->bmiHeader.biWidth * vih->bmiHeader.biBitCount) + 31) & ~31) >> 3; |
biWidth = vih->bmiHeader.biWidth; |
598 |
|
m_frame.output.stride[0] = CALC_BI_STRIDE(vih->bmiHeader.biWidth, vih->bmiHeader.biBitCount); |
599 |
rgb_flip = (vih->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP); |
rgb_flip = (vih->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP); |
600 |
} |
} |
601 |
else if (formattype == FORMAT_VideoInfo2) |
else if (formattype == FORMAT_VideoInfo2) |
602 |
{ |
{ |
603 |
VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 * )format; |
VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 * )format; |
604 |
m_frame.output.stride[0] = (((vih2->bmiHeader.biWidth * vih2->bmiHeader.biBitCount) + 31) & ~31) >> 3; |
biWidth = vih2->bmiHeader.biWidth; |
605 |
|
m_frame.output.stride[0] = CALC_BI_STRIDE(vih2->bmiHeader.biWidth, vih2->bmiHeader.biBitCount); |
606 |
rgb_flip = (vih2->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP); |
rgb_flip = (vih2->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP); |
607 |
} |
} |
608 |
else |
else |
615 |
DPRINTF("IYUV"); |
DPRINTF("IYUV"); |
616 |
rgb_flip = 0; |
rgb_flip = 0; |
617 |
m_frame.output.csp = XVID_CSP_I420; |
m_frame.output.csp = XVID_CSP_I420; |
618 |
m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3; /* planar format fix */ |
m_frame.output.stride[0] = CALC_BI_STRIDE(biWidth, 8); /* planar format fix */ |
619 |
} |
} |
620 |
else if (subtype == MEDIASUBTYPE_YV12) |
else if (subtype == MEDIASUBTYPE_YV12) |
621 |
{ |
{ |
622 |
DPRINTF("YV12"); |
DPRINTF("YV12"); |
623 |
rgb_flip = 0; |
rgb_flip = 0; |
624 |
m_frame.output.csp = XVID_CSP_YV12; |
m_frame.output.csp = XVID_CSP_YV12; |
625 |
m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3; /* planar format fix */ |
m_frame.output.stride[0] = CALC_BI_STRIDE(biWidth, 8); /* planar format fix */ |
626 |
} |
} |
627 |
else if (subtype == MEDIASUBTYPE_YUY2) |
else if (subtype == MEDIASUBTYPE_YUY2) |
628 |
{ |
{ |
746 |
|
|
747 |
if (m_create.handle == NULL) |
if (m_create.handle == NULL) |
748 |
{ |
{ |
749 |
|
if (xvid_decore_func == NULL) |
750 |
|
return E_FAIL; |
751 |
|
|
752 |
if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) |
if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) |
753 |
{ |
{ |
754 |
DPRINTF("*** XVID_DEC_CREATE error"); |
DPRINTF("*** XVID_DEC_CREATE error"); |
786 |
m_frame.general = XVID_LOWDELAY; |
m_frame.general = XVID_LOWDELAY; |
787 |
|
|
788 |
if (pIn->IsDiscontinuity() == S_OK) |
if (pIn->IsDiscontinuity() == S_OK) |
789 |
m_frame.general = XVID_DISCONTINUITY; |
m_frame.general |= XVID_DISCONTINUITY; |
790 |
|
|
791 |
if (g_config.nDeblock_Y) |
if (g_config.nDeblock_Y) |
792 |
m_frame.general |= XVID_DEBLOCKY; |
m_frame.general |= XVID_DEBLOCKY; |
793 |
|
|
794 |
if (g_config.nDeblock_UV) |
if (g_config.nDeblock_UV) |
795 |
m_frame.general |= XVID_DEBLOCKUV; |
m_frame.general |= XVID_DEBLOCKUV; |
796 |
/* |
|
797 |
if (g_config.nDering) |
if (g_config.nDering_Y) |
798 |
m_frame.general |= XVID_DERING; |
m_frame.general |= XVID_DERINGY; |
799 |
*/ |
|
800 |
|
if (g_config.nDering_UV) |
801 |
|
m_frame.general |= XVID_DERINGUV; |
802 |
|
|
803 |
if (g_config.nFilmEffect) |
if (g_config.nFilmEffect) |
804 |
m_frame.general |= XVID_FILMEFFECT; |
m_frame.general |= XVID_FILMEFFECT; |
805 |
|
|
808 |
m_frame.output.csp &= ~XVID_CSP_VFLIP; |
m_frame.output.csp &= ~XVID_CSP_VFLIP; |
809 |
m_frame.output.csp |= rgb_flip^(g_config.nFlipVideo ? XVID_CSP_VFLIP : 0); |
m_frame.output.csp |= rgb_flip^(g_config.nFlipVideo ? XVID_CSP_VFLIP : 0); |
810 |
|
|
811 |
|
// Paranoid check. |
812 |
|
if (xvid_decore_func == NULL) |
813 |
|
return E_FAIL; |
814 |
|
|
815 |
|
|
816 |
|
|
817 |
repeat : |
repeat : |
818 |
|
|
819 |
if (pIn->IsPreroll() != S_OK) |
if (pIn->IsPreroll() != S_OK) |
824 |
{ |
{ |
825 |
DPRINTF("*** XVID_DEC_DECODE"); |
DPRINTF("*** XVID_DEC_DECODE"); |
826 |
return S_FALSE; |
return S_FALSE; |
827 |
|
} else |
828 |
|
if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1 && forced_ar == false) { |
829 |
|
|
830 |
|
if (stats.type != XVID_TYPE_NOTHING) { /* dont attempt to set vmr aspect ratio if no frame was returned by decoder */ |
831 |
|
// inspired by minolta! works for VMR 7 + 9 |
832 |
|
IMediaSample2 *pOut2 = NULL; |
833 |
|
AM_SAMPLE2_PROPERTIES outProp2; |
834 |
|
if (SUCCEEDED(pOut->QueryInterface(IID_IMediaSample2, (void **)&pOut2)) && |
835 |
|
SUCCEEDED(pOut2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&outProp2))) |
836 |
|
{ |
837 |
|
CMediaType mtOut2 = m_pOutput->CurrentMediaType(); |
838 |
|
VIDEOINFOHEADER2* vihOut2 = (VIDEOINFOHEADER2*)mtOut2.Format(); |
839 |
|
|
840 |
|
if (*mtOut2.FormatType() == FORMAT_VideoInfo2 && |
841 |
|
vihOut2->dwPictAspectRatioX != ar_x && vihOut2->dwPictAspectRatioY != ar_y) |
842 |
|
{ |
843 |
|
vihOut2->dwPictAspectRatioX = ar_x; |
844 |
|
vihOut2->dwPictAspectRatioY = ar_y; |
845 |
|
pOut2->SetMediaType(&mtOut2); |
846 |
|
m_pOutput->SetMediaType(&mtOut2); |
847 |
|
} |
848 |
|
pOut2->Release(); |
849 |
|
} |
850 |
|
} |
851 |
} |
} |
852 |
} |
} |
853 |
else |
else |
889 |
return S_FALSE; |
return S_FALSE; |
890 |
} |
} |
891 |
|
|
|
// pOut->SetDiscontinuity(TRUE); |
|
892 |
pOut->SetSyncPoint(TRUE); |
pOut->SetSyncPoint(TRUE); |
893 |
|
|
894 |
|
if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) { /* auto */ |
895 |
|
int par_x, par_y; |
896 |
|
if (stats.data.vol.par == XVID_PAR_EXT) { |
897 |
|
par_x = stats.data.vol.par_width; |
898 |
|
par_y = stats.data.vol.par_height; |
899 |
|
} else { |
900 |
|
par_x = PARS[stats.data.vol.par-1][0]; |
901 |
|
par_y = PARS[stats.data.vol.par-1][1]; |
902 |
|
} |
903 |
|
|
904 |
|
ar_x = par_x * stats.data.vol.width; |
905 |
|
ar_y = par_y * stats.data.vol.height; |
906 |
|
} |
907 |
|
|
908 |
m_frame.bitstream = (BYTE*)m_frame.bitstream + length; |
m_frame.bitstream = (BYTE*)m_frame.bitstream + length; |
909 |
m_frame.length -= length; |
m_frame.length -= length; |
910 |
goto repeat; |
goto repeat; |