23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
|
* 17.04.2002 re-enabled lumi masking for 1st pass |
27 |
|
* 15.04.2002 updated cbr support |
28 |
* 04.04.2002 separated 2-pass code to 2pass.c |
* 04.04.2002 separated 2-pass code to 2pass.c |
29 |
* interlacing support |
* interlacing support |
30 |
* hinted ME support |
* hinted ME support |
238 |
switch (codec->config.mode) |
switch (codec->config.mode) |
239 |
{ |
{ |
240 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
241 |
param.bitrate = codec->config.bitrate; |
param.rc_bitrate = codec->config.rc_bitrate; |
242 |
param.rc_buffersize = codec->config.rc_buffersize; |
param.rc_reaction_delay_factor = codec->config.rc_reaction_delay_factor; |
243 |
|
param.rc_averaging_period = codec->config.rc_averaging_period; |
244 |
|
param.rc_buffer = codec->config.rc_buffer; |
245 |
break; |
break; |
246 |
|
|
247 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
248 |
codec->config.fquant = 0; |
codec->config.fquant = 0; |
249 |
param.bitrate = 0; |
param.rc_bitrate = 0; |
250 |
break; |
break; |
251 |
|
|
252 |
case DLG_MODE_VBR_QUANT : |
case DLG_MODE_VBR_QUANT : |
253 |
codec->config.fquant = (float) codec->config.quant; |
codec->config.fquant = (float) codec->config.quant; |
254 |
param.bitrate = 0; |
param.rc_bitrate = 0; |
255 |
break; |
break; |
256 |
|
|
257 |
case DLG_MODE_2PASS_1 : |
case DLG_MODE_2PASS_1 : |
258 |
case DLG_MODE_2PASS_2_INT : |
case DLG_MODE_2PASS_2_INT : |
259 |
case DLG_MODE_2PASS_2_EXT : |
case DLG_MODE_2PASS_2_EXT : |
260 |
param.bitrate = 0; |
param.rc_bitrate = 0; |
261 |
|
codec->twopass.max_framesize = (int)((double)codec->config.twopass_max_bitrate / 8.0 / ((double)codec->fbase / (double)codec->fincr)); |
262 |
break; |
break; |
263 |
|
|
264 |
case DLG_MODE_NULL : |
case DLG_MODE_NULL : |
284 |
param.fincr = codec->fincr; |
param.fincr = codec->fincr; |
285 |
param.fbase = codec->fbase; |
param.fbase = codec->fbase; |
286 |
|
|
|
param.rc_buffersize = codec->config.rc_buffersize; |
|
|
|
|
287 |
param.min_quantizer = codec->config.min_pquant; |
param.min_quantizer = codec->config.min_pquant; |
288 |
param.max_quantizer = codec->config.max_pquant; |
param.max_quantizer = codec->config.max_pquant; |
289 |
param.max_key_interval = codec->config.max_key_interval; |
param.max_key_interval = codec->config.max_key_interval; |
368 |
if(codec->config.motion_search > 4) |
if(codec->config.motion_search > 4) |
369 |
frame.general |= XVID_INTER4V; |
frame.general |= XVID_INTER4V; |
370 |
|
|
371 |
if(((codec->config.mode == DLG_MODE_2PASS_1) ? 0 : codec->config.lum_masking) == 1) |
if (codec->config.lum_masking) |
372 |
frame.general |= XVID_LUMIMASKING; |
frame.general |= XVID_LUMIMASKING; |
373 |
|
|
374 |
if (codec->config.interlacing) |
if (codec->config.interlacing) |
483 |
{ |
{ |
484 |
frame.intra = 1; |
frame.intra = 1; |
485 |
} |
} |
486 |
else if ((codec->keyspacing < codec->config.min_key_interval && codec->framenum) && |
else if (codec->keyspacing < codec->config.min_key_interval && codec->framenum) |
|
(codec->config.mode == DLG_MODE_2PASS_1 || codec->config.mode == DLG_MODE_CBR || codec->config.mode == DLG_MODE_VBR_QUANT || |
|
|
codec->config.mode == DLG_MODE_VBR_QUAL || codec->config.mode == DLG_MODE_NULL)) |
|
487 |
{ |
{ |
488 |
DEBUG("current frame forced to p-frame"); |
DEBUG("current frame forced to p-frame"); |
489 |
frame.intra = 0; |
frame.intra = 0; |