[FFmpeg-devel] [PATCH v2 3/3] avfilter/af_volumedetect.c: reindent after last commit

Yigithan Yigit yigithanyigitdevel at gmail.com
Tue May 14 03:55:18 EEST 2024


---
 libavfilter/af_volumedetect.c | 68 +++++++++++++++++------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c
index dbbcd037a5..b78b073c09 100644
--- a/libavfilter/af_volumedetect.c
+++ b/libavfilter/af_volumedetect.c
@@ -134,40 +134,40 @@ static void print_stats(AVFilterContext *ctx)
             sum += vd->histogram[i];
         }
     } else {
-    for (i = 0; i < 0x10000; i++)
-        nb_samples += vd->histogram[i];
-    av_log(ctx, AV_LOG_INFO, "n_samples: %"PRId64"\n", nb_samples);
-    if (!nb_samples)
-        return;
-
-    /* If nb_samples > 1<<34, there is a risk of overflow in the
-       multiplication or the sum: shift all histogram values to avoid that.
-       The total number of samples must be recomputed to avoid rounding
-       errors. */
-    shift = av_log2(nb_samples >> 33);
-    for (i = 0; i < 0x10000; i++) {
-        nb_samples_shift += vd->histogram[i] >> shift;
-        power += (i - 0x8000) * (i - 0x8000) * (vd->histogram[i] >> shift);
-    }
-    if (!nb_samples_shift)
-        return;
-    power = (power + nb_samples_shift / 2) / nb_samples_shift;
-    av_assert0(power <= 0x8000 * 0x8000);
-    av_log(ctx, AV_LOG_INFO, "mean_volume: %.1f dB\n",
-logdb((double)power, AV_SAMPLE_FMT_S16));
-
-    max_volume = 0x8000;
-    while (max_volume > 0 && !vd->histogram[0x8000 + max_volume] &&
-                             !vd->histogram[0x8000 - max_volume])
-        max_volume--;
-    av_log(ctx, AV_LOG_INFO, "max_volume: %.1f dB\n",
-logdb((double)(max_volume * max_volume), AV_SAMPLE_FMT_S16));
-
-    for (i = 0; i < 0x10000; i++)
-        histdb[(int)logdb((double)(i - 0x8000) * (i - 0x8000),
AV_SAMPLE_FMT_S16)] += vd->histogram[i];
-    for (i = 0; i <= MAX_DB && !histdb[i]; i++);
-    for (; i <= MAX_DB && sum < nb_samples / 1000; i++) {
-        av_log(ctx, AV_LOG_INFO, "histogram_%ddb: %"PRId64"\n", -i,
histdb[i]);
-        sum += histdb[i];
-    }
+        for (i = 0; i < 0x10000; i++)
+            nb_samples += vd->histogram[i];
+        av_log(ctx, AV_LOG_INFO, "n_samples: %"PRId64"\n", nb_samples);
+        if (!nb_samples)
+            return;
+
+        /* If nb_samples > 1<<34, there is a risk of overflow in the
+        multiplication or the sum: shift all histogram values to avoid
that.
+        The total number of samples must be recomputed to avoid rounding
+        errors. */
+        shift = av_log2(nb_samples >> 33);
+        for (i = 0; i < 0x10000; i++) {
+            nb_samples_shift += vd->histogram[i] >> shift;
+            power += (i - 0x8000) * (i - 0x8000) * (vd->histogram[i] >>
shift);
+        }
+        if (!nb_samples_shift)
+            return;
+        power = (power + nb_samples_shift / 2) / nb_samples_shift;
+        av_assert0(power <= 0x8000 * 0x8000);
+        av_log(ctx, AV_LOG_INFO, "mean_volume: %.1f dB\n",
-logdb((double)power, AV_SAMPLE_FMT_S16));
+
+        max_volume = 0x8000;
+        while (max_volume > 0 && !vd->histogram[0x8000 + max_volume] &&
+                                !vd->histogram[0x8000 - max_volume])
+            max_volume--;
+        av_log(ctx, AV_LOG_INFO, "max_volume: %.1f dB\n",
-logdb((double)(max_volume * max_volume), AV_SAMPLE_FMT_S16));
+
+        for (i = 0; i < 0x10000; i++)
+            histdb[(int)logdb((double)(i - 0x8000) * (i - 0x8000),
AV_SAMPLE_FMT_S16)] += vd->histogram[i];
+        for (i = 0; i <= MAX_DB && !histdb[i]; i++);
+        for (; i <= MAX_DB && sum < nb_samples / 1000; i++) {
+            av_log(ctx, AV_LOG_INFO, "histogram_%ddb: %"PRId64"\n", -i,
histdb[i]);
+            sum += histdb[i];
+        }
     }
 }

-- 
2.44.0


More information about the ffmpeg-devel mailing list