26 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 |
* |
* |
29 |
* $Id: encoder.c,v 1.95.2.16 2003-03-27 17:09:48 edgomez Exp $ |
* $Id: encoder.c,v 1.95.2.18 2003-04-02 20:43:56 edgomez Exp $ |
30 |
* |
* |
31 |
****************************************************************************/ |
****************************************************************************/ |
32 |
|
|
202 |
pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0); |
pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0); |
203 |
|
|
204 |
/* max keyframe interval */ |
/* max keyframe interval */ |
205 |
pEnc->mbParam.iMaxKeyInterval = create->max_key_interval <=0 ? 250 : create->max_key_interval; |
pEnc->mbParam.iMaxKeyInterval = create->max_key_interval <= 0 ? |
206 |
/*XXX: replace 250 hard code with "10seconds * framerate" */ |
10 * pEnc->mbParam.fbase / pEnc->mbParam.fincr : create->max_key_interval; |
207 |
|
|
208 |
/* Bitrate allocator defaults |
/* Bitrate allocator defaults |
209 |
|
|
1353 |
} |
} |
1354 |
emms(); |
emms(); |
1355 |
|
|
1356 |
|
/* XXX: Remove the two #if 0 blocks when we are sure we must always pad the stream */ |
1357 |
|
#if 0 |
1358 |
/* 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 */ |
1359 |
if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) |
if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) |
1360 |
|
#endif |
1361 |
BitstreamPadAlways(bs); |
BitstreamPadAlways(bs); |
1362 |
|
#if 0 |
1363 |
else |
else |
1364 |
BitstreamPad(bs); |
BitstreamPad(bs); |
1365 |
|
#endif |
1366 |
pEnc->current->length = (BitstreamPos(bs) - bits) / 8; |
pEnc->current->length = (BitstreamPos(bs) - bits) / 8; |
1367 |
|
|
1368 |
pEnc->fMvPrevSigma = -1; |
pEnc->fMvPrevSigma = -1; |
1759 |
} |
} |
1760 |
*/ |
*/ |
1761 |
|
|
1762 |
|
/* XXX: Remove the two #if 0 blocks when we are sure we must always pad the stream */ |
1763 |
|
#if 0 |
1764 |
/* 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 */ |
1765 |
if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) |
if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) |
1766 |
|
#endif |
1767 |
BitstreamPadAlways(bs); |
BitstreamPadAlways(bs); |
1768 |
|
#if 0 |
1769 |
else |
else |
1770 |
BitstreamPad(bs); |
BitstreamPad(bs); |
1771 |
|
#endif |
1772 |
|
|
1773 |
pEnc->current->length = (BitstreamPos(bs) - bits) / 8; |
pEnc->current->length = (BitstreamPos(bs) - bits) / 8; |
1774 |
|
|
1900 |
|
|
1901 |
/* TODO: dynamic fcode/bcode ??? */ |
/* TODO: dynamic fcode/bcode ??? */ |
1902 |
|
|
1903 |
BitstreamPad(bs); |
BitstreamPadAlways(bs); |
1904 |
frame->length = (BitstreamPos(bs) - bits) / 8; |
frame->length = (BitstreamPos(bs) - bits) / 8; |
1905 |
|
|
1906 |
#ifdef BFRAMES_DEC_DEBUG |
#ifdef BFRAMES_DEC_DEBUG |