]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_agate.c
Merge commit 'f3aff31e5f66a4f1c4e34ce4944f4a402aca61ed'
[ffmpeg] / libavfilter / af_agate.c
index 46ee22623545c5a80d9a45ed055ca89b7fa19010..b56f32e13c5bff1990f5fbd7e80fa56df14e992f 100644 (file)
@@ -77,7 +77,8 @@ static int query_formats(AVFilterContext *ctx)
     AVFilterChannelLayouts *layouts;
     int ret;
 
-    ff_add_format(&formats, AV_SAMPLE_FMT_DBL);
+    if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL)) < 0)
+        return ret;
     ret = ff_set_common_formats(ctx, formats);
     if (ret < 0)
         return ret;
@@ -158,14 +159,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     const double attack_coeff = s->attack_coeff;
     const double release_coeff = s->release_coeff;
     const double level_in = s->level_in;
-    AVFrame *out = NULL;
+    AVFrame *out;
     double *dst;
     int n, c;
 
     if (av_frame_is_writable(in)) {
         out = in;
     } else {
-        AVFrame *out = ff_get_audio_buffer(inlink, in->nb_samples);
+        out = ff_get_audio_buffer(inlink, in->nb_samples);
         if (!out) {
             av_frame_free(&in);
             return AVERROR(ENOMEM);
@@ -175,17 +176,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     dst = (double *)out->data[0];
 
     for (n = 0; n < in->nb_samples; n++, src += inlink->channels, dst += inlink->channels) {
-        double abs_sample = FFABS(src[0]), gain = 1.0;
+        double abs_sample = fabs(src[0]), gain = 1.0;
 
         for (c = 0; c < inlink->channels; c++)
             dst[c] = src[c] * level_in;
 
         if (s->link == 1) {
             for (c = 1; c < inlink->channels; c++)
-                abs_sample = FFMAX(FFABS(src[c]), abs_sample);
+                abs_sample = FFMAX(fabs(src[c]), abs_sample);
         } else {
             for (c = 1; c < inlink->channels; c++)
-                abs_sample += FFABS(src[c]);
+                abs_sample += fabs(src[c]);
 
             abs_sample /= inlink->channels;
         }