]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dpcm.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / dpcm.c
index 069bf1dcd8ab014278c4f4a88a64c1c1845624df..3bd7a3e1175378b256a87f53e15b8c7186bec51e 100644 (file)
@@ -321,9 +321,8 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
                 shift[ch] -= (2 * n);
             diff = sign_extend((diff &~ 3) << 8, 16);
 
-            /* saturate the shifter to a lower limit of 0 */
-            if (shift[ch] < 0)
-                shift[ch] = 0;
+            /* saturate the shifter to 0..31 */
+            shift[ch] = av_clip_uintp2(shift[ch], 5);
 
             diff >>= shift[ch];
             predictor[ch] += diff;
@@ -411,7 +410,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
 }
 
 #define DPCM_DECODER(id_, name_, long_name_)                \
-AVCodec ff_ ## name_ ## _decoder = {                        \
+const AVCodec ff_ ## name_ ## _decoder = {                        \
     .name           = #name_,                               \
     .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
     .type           = AVMEDIA_TYPE_AUDIO,                   \