diff options
author | Henry Mason <talus25@speakeasy.net> | 2002-09-02 09:51:52 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-09-02 09:51:52 +0000 |
commit | ecfd40b390732056dc9cb3b79b1ab63c22c7700a (patch) | |
tree | 8037d7c90f02b92b3d80456b0478604a55d4da98 | |
parent | ab6c65f69307bff2a2d073a94b839619ab64386b (diff) | |
download | ffmpeg-ecfd40b390732056dc9cb3b79b1ab63c22c7700a.tar.gz |
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
-rw-r--r-- | libavcodec/mpeg12.c | 9 | ||||
-rw-r--r-- | tests/ffmpeg.regression.ref | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index ba52a36725..97c2e98ccb 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -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 */ diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index 1389a82709..72dbb30f06 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -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 |