421 |
xvid_plugin_single_t single; |
xvid_plugin_single_t single; |
422 |
xvid_plugin_2pass1_t pass1; |
xvid_plugin_2pass1_t pass1; |
423 |
xvid_plugin_2pass2_t pass2; |
xvid_plugin_2pass2_t pass2; |
424 |
|
xvid_gbl_info_t info; |
425 |
int i; |
int i; |
426 |
HANDLE hFile; |
HANDLE hFile; |
427 |
const quality_t* quality_preset = (codec->config.quality==quality_table_num) ? |
const quality_t* quality_preset = (codec->config.quality==quality_table_num) ? |
443 |
init.debug = codec->config.debug; |
init.debug = codec->config.debug; |
444 |
codec->xvid_global_func(0, XVID_GBL_INIT, &init, NULL); |
codec->xvid_global_func(0, XVID_GBL_INIT, &init, NULL); |
445 |
|
|
446 |
|
memset(&info, 0, sizeof(info)); |
447 |
|
info.version = XVID_VERSION; |
448 |
|
codec->xvid_global_func(0, XVID_GBL_INFO, &info, NULL); |
449 |
|
|
450 |
memset(&create, 0, sizeof(create)); |
memset(&create, 0, sizeof(create)); |
451 |
create.version = XVID_VERSION; |
create.version = XVID_VERSION; |
452 |
|
|
575 |
if ((profiles[codec->config.profile].flags & PROFILE_BVOP) && codec->config.use_bvop) { |
if ((profiles[codec->config.profile].flags & PROFILE_BVOP) && codec->config.use_bvop) { |
576 |
|
|
577 |
/* dxn: prevent bframes usage if interlacing is selected */ |
/* dxn: prevent bframes usage if interlacing is selected */ |
578 |
if (!((profiles[codec->config.profile].flags & PROFILE_DXN) && codec->config.interlacing)) { |
if (!((profiles[codec->config.profile].flags & PROFILE_EXTRA) && codec->config.interlacing)) { |
579 |
create.max_bframes = codec->config.max_bframes; |
create.max_bframes = codec->config.max_bframes; |
580 |
create.bquant_ratio = codec->config.bquant_ratio; |
create.bquant_ratio = codec->config.bquant_ratio; |
581 |
create.bquant_offset = codec->config.bquant_offset; |
create.bquant_offset = codec->config.bquant_offset; |
585 |
|
|
586 |
create.global |= XVID_GLOBAL_CLOSED_GOP; |
create.global |= XVID_GLOBAL_CLOSED_GOP; |
587 |
|
|
588 |
/* dxn: restrict max bframes and enable packed bframes */ |
/* restrict max bframes */ |
589 |
if ((profiles[codec->config.profile].flags & PROFILE_DXN)) { |
if ((create.max_bframes > profiles[codec->config.profile].xvid_max_bframes) && (profiles[codec->config.profile].xvid_max_bframes >= 0)) |
590 |
|
create.max_bframes = profiles[codec->config.profile].xvid_max_bframes; |
|
if (create.max_bframes > profiles[codec->config.profile].dxn_max_bframes) |
|
|
create.max_bframes = profiles[codec->config.profile].dxn_max_bframes; |
|
591 |
|
|
592 |
|
/* DXN: enable packed bframes */ |
593 |
|
if ((profiles[codec->config.profile].flags & PROFILE_PACKED)) { |
594 |
create.global |= XVID_GLOBAL_PACKED; |
create.global |= XVID_GLOBAL_PACKED; |
595 |
} |
} |
596 |
} |
} |
597 |
} |
} |
598 |
|
|
599 |
/* dxn: always write divx5 userdata */ |
/* dxn: always write divx5 userdata */ |
600 |
if ((profiles[codec->config.profile].flags & PROFILE_DXN)) |
if ((profiles[codec->config.profile].flags & PROFILE_EXTRA)) |
601 |
create.global |= XVID_GLOBAL_DIVX5_USERDATA; |
create.global |= XVID_GLOBAL_DIVX5_USERDATA; |
602 |
|
|
603 |
create.frame_drop_ratio = quality_preset->frame_drop_ratio; |
create.frame_drop_ratio = quality_preset->frame_drop_ratio; |
604 |
|
|
605 |
|
/* Encoder threads */ |
606 |
|
if (codec->config.num_threads == 0) |
607 |
|
create.num_threads = info.num_threads; /* Autodetect */ |
608 |
|
else if (codec->config.num_threads == 1) |
609 |
|
create.num_threads = -1; /* Single-threaded, disable SMP */ |
610 |
|
else |
611 |
create.num_threads = codec->config.num_threads; |
create.num_threads = codec->config.num_threads; |
612 |
|
|
613 |
|
|
614 |
switch(codec->xvid_encore_func(0, XVID_ENC_CREATE, &create, NULL)) |
switch(codec->xvid_encore_func(0, XVID_ENC_CREATE, &create, NULL)) |
615 |
{ |
{ |
616 |
case XVID_ERR_FAIL : |
case XVID_ERR_FAIL : |
642 |
|
|
643 |
LRESULT compress_end(CODEC * codec) |
LRESULT compress_end(CODEC * codec) |
644 |
{ |
{ |
645 |
|
if (codec==NULL) |
646 |
|
return ICERR_OK; |
647 |
|
|
648 |
if (codec->m_hdll != NULL) { |
if (codec->m_hdll != NULL) { |
649 |
if (codec->ehandle != NULL) { |
if (codec->ehandle != NULL) { |
650 |
codec->xvid_encore_func(codec->ehandle, XVID_ENC_DESTROY, NULL, NULL); |
codec->xvid_encore_func(codec->ehandle, XVID_ENC_DESTROY, NULL, NULL); |
736 |
frame.vol_flags |= XVID_VOL_INTERLACING; |
frame.vol_flags |= XVID_VOL_INTERLACING; |
737 |
|
|
738 |
/* dxn: force 1:1 picture aspect ration */ |
/* dxn: force 1:1 picture aspect ration */ |
739 |
if ((profiles[codec->config.profile].flags & PROFILE_DXN)) { |
if ((profiles[codec->config.profile].flags & PROFILE_EXTRA)) { |
740 |
frame.par = XVID_PAR_11_VGA; |
frame.par = XVID_PAR_11_VGA; |
741 |
} else if (codec->config.ar_mode == 0) { /* PAR */ |
} else if (codec->config.ar_mode == 0) { /* PAR */ |
742 |
if (codec->config.display_aspect_ratio != 5) { |
if (codec->config.display_aspect_ratio != 5) { |