[FFmpeg-cvslog] avcodec/takdec: fix decoding of some sample rates with multichannel coder

Paul B Mahol git at videolan.org
Sun Apr 17 11:32:35 CEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Apr 17 00:13:55 2016 +0200| [7a0aee16881df0154ffb8f2a496a8b0705e8bf69] | committer: Paul B Mahol

avcodec/takdec: fix decoding of some sample rates with multichannel coder

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a0aee16881df0154ffb8f2a496a8b0705e8bf69
---

 libavcodec/takdec.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index d057e0a..3b9a4b8 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -163,8 +163,17 @@ static int set_bps_params(AVCodecContext *avctx)
 static void set_sample_rate_params(AVCodecContext *avctx)
 {
     TAKDecContext *s  = avctx->priv_data;
-    int shift         = 3 - (avctx->sample_rate / 11025);
-    shift             = FFMAX(0, shift);
+    int shift;
+
+    if (avctx->sample_rate < 11025) {
+        shift = 3;
+    } else if (avctx->sample_rate < 22050) {
+        shift = 2;
+    } else if (avctx->sample_rate < 44100) {
+        shift = 1;
+    } else {
+        shift = 0;
+    }
     s->uval           = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << shift;
     s->subframe_scale = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << 1;
 }



More information about the ffmpeg-cvslog mailing list