Mercurial > libavcodec.hg
changeset 639:f449913e8419 libavcodec
new vbv calculation patch by (Henry Mason <talus25 at speakeasy dot net>) with slight modification by me
author | michaelni |
---|---|
date | Mon, 02 Sep 2002 09:51:52 +0000 |
parents | 0012f75c92bb |
children | d2f47c6c6b41 |
files | mpeg12.c |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mpeg12.c Mon Sep 02 08:48:12 2002 +0000 +++ b/mpeg12.c Mon Sep 02 09:51:52 2002 +0000 @@ -142,9 +142,12 @@ 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 */