avfilter/af_afir: optimize code a little more
authorPaul B Mahol <onemda@gmail.com>
Sun, 30 Dec 2018 16:23:53 +0000 (17:23 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sun, 30 Dec 2018 16:50:44 +0000 (17:50 +0100)
Avoid memset.

libavfilter/af_afir.c

index 8271c2c..3e13edf 100644 (file)
@@ -76,7 +76,6 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
         seg->output_offset[ch] += s->min_part_size;
         if (seg->output_offset[ch] == seg->part_size) {
             seg->output_offset[ch] = 0;
-            memset(dst, 0, sizeof(*dst) * seg->part_size);
         } else {
             memmove(src, src + s->min_part_size, (seg->input_size - s->min_part_size) * sizeof(*src));
 
@@ -119,9 +118,7 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
             buf[n] += sum[n];
         }
 
-        for (n = 0; n < seg->part_size; n++) {
-            dst[n] += buf[n];
-        }
+        memcpy(dst, buf, seg->part_size * sizeof(*dst));
 
         buf = (float *)seg->buffer->extended_data[ch];
         memcpy(buf, sum + seg->part_size, seg->part_size * sizeof(*buf));