]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpc7.c
mips: intreadwrite: fix inline asm for gcc 4.8
[ffmpeg] / libavcodec / mpc7.c
index 2e8271a120679c871be0ebbba7eb8ce2875809c5..5d87417b69ba6995401466d1acf2e306faa30cd8 100644 (file)
@@ -193,7 +193,7 @@ static int get_scale_idx(GetBitContext *gb, int ref)
     int t = get_vlc2(gb, dscf_vlc.table, MPC7_DSCF_BITS, 1) - 7;
     if (t == 8)
         return get_bits(gb, 6);
-    return ref + t;
+    return av_clip_uintp2(ref + t, 7);
 }
 
 static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
@@ -247,7 +247,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
             int t = 4;
             if(i) t = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5;
             if(t == 4) bands[i].res[ch] = get_bits(&gb, 4);
-            else bands[i].res[ch] = bands[i-1].res[ch] + t;
+            else bands[i].res[ch] = av_clip(bands[i-1].res[ch] + t, 0, 17);
         }
 
         if(bands[i].res[0] || bands[i].res[1]){
@@ -337,7 +337,7 @@ AVCodec ff_mpc7_decoder = {
     .init           = mpc7_decode_init,
     .close          = mpc7_decode_close,
     .decode         = mpc7_decode_frame,
-    .flush = mpc7_decode_flush,
+    .flush          = mpc7_decode_flush,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Musepack SV7"),
 };