[FFmpeg-devel] [PATCH v4 08/13] avfilter/f_ebur128: remove pointless macro

Niklas Haas ffmpeg at haasn.xyz
Tue Jun 17 15:06:01 EEST 2025


From: Niklas Haas <git at haasn.dev>

This macro is not shortening the code nor aiding readability.
---
 libavfilter/f_ebur128.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 2d94cefce7..2e1eedd855 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -682,20 +682,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
 #endif
 
     for (idx_insample = ebur128->idx_insample; idx_insample < nb_samples; idx_insample++) {
-        const int bin_id_400  = ebur128->i400.cache_pos;
-        const int bin_id_3000 = ebur128->i3000.cache_pos;
-
-#define MOVE_TO_NEXT_CACHED_ENTRY(time) do {                \
-    ebur128->i##time.cache_pos++;                           \
-    if (ebur128->i##time.cache_pos ==                       \
-        ebur128->i##time.cache_size) {                      \
-        ebur128->i##time.filled    = 1;                     \
-        ebur128->i##time.cache_pos = 0;                     \
-    }                                                       \
-} while (0)
+        const int bin_id_400  = ebur128->i400.cache_pos++;
+        const int bin_id_3000 = ebur128->i3000.cache_pos++;
+
+        if (ebur128->i400.cache_pos == ebur128->i400.cache_size) {
+            ebur128->i400.filled    = 1;
+            ebur128->i400.cache_pos = 0;
+        }
 
-        MOVE_TO_NEXT_CACHED_ENTRY(400);
-        MOVE_TO_NEXT_CACHED_ENTRY(3000);
+        if (ebur128->i3000.cache_pos == ebur128->i3000.cache_size) {
+            ebur128->i3000.filled    = 1;
+            ebur128->i3000.cache_pos = 0;
+        }
 
         dsp->filter_channels(dsp, &samples[idx_insample * nb_channels],
                              &ebur128->i400.cache[bin_id_400 * nb_channels],
-- 
2.49.0



More information about the ffmpeg-devel mailing list