]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/wmalosslessdec.c
alac: limit the rice param before passing to decode_scalar()
[ffmpeg] / libavcodec / wmalosslessdec.c
index ff6308343e73ffdcc6d6ec117066e59738235bb1..cb7f66715bcc7abbe7df90fc1d6f89c6c8c17cd4 100644 (file)
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/attributes.h"
 #include "avcodec.h"
 #include "internal.h"
 #include "get_bits.h"
@@ -655,6 +656,8 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred)
 
     for (ich = 0; ich < num_channels; ich++) {
         pred[ich] = 0;
+        if (!s->is_channel_coded[ich])
+            continue;
         for (i = 0; i < order * num_channels; i++)
             pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] *
                          s->mclms_coeffs[i + order * num_channels * ich];
@@ -977,10 +980,10 @@ static int decode_subframe(WmallDecodeCtx *s)
 
         for (j = 0; j < subframe_len; j++) {
             if (s->bits_per_sample == 16) {
-                *s->samples_16[c] = (int16_t) s->channel_residues[c][j];
+                *s->samples_16[c] = (int16_t) s->channel_residues[c][j] << padding_zeroes;
                 s->samples_16[c] += s->num_channels;
             } else {
-                *s->samples_32[c] = s->channel_residues[c][j];
+                *s->samples_32[c] = s->channel_residues[c][j] << padding_zeroes;
                 s->samples_32[c] += s->num_channels;
             }
         }
@@ -1039,7 +1042,7 @@ static int decode_frame(WmallDecodeCtx *s)
     /* no idea what these are for, might be the number of samples
        that need to be skipped at the beginning or end of a stream */
     if (get_bits1(gb)) {
-        int skip;
+        int av_unused skip;
 
         /* usually true for the first frame */
         if (get_bits1(gb)) {