151 |
if (pEnc->mbParam.fincr>0) |
if (pEnc->mbParam.fincr>0) |
152 |
simplify_time(&pEnc->mbParam.fincr, &pEnc->mbParam.fbase); |
simplify_time(&pEnc->mbParam.fincr, &pEnc->mbParam.fbase); |
153 |
|
|
154 |
/* plugin */ |
/* plugins */ |
155 |
|
if(create->num_plugins > 0) { |
156 |
pEnc->num_plugins = create->num_plugins; |
pEnc->num_plugins = create->num_plugins; |
157 |
pEnc->plugins = xvid_malloc(sizeof(xvid_enc_plugin_t) * pEnc->num_plugins, CACHE_LINE); |
pEnc->plugins = xvid_malloc(sizeof(xvid_enc_plugin_t) * pEnc->num_plugins, CACHE_LINE); |
158 |
if (pEnc->plugins == NULL) |
if (pEnc->plugins == NULL) |
159 |
goto xvid_err_memory0; |
goto xvid_err_memory0; |
160 |
|
} else { |
161 |
|
pEnc->num_plugins = 0; |
162 |
|
pEnc->plugins = NULL; |
163 |
|
} |
164 |
|
|
165 |
for (n=0; n<pEnc->num_plugins;n++) { |
for (n=0; n<pEnc->num_plugins;n++) { |
166 |
xvid_plg_create_t pcreate; |
xvid_plg_create_t pcreate; |
207 |
pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0); |
pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0); |
208 |
|
|
209 |
/* max keyframe interval */ |
/* max keyframe interval */ |
210 |
pEnc->mbParam.iMaxKeyInterval = create->max_key_interval <=0 ? 250 : create->max_key_interval; |
pEnc->mbParam.iMaxKeyInterval = create->max_key_interval <= 0 ? |
211 |
/*XXX: replace 250 hard code with "10seconds * framerate" */ |
10 * pEnc->mbParam.fbase / pEnc->mbParam.fincr : create->max_key_interval; |
212 |
|
|
213 |
/* Bitrate allocator defaults |
/* Bitrate allocator defaults |
214 |
|
|
582 |
pEnc->mbParam.edged_height); |
pEnc->mbParam.edged_height); |
583 |
image_destroy(&pEnc->f_refhv, pEnc->mbParam.edged_width, |
image_destroy(&pEnc->f_refhv, pEnc->mbParam.edged_width, |
584 |
pEnc->mbParam.edged_height); |
pEnc->mbParam.edged_height); |
585 |
|
image_destroy(&pEnc->vGMC, pEnc->mbParam.edged_width, |
586 |
|
pEnc->mbParam.edged_height); |
587 |
|
|
588 |
if ((pEnc->mbParam.plugin_flags & XVID_REQORIGINAL)) { |
if ((pEnc->mbParam.plugin_flags & XVID_REQORIGINAL)) { |
589 |
image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width, |
image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width, |
605 |
} |
} |
606 |
|
|
607 |
|
|
608 |
if (pEnc->num_plugins>0) |
if (pEnc->num_plugins>0) { |
|
{ |
|
609 |
xvid_plg_destroy_t pdestroy; |
xvid_plg_destroy_t pdestroy; |
610 |
memset(&pdestroy, 0, sizeof(xvid_plg_destroy_t)); |
memset(&pdestroy, 0, sizeof(xvid_plg_destroy_t)); |
611 |
|
|
1359 |
} |
} |
1360 |
emms(); |
emms(); |
1361 |
|
|
1362 |
|
/* XXX: Remove the two #if 0 blocks when we are sure we must always pad the stream */ |
1363 |
|
#if 0 |
1364 |
/* for divx5 compatibility, we must always pad between the packed p and b frames */ |
/* for divx5 compatibility, we must always pad between the packed p and b frames */ |
1365 |
if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) |
if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) |
1366 |
|
#endif |
1367 |
BitstreamPadAlways(bs); |
BitstreamPadAlways(bs); |
1368 |
|
#if 0 |
1369 |
else |
else |
1370 |
BitstreamPad(bs); |
BitstreamPad(bs); |
1371 |
|
#endif |
1372 |
pEnc->current->length = (BitstreamPos(bs) - bits) / 8; |
pEnc->current->length = (BitstreamPos(bs) - bits) / 8; |
1373 |
|
|
1374 |
pEnc->fMvPrevSigma = -1; |
pEnc->fMvPrevSigma = -1; |
1765 |
} |
} |
1766 |
*/ |
*/ |
1767 |
|
|
1768 |
|
/* XXX: Remove the two #if 0 blocks when we are sure we must always pad the stream */ |
1769 |
|
#if 0 |
1770 |
/* for divx5 compatibility, we must always pad between the packed p and b frames */ |
/* for divx5 compatibility, we must always pad between the packed p and b frames */ |
1771 |
if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) |
if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) |
1772 |
|
#endif |
1773 |
BitstreamPadAlways(bs); |
BitstreamPadAlways(bs); |
1774 |
|
#if 0 |
1775 |
else |
else |
1776 |
BitstreamPad(bs); |
BitstreamPad(bs); |
1777 |
|
#endif |
1778 |
|
|
1779 |
pEnc->current->length = (BitstreamPos(bs) - bits) / 8; |
pEnc->current->length = (BitstreamPos(bs) - bits) / 8; |
1780 |
|
|
1906 |
|
|
1907 |
/* TODO: dynamic fcode/bcode ??? */ |
/* TODO: dynamic fcode/bcode ??? */ |
1908 |
|
|
1909 |
BitstreamPad(bs); |
BitstreamPadAlways(bs); |
1910 |
frame->length = (BitstreamPos(bs) - bits) / 8; |
frame->length = (BitstreamPos(bs) - bits) / 8; |
1911 |
|
|
1912 |
#ifdef BFRAMES_DEC_DEBUG |
#ifdef BFRAMES_DEC_DEBUG |