new vbv calculation patch by (Henry Mason <talus25 at speakeasy dot net>) with slight modification by me

Originally committed as revision 899 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Henry Mason 2002-09-02 09:51:52 +00:00 committed by Michael Niedermayer
parent ab6c65f693
commit ecfd40b390
2 changed files with 7 additions and 4 deletions

View File

@ -142,9 +142,12 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
v = 0x3ffff;
put_bits(&s->pb, 18, v);
put_bits(&s->pb, 1, 1); /* marker */
/* vbv buffer size: slightly greater than an I frame. We add
some margin just in case */
vbv_buffer_size = (3 * s->I_frame_bits) / (2 * 8);
if(s->avctx->rc_buffer_size)
vbv_buffer_size = s->avctx->rc_buffer_size;
else
/* VBV calculation: Scaled so that a VCD has the proper VBV size of 40 kilobytes */
vbv_buffer_size = (( 20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024;
put_bits(&s->pb, 10, (vbv_buffer_size + 16383) / 16384);
put_bits(&s->pb, 1, 1); /* constrained parameter flag */
put_bits(&s->pb, 1, 0); /* no custom intra matrix */

View File

@ -1,5 +1,5 @@
ffmpeg regression test
6c8b6ee8dd9c34f58908fe501d7dbe1e *./data/a-mpeg1.mpg
67be2deabb210740966ca5fda9a64bca *./data/a-mpeg1.mpg
59a66b108e8bbd3867c4ee27f4bbe2ca *./data/out.yuv
297793ed0fd5793182a92e63ffd764af *./data/a-msmpeg4.avi
951aa2df4ef4c1eeee3ccc8904de8e48 *./data/out.yuv