193 |
|
|
194 |
if (lpbiOutput == NULL) |
if (lpbiOutput == NULL) |
195 |
{ |
{ |
196 |
return sizeof(BITMAPV4HEADER); |
return sizeof(BITMAPINFOHEADER); |
197 |
} |
} |
198 |
|
|
199 |
memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER)); |
memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER)); |
386 |
frame.general |= XVID_HALFPEL; |
frame.general |= XVID_HALFPEL; |
387 |
// frame.general |= XVID_ME_EPZS; |
// frame.general |= XVID_ME_EPZS; |
388 |
|
|
389 |
|
frame.general |= XVID_HQACPRED; |
390 |
|
|
391 |
|
frame.bframe_threshold = 255; |
392 |
|
|
393 |
if (codec->config.motion_search > 4) |
if (codec->config.motion_search > 4) |
394 |
frame.general |= XVID_INTER4V; |
frame.general |= XVID_INTER4V; |
408 |
frame.general |= XVID_GMC; |
frame.general |= XVID_GMC; |
409 |
|
|
410 |
if (codec->config.chromame) |
if (codec->config.chromame) |
411 |
frame.general |= XVID_ME_COLOUR; |
frame.motion |= PMV_CHROMA16 + PMV_CHROMA8; |
412 |
|
|
413 |
if (codec->config.reduced_resolution) |
if (codec->config.reduced_resolution) |
414 |
frame.general |= XVID_REDUCED; |
frame.general |= XVID_REDUCED; |
415 |
|
|
416 |
|
if (codec->config.chroma_opt) |
417 |
|
frame.general |= XVID_CHROMAOPT; |
418 |
// added by koepi for credits greyscale |
// added by koepi for credits greyscale |
419 |
|
|
420 |
check_greyscale_mode(&codec->config, &frame, codec->framenum); |
check_greyscale_mode(&codec->config, &frame, codec->framenum); |
463 |
|
|
464 |
frame.motion |= pmvfast_presets[codec->config.motion_search]; |
frame.motion |= pmvfast_presets[codec->config.motion_search]; |
465 |
|
|
466 |
|
switch (codec->config.vhq_mode) |
467 |
|
{ |
468 |
|
case VHQ_MODE_DECISION : |
469 |
|
frame.general |= XVID_MODEDECISION_BITS; |
470 |
|
break; |
471 |
|
|
472 |
|
case VHQ_LIMITED_SEARCH : |
473 |
|
frame.general |= XVID_MODEDECISION_BITS; |
474 |
|
frame.motion |= HALFPELREFINE16_BITS; |
475 |
|
frame.motion |= QUARTERPELREFINE16_BITS; |
476 |
|
break; |
477 |
|
|
478 |
|
case VHQ_MEDIUM_SEARCH : |
479 |
|
frame.general |= XVID_MODEDECISION_BITS; |
480 |
|
frame.motion |= HALFPELREFINE16_BITS; |
481 |
|
frame.motion |= HALFPELREFINE8_BITS; |
482 |
|
frame.motion |= QUARTERPELREFINE16_BITS; |
483 |
|
frame.motion |= QUARTERPELREFINE8_BITS; |
484 |
|
frame.motion |= CHECKPREDICTION_BITS; |
485 |
|
break; |
486 |
|
|
487 |
|
case VHQ_WIDE_SEARCH : |
488 |
|
frame.general |= XVID_MODEDECISION_BITS; |
489 |
|
frame.motion |= HALFPELREFINE16_BITS; |
490 |
|
frame.motion |= HALFPELREFINE8_BITS; |
491 |
|
frame.motion |= QUARTERPELREFINE16_BITS; |
492 |
|
frame.motion |= QUARTERPELREFINE8_BITS; |
493 |
|
frame.motion |= CHECKPREDICTION_BITS; |
494 |
|
frame.motion |= EXTSEARCH_BITS; |
495 |
|
break; |
496 |
|
|
497 |
|
default : |
498 |
|
break; |
499 |
|
} |
500 |
|
|
501 |
frame.image = icc->lpInput; |
frame.image = icc->lpInput; |
502 |
frame.stride = (((icc->lpbiInput->biWidth * icc->lpbiInput->biBitCount) + 31) & ~31) >> 3; |
frame.stride = (((icc->lpbiInput->biWidth * icc->lpbiInput->biBitCount) + 31) & ~31) >> 3; |
503 |
|
|
584 |
} |
} |
585 |
|
|
586 |
frame.bquant = 0; |
frame.bquant = 0; |
587 |
|
frame.bframe_threshold = 0; |
588 |
|
|
589 |
// OutputDebugString(" "); |
// OutputDebugString(" "); |
590 |
switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats)) |
switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats)) |
608 |
{ |
{ |
609 |
*icc->lpdwFlags = 0; |
*icc->lpdwFlags = 0; |
610 |
} |
} |
611 |
|
if (frame.length == 0) { frame.length = 1; *((unsigned char*)frame.bitstream) = 0x7f; } |
612 |
|
|
613 |
outhdr->biSizeImage = frame.length; |
outhdr->biSizeImage = frame.length; |
614 |
|
|
704 |
} |
} |
705 |
/* --- yv12 --- */ |
/* --- yv12 --- */ |
706 |
|
|
707 |
result = decompress_query(codec, lpbiInput, lpbiOutput); |
result = decompress_query(codec, lpbiInput, NULL); |
708 |
if (result != ICERR_OK) |
if (result != ICERR_OK) |
709 |
{ |
{ |
710 |
return result; |
return result; |
711 |
} |
} |
712 |
|
|
|
memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER)); |
|
713 |
outhdr->biSize = sizeof(BITMAPINFOHEADER); |
outhdr->biSize = sizeof(BITMAPINFOHEADER); |
714 |
outhdr->biCompression = FOURCC_YUY2; |
outhdr->biWidth = inhdr->biWidth; |
715 |
|
outhdr->biHeight = inhdr->biHeight; |
716 |
|
outhdr->biPlanes = 1; |
717 |
|
outhdr->biBitCount = 24; |
718 |
|
outhdr->biCompression = BI_RGB; /* sonic foundry vegas video v3 only supports BI_RGB */ |
719 |
outhdr->biSizeImage = outhdr->biWidth * outhdr->biHeight * outhdr->biBitCount; |
outhdr->biSizeImage = outhdr->biWidth * outhdr->biHeight * outhdr->biBitCount; |
720 |
outhdr->biXPelsPerMeter = 0; |
outhdr->biXPelsPerMeter = 0; |
721 |
outhdr->biYPelsPerMeter = 0; |
outhdr->biYPelsPerMeter = 0; |