--- trunk/vfw/src/codec.c 2002/04/15 08:03:50 121 +++ trunk/vfw/src/codec.c 2002/07/21 03:49:47 324 @@ -23,6 +23,10 @@ * * History: * + * 12.07.2002 num_threads + * 23.06.2002 XVID_CPU_CHKONLY; loading speed up + * 25.04.2002 ICDECOMPRESS_PREROLL + * 17.04.2002 re-enabled lumi masking for 1st pass * 15.04.2002 updated cbr support * 04.04.2002 separated 2-pass code to 2pass.c * interlacing support @@ -216,7 +220,11 @@ LRESULT compress_get_size(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput) { - return lpbiOutput->bmiHeader.biWidth * lpbiOutput->bmiHeader.biHeight * 3; + return +#ifdef BFRAMES + 2 * +#endif + lpbiOutput->bmiHeader.biWidth * lpbiOutput->bmiHeader.biHeight * 3; } @@ -287,6 +295,20 @@ param.max_quantizer = codec->config.max_pquant; param.max_key_interval = codec->config.max_key_interval; +#ifdef _SMP + param.num_threads = codec->config.num_threads; +#endif + +#ifdef BFRAMES + param.global = 0; + if (codec->config.packed) param.global |= XVID_GLOBAL_PACKED; + if (codec->config.dx50bvop) param.global |= XVID_GLOBAL_DX50BVOP; + if (codec->config.debug) param.global |= XVID_GLOBAL_DEBUG; + param.max_bframes = codec->config.max_bframes; + param.bquant_ratio = codec->config.bquant_ratio; + param.frame_drop_ratio = codec->config.frame_drop_ratio; +#endif + switch(xvid_encore(0, XVID_ENC_CREATE, ¶m, NULL)) { case XVID_ERR_FAIL : @@ -364,14 +386,20 @@ frame.general |= XVID_HALFPEL; - if(codec->config.motion_search > 4) + if (codec->config.motion_search > 4) frame.general |= XVID_INTER4V; - if(((codec->config.mode == DLG_MODE_2PASS_1) ? 0 : codec->config.lum_masking) == 1) + if (codec->config.lum_masking) frame.general |= XVID_LUMIMASKING; if (codec->config.interlacing) frame.general |= XVID_INTERLACING; +// fix 1pass modes/hinted MV by koepi + 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)) + { + codec->config.hinted_me = 0; + } +// end of ugly hack if (codec->config.hinted_me && codec->config.mode == DLG_MODE_2PASS_1) { @@ -488,6 +516,11 @@ frame.intra = 0; } +#ifdef BFRAMES + frame.bquant = 0; +#endif + +// OutputDebugString(" "); switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats)) { case XVID_ERR_FAIL : @@ -525,7 +558,7 @@ if (codec->twopass.hints == INVALID_HANDLE_VALUE) { codec->twopass.hints = CreateFile(codec->config.hintfile, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0); - if (codec->twopass.hints == INVALID_HANDLE_VALUE) + if (codec->twopass.hints == INVALID_HANDLE_VALUE) { DEBUGERR("couldn't create hints file"); return ICERR_ERROR; @@ -666,7 +699,7 @@ frame.image = icd->lpOutput; frame.stride = icd->lpbiOutput->biWidth; - if (~((icd->dwFlags & ICDECOMPRESS_HURRYUP) | (icd->dwFlags & ICDECOMPRESS_UPDATE))) + if (~((icd->dwFlags & ICDECOMPRESS_HURRYUP) | (icd->dwFlags & ICDECOMPRESS_UPDATE) | (icd->dwFlags & ICDECOMPRESS_PREROLL))) { if ((frame.colorspace = get_colorspace(icd->lpbiOutput)) == XVID_CSP_NULL) {