243 |
|
|
244 |
LRESULT compress_frames_info(CODEC * codec, ICCOMPRESSFRAMES * icf) |
LRESULT compress_frames_info(CODEC * codec, ICCOMPRESSFRAMES * icf) |
245 |
{ |
{ |
246 |
//DPRINTF("%i %i", icf->lStartFrame, icf->lFrameCount); |
#if 0 |
247 |
|
DPRINTF("%i %i", icf->lStartFrame, icf->lFrameCount); |
248 |
|
#endif |
249 |
codec->fincr = icf->dwScale; |
codec->fincr = icf->dwScale; |
250 |
codec->fbase = icf->dwRate; |
codec->fbase = icf->dwRate; |
251 |
return ICERR_OK; |
return ICERR_OK; |
312 |
memset(&init, 0, sizeof(init)); |
memset(&init, 0, sizeof(init)); |
313 |
init.version = XVID_VERSION; |
init.version = XVID_VERSION; |
314 |
init.cpu_flags = codec->config.cpu; |
init.cpu_flags = codec->config.cpu; |
315 |
|
init.debug = codec->config.debug; |
316 |
xvid_global(0, XVID_GBL_INIT, &init, NULL); |
xvid_global(0, XVID_GBL_INIT, &init, NULL); |
317 |
|
|
318 |
memset(&create, 0, sizeof(create)); |
memset(&create, 0, sizeof(create)); |
319 |
create.version = XVID_VERSION; |
create.version = XVID_VERSION; |
320 |
|
|
321 |
// zones |
/* zones */ |
322 |
create.zones = malloc(sizeof(xvid_enc_zone_t) * codec->config.num_zones); |
create.zones = malloc(sizeof(xvid_enc_zone_t) * codec->config.num_zones); |
323 |
create.num_zones = codec->config.num_zones; |
create.num_zones = codec->config.num_zones; |
324 |
for (i=0; i < create.num_zones; i++) { |
for (i=0; i < create.num_zones; i++) { |
325 |
create.zones[i].frame = codec->config.zones[i].frame; |
create.zones[i].frame = codec->config.zones[i].frame; |
326 |
if (create.zones[i].mode = RC_ZONE_QUANT) { |
if (codec->config.zones[i].mode == RC_ZONE_QUANT) { |
327 |
create.zones[i].mode = XVID_ZONE_QUANT; |
create.zones[i].mode = XVID_ZONE_QUANT; |
328 |
create.zones[i].increment = codec->config.zones[i].quant; |
create.zones[i].increment = codec->config.zones[i].quant; |
329 |
}else{ |
}else{ |
333 |
create.zones[i].base = 100; |
create.zones[i].base = 100; |
334 |
} |
} |
335 |
|
|
336 |
// plugins |
/* plugins */ |
337 |
create.plugins = plugins; |
create.plugins = plugins; |
338 |
switch (codec->config.mode) |
switch (codec->config.mode) |
339 |
{ |
{ |
340 |
case RC_MODE_1PASS : |
case RC_MODE_1PASS : |
341 |
memset(&single, 0, sizeof(single)); |
memset(&single, 0, sizeof(single)); |
342 |
single.version = XVID_VERSION; |
single.version = XVID_VERSION; |
343 |
single.bitrate = codec->config.bitrate; |
single.bitrate = codec->config.bitrate * CONFIG_KBPS; |
344 |
single.reaction_delay_factor = codec->config.rc_reaction_delay_factor; |
single.reaction_delay_factor = codec->config.rc_reaction_delay_factor; |
345 |
single.averaging_period = codec->config.rc_averaging_period; |
single.averaging_period = codec->config.rc_averaging_period; |
346 |
single.buffer = codec->config.rc_buffer; |
single.buffer = codec->config.rc_buffer; |
347 |
plugins[create.num_plugins].func = xvid_plugin_single; |
plugins[create.num_plugins].func = xvid_plugin_single; |
348 |
plugins[create.num_plugins].param = &single; |
plugins[create.num_plugins].param = &single; |
349 |
create.num_plugins++; |
create.num_plugins++; |
350 |
|
break; |
351 |
|
|
352 |
case RC_MODE_2PASS1 : |
case RC_MODE_2PASS1 : |
353 |
memset(&pass1, 0, sizeof(pass1)); |
memset(&pass1, 0, sizeof(pass1)); |
354 |
pass1.version = XVID_VERSION; |
pass1.version = XVID_VERSION; |
355 |
|
pass1.filename = codec->config.stats; |
356 |
|
|
357 |
plugins[create.num_plugins].func = xvid_plugin_2pass1; |
plugins[create.num_plugins].func = xvid_plugin_2pass1; |
358 |
plugins[create.num_plugins].param = &pass1; |
plugins[create.num_plugins].param = &pass1; |
362 |
case RC_MODE_2PASS2 : |
case RC_MODE_2PASS2 : |
363 |
memset(&pass2, 0, sizeof(pass2)); |
memset(&pass2, 0, sizeof(pass2)); |
364 |
pass2.version = XVID_VERSION; |
pass2.version = XVID_VERSION; |
365 |
pass2.bitrate = codec->config.bitrate; |
pass2.bitrate = codec->config.bitrate * CONFIG_KBPS; |
366 |
pass2.filename = codec->config.stats; |
pass2.filename = codec->config.stats; |
367 |
|
|
368 |
|
pass2.keyframe_boost = codec->config.keyframe_boost; /* keyframe boost percentage: [0..100...]; */ |
369 |
|
pass2.payback_method = codec->config.bitrate_payback_method; |
370 |
|
pass2.bitrate_payback_delay = codec->config.bitrate_payback_delay; |
371 |
|
pass2.curve_compression_high = codec->config.curve_compression_high; |
372 |
|
pass2.curve_compression_low = codec->config.curve_compression_low; |
373 |
|
pass2.max_overflow_improvement = codec->config.twopass_max_overflow_improvement; |
374 |
|
pass2.max_overflow_degradation = codec->config.twopass_max_overflow_degradation; |
375 |
|
pass2.kftreshold = codec->config.kftreshold; |
376 |
|
pass2.kfreduction = codec->config.kfreduction; |
377 |
|
pass2.min_key_interval = codec->config.min_key_interval; |
378 |
|
pass2.container_frame_overhead = 24; /* AVI */ |
379 |
|
|
380 |
plugins[create.num_plugins].func = xvid_plugin_2pass2; |
plugins[create.num_plugins].func = xvid_plugin_2pass2; |
381 |
plugins[create.num_plugins].param = &pass2; |
plugins[create.num_plugins].param = &pass2; |
382 |
create.num_plugins++; |
create.num_plugins++; |
539 |
frame.vop_flags |= XVID_VOP_HALFPEL; |
frame.vop_flags |= XVID_VOP_HALFPEL; |
540 |
frame.vop_flags |= XVID_VOP_HQACPRED; |
frame.vop_flags |= XVID_VOP_HQACPRED; |
541 |
|
|
542 |
if (codec->config.debug) |
if (codec->config.vop_debug) |
543 |
frame.vop_flags |= XVID_VOP_DEBUG; |
frame.vop_flags |= XVID_VOP_DEBUG; |
544 |
|
|
545 |
if (codec->config.trellis_quant) { |
if (codec->config.trellis_quant) { |
727 |
|
|
728 |
if (get_colorspace(inhdr) != XVID_CSP_NULL) { |
if (get_colorspace(inhdr) != XVID_CSP_NULL) { |
729 |
memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER)); |
memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER)); |
730 |
// XXX: should we set outhdr->biSize ?? |
/* XXX: should we set outhdr->biSize ?? */ |
731 |
return ICERR_OK; |
return ICERR_OK; |
732 |
} |
} |
733 |
/* --- yv12 --- */ |
/* --- yv12 --- */ |