[libav-commits] mpegenc: simplify muxrate calculation

Janne Grunau git at libav.org
Mon Jan 2 00:27:55 CET 2012


Module: libav
Branch: master
Commit: af9240cd3c6fb257ac2d0843334145f022ef5959

Author:    Janne Grunau <janne-libav at jannau.net>
Committer: Janne Grunau <janne-libav at jannau.net>
Date:      Sun Jan  1 23:32:15 2012 +0100

mpegenc: simplify muxrate calculation

The fate-h264-bsf-mp4toannexb failures were caused by an integer
overflow of the unneeded multiplication.

Inspired by patch by: Michael Niedermayer <michaelni at gmx.at>

---

 libavformat/mpegenc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index d537af6..b2ca35a 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -429,7 +429,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
     if (!s->mux_rate) {
         /* we increase slightly the bitrate to take into account the
            headers. XXX: compute it exactly */
-        bitrate += bitrate*5/100;
+        bitrate += bitrate / 20;
         bitrate += 10000;
         s->mux_rate = (bitrate + (8 * 50) - 1) / (8 * 50);
     }



More information about the libav-commits mailing list