]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/takdec.c
dvbsubdec: Fix function return type
[ffmpeg] / libavcodec / takdec.c
index b0e84ea3c09a5d79d7ba043deab69d11de90a6b0..c84cca448d3074e20bfb8cb64db159c99a8bc993 100644 (file)
@@ -487,7 +487,7 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
         v += s->adsp.scalarproduct_int16(&s->residues[i], filter,
                                          FFALIGN(filter_order, 16));
 
-        v = (av_clip(v >> filter_quant, -8192, 8191) << dshift) - *decoded;
+        v = (av_clip_intp2(v >> filter_quant, 13) << dshift) - *decoded;
         *decoded++ = v;
         s->residues[filter_order + i] = v >> dshift;
     }
@@ -657,7 +657,7 @@ static int decorrelate(TAKDecContext *s, int c1, int c2, int length)
             v += s->adsp.scalarproduct_int16(&s->residues[i], filter,
                                              FFALIGN(filter_order, 16));
 
-            p1[i] = (av_clip(v >> 10, -8192, 8191) << dshift) - p1[i];
+            p1[i] = (av_clip_intp2(v >> 10, 13) << dshift) - p1[i];
         }
 
         emms_c();
@@ -748,6 +748,8 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
         int buf_size = av_samples_get_buffer_size(NULL, avctx->channels,
                                                   s->nb_samples,
                                                   AV_SAMPLE_FMT_S32P, 0);
+        if (buf_size < 0)
+            return buf_size;
         av_fast_malloc(&s->decode_buffer, &s->decode_buffer_size, buf_size);
         if (!s->decode_buffer)
             return AVERROR(ENOMEM);
@@ -925,7 +927,7 @@ AVCodec ff_tak_decoder = {
     .init_static_data = tak_init_static_data,
     .close            = tak_decode_close,
     .decode           = tak_decode_frame,
-    .capabilities     = CODEC_CAP_DR1,
+    .capabilities     = AV_CODEC_CAP_DR1,
     .sample_fmts      = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
                                                         AV_SAMPLE_FMT_S16P,
                                                         AV_SAMPLE_FMT_S32P,