[FFmpeg-cvslog] mp3enc: simplify mp3_write_xing()
Michael Niedermayer
git at videolan.org
Mon Nov 14 21:31:32 CET 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Nov 14 20:45:02 2011 +0100| [1fea432b7a6957b800006fd7c4bd9b4076b0cc06] | committer: Michael Niedermayer
mp3enc: simplify mp3_write_xing()
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1fea432b7a6957b800006fd7c4bd9b4076b0cc06
---
libavformat/mp3enc.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index eab483f..3f2f02b 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -185,13 +185,11 @@ static int mp3_write_xing(AVFormatContext *s)
header |= (srate_idx << 2) << 8;
header |= channels << 6;
- for (;;) {
+ for (;; bitrate_idx++) {
if (15 == bitrate_idx)
return -1;
- mask = (bitrate_idx << 4) << 8;
- header |= mask;
- avpriv_mpegaudio_decode_header(&c, header);
+ avpriv_mpegaudio_decode_header(&c, header | (bitrate_idx << (4+8)));
xing_offset=xing_offtbl[c.lsf == 1][c.nb_channels == 1];
needed = 4 // header
+ xing_offset
@@ -203,9 +201,6 @@ static int mp3_write_xing(AVFormatContext *s)
if (needed <= c.frame_size)
break;
-
- header &= ~mask;
- ++bitrate_idx;
}
avio_wb32(s->pb, header);
More information about the ffmpeg-cvslog
mailing list