]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/takdec: fix decoding of some sample rates with multichannel coder
authorPaul B Mahol <onemda@gmail.com>
Sat, 16 Apr 2016 22:13:55 +0000 (00:13 +0200)
committerPaul B Mahol <onemda@gmail.com>
Sun, 17 Apr 2016 09:30:56 +0000 (11:30 +0200)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/takdec.c

index d057e0a1cbab44978c3ac5eccf3836ad2b54452f..3b9a4b845ea3bc99745cb83cc809ada6a59adcc2 100644 (file)
@@ -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;
 }