[FFmpeg-cvslog] avfilter/af_dynaudnorm: cleanup gaussian_filter() function

Paul B Mahol git at videolan.org
Fri Feb 25 19:15:30 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Feb 25 10:30:33 2022 +0100| [e845c41c944ebc42411c9cc52f8d13faed1b78a3] | committer: Paul B Mahol

avfilter/af_dynaudnorm: cleanup gaussian_filter() function

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e845c41c944ebc42411c9cc52f8d13faed1b78a3
---

 libavfilter/af_dynaudnorm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c
index 783266f8c1..121a3ef5d7 100644
--- a/libavfilter/af_dynaudnorm.c
+++ b/libavfilter/af_dynaudnorm.c
@@ -435,12 +435,16 @@ static double minimum_filter(cqueue *q)
 
 static double gaussian_filter(DynamicAudioNormalizerContext *s, cqueue *q, cqueue *tq)
 {
+    const double *weights = s->weights;
     double result = 0.0, tsum = 0.0;
     int i;
 
     for (i = 0; i < cqueue_size(q); i++) {
-        tsum += cqueue_peek(tq, i) * s->weights[i];
-        result += cqueue_peek(q, i) * s->weights[i] * cqueue_peek(tq, i);
+        double tq_item = cqueue_peek(tq, i);
+        double q_item = cqueue_peek(q, i);
+
+        tsum   += tq_item * weights[i];
+        result += tq_item * weights[i] * q_item;
     }
 
     if (tsum == 0.0)



More information about the ffmpeg-cvslog mailing list