Commit ecfd40b3 authored by Henry Mason's avatar Henry Mason Committed by Michael Niedermayer

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

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
parent ab6c65f6
......@@ -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 */
......
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment