]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/shorten.c
ffprobe: refactor frames decoding.
[ffmpeg] / libavcodec / shorten.c
index b211e4f1405dbf94ed7d89e9cef859bf72e9d788..b47e1a69f1c6631d58a9ad4743883f701a08f80c 100644 (file)
@@ -466,7 +466,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
 
     s->cur_chan = 0;
     while (s->cur_chan < s->channels) {
-        int cmd;
+        unsigned int cmd;
         int len;
 
         if (get_bits_left(&s->gb) < 3+FNSIZE) {
@@ -525,7 +525,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
             /* get Rice code for residual decoding */
             if (cmd != FN_ZERO) {
                 residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE);
-                /* this is a hack as version 0 differed in defintion of get_sr_golomb_shorten */
+                /* this is a hack as version 0 differed in definition of get_sr_golomb_shorten */
                 if (s->version == 0)
                     residual_size--;
             }
@@ -539,7 +539,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
                     sum += s->offset[channel][i];
                 coffset = sum / s->nmean;
                 if (s->version >= 2)
-                    coffset >>= FFMIN(1, s->bitshift);
+                    coffset = s->bitshift == 0 ? coffset : coffset >> s->bitshift - 1 >> 1;
             }
 
             /* decode samples for this channel */