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