346 |
return 0; |
return 0; |
347 |
} |
} |
348 |
|
|
349 |
|
/* constant-quant zones for fixed quant encoding */ |
350 |
static void |
static void |
351 |
prepare_cquant_zones(CONFIG * config) { |
prepare_cquant_zones(CONFIG * config) { |
352 |
|
|
378 |
} |
} |
379 |
} |
} |
380 |
|
|
381 |
|
/* full first pass zones */ |
382 |
|
static void |
383 |
|
prepare_full1pass_zones(CONFIG * config) { |
384 |
|
|
385 |
|
int i = 0; |
386 |
|
if (config->num_zones == 0 || config->zones[0].frame != 0) { |
387 |
|
/* first zone does not start at frame 0 or doesn't exist */ |
388 |
|
|
389 |
|
if (config->num_zones >= MAX_ZONES) config->num_zones--; /* we scrifice last zone */ |
390 |
|
|
391 |
|
config->zones[config->num_zones].frame = 0; |
392 |
|
config->zones[config->num_zones].mode = RC_ZONE_QUANT; |
393 |
|
config->zones[config->num_zones].weight = 100; |
394 |
|
config->zones[config->num_zones].quant = 200; |
395 |
|
config->zones[config->num_zones].type = XVID_TYPE_AUTO; |
396 |
|
config->zones[config->num_zones].greyscale = 0; |
397 |
|
config->zones[config->num_zones].chroma_opt = 0; |
398 |
|
config->zones[config->num_zones].bvop_threshold = 0; |
399 |
|
config->num_zones++; |
400 |
|
|
401 |
|
sort_zones(config->zones, config->num_zones, &i); |
402 |
|
} |
403 |
|
|
404 |
|
/* step 2: let's change all weight zones into quant zones */ |
405 |
|
|
406 |
|
for(i = 0; i < config->num_zones; i++) |
407 |
|
if (config->zones[i].mode == RC_ZONE_WEIGHT) { |
408 |
|
config->zones[i].mode = RC_ZONE_QUANT; |
409 |
|
config->zones[i].quant = 200; |
410 |
|
} |
411 |
|
} |
412 |
|
|
413 |
|
|
414 |
LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput) |
LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput) |
415 |
{ |
{ |
463 |
memset(&pass1, 0, sizeof(pass1)); |
memset(&pass1, 0, sizeof(pass1)); |
464 |
pass1.version = XVID_VERSION; |
pass1.version = XVID_VERSION; |
465 |
pass1.filename = codec->config.stats; |
pass1.filename = codec->config.stats; |
466 |
|
if (codec->config.full1pass) |
467 |
|
prepare_full1pass_zones(&tmpCfg); |
468 |
plugins[create.num_plugins].func = xvid_plugin_2pass1_func; |
plugins[create.num_plugins].func = xvid_plugin_2pass1_func; |
469 |
plugins[create.num_plugins].param = &pass1; |
plugins[create.num_plugins].param = &pass1; |
470 |
create.num_plugins++; |
create.num_plugins++; |