23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
|
* 12.07.2002 num_threads |
27 |
|
* 23.06.2002 XVID_CPU_CHKONLY; loading speed up |
28 |
* 25.04.2002 ICDECOMPRESS_PREROLL |
* 25.04.2002 ICDECOMPRESS_PREROLL |
29 |
* 17.04.2002 re-enabled lumi masking for 1st pass |
* 17.04.2002 re-enabled lumi masking for 1st pass |
30 |
* 15.04.2002 updated cbr support |
* 15.04.2002 updated cbr support |
59 |
PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8, |
PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8, |
60 |
PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 | |
PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 | |
61 |
PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8 |
PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8 |
62 |
|
// | PMV_USESQUARES16 |
63 |
}; |
}; |
64 |
|
|
65 |
/* return xvid compatbile colorspace, |
/* return xvid compatbile colorspace, |
296 |
param.max_quantizer = codec->config.max_pquant; |
param.max_quantizer = codec->config.max_pquant; |
297 |
param.max_key_interval = codec->config.max_key_interval; |
param.max_key_interval = codec->config.max_key_interval; |
298 |
|
|
299 |
|
#ifdef _SMP |
300 |
|
param.num_threads = codec->config.num_threads; |
301 |
|
#endif |
302 |
|
|
303 |
#ifdef BFRAMES |
#ifdef BFRAMES |
304 |
param.packed = codec->config.packed; |
param.global = 0; |
305 |
|
if (codec->config.packed) param.global |= XVID_GLOBAL_PACKED; |
306 |
|
if (codec->config.dx50bvop) param.global |= XVID_GLOBAL_DX50BVOP; |
307 |
|
if (codec->config.debug) param.global |= XVID_GLOBAL_DEBUG; |
308 |
param.max_bframes = codec->config.max_bframes; |
param.max_bframes = codec->config.max_bframes; |
309 |
param.bquant_ratio = codec->config.bquant_ratio; |
param.bquant_ratio = codec->config.bquant_ratio; |
310 |
|
param.frame_drop_ratio = codec->config.frame_drop_ratio; |
311 |
#endif |
#endif |
312 |
|
|
313 |
switch(xvid_encore(0, XVID_ENC_CREATE, ¶m, NULL)) |
switch(xvid_encore(0, XVID_ENC_CREATE, ¶m, NULL)) |
386 |
frame.intra = -1; |
frame.intra = -1; |
387 |
|
|
388 |
frame.general |= XVID_HALFPEL; |
frame.general |= XVID_HALFPEL; |
389 |
|
// frame.general |= XVID_ME_EPZS; |
390 |
|
|
391 |
if (codec->config.motion_search > 4) |
if (codec->config.motion_search > 4) |
392 |
frame.general |= XVID_INTER4V; |
frame.general |= XVID_INTER4V; |
396 |
|
|
397 |
if (codec->config.interlacing) |
if (codec->config.interlacing) |
398 |
frame.general |= XVID_INTERLACING; |
frame.general |= XVID_INTERLACING; |
399 |
|
|
400 |
|
// added by koepi for credits greyscale |
401 |
|
check_greyscale_mode(&codec->config, &frame, codec->framenum); |
402 |
|
// end of koepi's addition |
403 |
|
|
404 |
// fix 1pass modes/hinted MV by koepi |
// fix 1pass modes/hinted MV by koepi |
405 |
if (codec->config.hinted_me && (codec->config.mode == DLG_MODE_CBR || codec->config.mode == DLG_MODE_VBR_QUAL || codec->config.mode == DLG_MODE_VBR_QUANT)) |
if (codec->config.hinted_me && (codec->config.mode == DLG_MODE_CBR || codec->config.mode == DLG_MODE_VBR_QUAL || codec->config.mode == DLG_MODE_VBR_QUANT)) |
406 |
{ |
{ |
523 |
frame.intra = 0; |
frame.intra = 0; |
524 |
} |
} |
525 |
|
|
526 |
OutputDebugString(" "); |
#ifdef BFRAMES |
527 |
|
frame.bquant = 0; |
528 |
|
#endif |
529 |
|
|
530 |
|
// OutputDebugString(" "); |
531 |
switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats)) |
switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats)) |
532 |
{ |
{ |
533 |
case XVID_ERR_FAIL : |
case XVID_ERR_FAIL : |
740 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
741 |
if (codec_is_in_credits(&codec->config, codec->framenum)) |
if (codec_is_in_credits(&codec->config, codec->framenum)) |
742 |
{ |
{ |
743 |
|
// added by koepi for credits greyscale |
744 |
|
check_greyscale_mode(&codec->config, frame, codec->framenum); |
745 |
|
// end of koepi's addition |
746 |
switch (codec->config.credits_mode) |
switch (codec->config.credits_mode) |
747 |
{ |
{ |
748 |
case CREDITS_MODE_RATE : |
case CREDITS_MODE_RATE : |
760 |
} |
} |
761 |
else |
else |
762 |
{ |
{ |
763 |
|
// added by koepi for credits greyscale |
764 |
|
check_greyscale_mode(&codec->config, frame, codec->framenum); |
765 |
|
// end of koepi's addition |
766 |
frame->quant = codec_get_vbr_quant(&codec->config, codec->config.quality); |
frame->quant = codec_get_vbr_quant(&codec->config, codec->config.quality); |
767 |
} |
} |
768 |
return ICERR_OK; |
return ICERR_OK; |
770 |
case DLG_MODE_VBR_QUANT : |
case DLG_MODE_VBR_QUANT : |
771 |
if (codec_is_in_credits(&codec->config, codec->framenum)) |
if (codec_is_in_credits(&codec->config, codec->framenum)) |
772 |
{ |
{ |
773 |
|
// added by koepi for credits greyscale |
774 |
|
check_greyscale_mode(&codec->config, frame, codec->framenum); |
775 |
|
// end of koepi's addition |
776 |
switch (codec->config.credits_mode) |
switch (codec->config.credits_mode) |
777 |
{ |
{ |
778 |
case CREDITS_MODE_RATE : |
case CREDITS_MODE_RATE : |
792 |
} |
} |
793 |
else |
else |
794 |
{ |
{ |
795 |
|
// added by koepi for credits greyscale |
796 |
|
check_greyscale_mode(&codec->config, frame, codec->framenum); |
797 |
|
// end of koepi's addition |
798 |
frame->quant = codec->config.quant; |
frame->quant = codec->config.quant; |
799 |
} |
} |
800 |
return ICERR_OK; |
return ICERR_OK; |
801 |
|
|
802 |
case DLG_MODE_2PASS_1 : |
case DLG_MODE_2PASS_1 : |
803 |
|
// added by koepi for credits greyscale |
804 |
|
check_greyscale_mode(&codec->config, frame, codec->framenum); |
805 |
|
// end of koepi's addition |
806 |
if (codec->config.credits_mode == CREDITS_MODE_QUANT) |
if (codec->config.credits_mode == CREDITS_MODE_QUANT) |
807 |
{ |
{ |
808 |
if (codec_is_in_credits(&codec->config, codec->framenum)) |
if (codec_is_in_credits(&codec->config, codec->framenum)) |
893 |
return quant; |
return quant; |
894 |
} |
} |
895 |
|
|
896 |
|
// added by koepi for credits greyscale |
897 |
|
int check_greyscale_mode(CONFIG* config, XVID_ENC_FRAME* frame, int framenum) |
898 |
|
{ |
899 |
|
if ((codec_is_in_credits(config, framenum)) && (config->mode!=DLG_MODE_CBR)) |
900 |
|
{ |
901 |
|
if (config->credits_greyscale) |
902 |
|
{ |
903 |
|
if ((frame->general && XVID_GREYSCALE)) // use only if not already in greyscale |
904 |
|
frame->general |= XVID_GREYSCALE; |
905 |
|
} else { |
906 |
|
if (!(frame->general && XVID_GREYSCALE)) // if movie is in greyscale, switch back |
907 |
|
frame->general |= XVID_GREYSCALE; |
908 |
|
} |
909 |
|
} else { |
910 |
|
if (config->greyscale) |
911 |
|
{ |
912 |
|
if ((frame->general && XVID_GREYSCALE)) // use only if not already in greyscale |
913 |
|
frame->general |= XVID_GREYSCALE; |
914 |
|
} else { |
915 |
|
if (!(frame->general && XVID_GREYSCALE)) // if credits is in greyscale, switch back |
916 |
|
frame->general |= XVID_GREYSCALE; |
917 |
|
} |
918 |
|
} |
919 |
|
return 0; |
920 |
|
} |
921 |
|
// end of koepi's addition |