From 7f4c5f6525dcf1513121de3f911c3210f6805ebc Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Sun, 6 Nov 2022 19:13:57 +0100
Subject: [PATCH] avfilter/af_speechnorm: remove long search range for min gain

Effective only for linked channels processing.
---
 libavfilter/af_speechnorm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavfilter/af_speechnorm.c b/libavfilter/af_speechnorm.c
index fd6b7d9a32..cc0c08feef 100644
--- a/libavfilter/af_speechnorm.c
+++ b/libavfilter/af_speechnorm.c
@@ -366,7 +366,6 @@ static void filter_link_channels_## name (AVFilterContext *ctx,
                                                                                 \
     while (n < nb_samples) {                                                    \
         int min_size = nb_samples - n;                                          \
-        int max_size = 1;                                                       \
         ptype gain = s->max_expansion;                                          \
                                                                                 \
         for (int ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {            \
@@ -377,7 +376,6 @@ static void filter_link_channels_## name (AVFilterContext *ctx,
                                                                                 \
             next_pi(ctx, cc, cc->bypass);                                       \
             min_size = FFMIN(min_size, cc->pi_size);                            \
-            max_size = FFMAX(max_size, cc->pi_size);                            \
         }                                                                       \
                                                                                 \
         av_assert1(min_size > 0);                                               \
@@ -386,7 +384,7 @@ static void filter_link_channels_## name (AVFilterContext *ctx,
                                                                                 \
             if (cc->bypass)                                                     \
                 continue;                                                       \
-            gain = FFMIN(gain, min_gain(ctx, cc, max_size));                    \
+            gain = FFMIN(gain, min_gain(ctx, cc, min_size));                    \
         }                                                                       \
                                                                                 \
         for (int ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {            \