This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 00ad4cba8959724190f6e1a7b374d732747cfb79
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Tue Oct 13 06:25:02 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Tue Oct 20 20:41:50 2026 +0000

    avfilter/af_alimiter: convert the attack, release and asc_level options 
where they are used
    
    Fixes: fZnlZKlJmMn0
    Fixes: wrong release time and asc level after a command
    Wrong release time and asc level after a command Replicated through 
UnModified FFmpeg with a plain output diff
    Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24672
---
 libavfilter/af_alimiter.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/libavfilter/af_alimiter.c b/libavfilter/af_alimiter.c
index 8ef6d74afd..7318d5d446 100644
--- a/libavfilter/af_alimiter.c
+++ b/libavfilter/af_alimiter.c
@@ -97,22 +97,19 @@ static av_cold int init(AVFilterContext *ctx)
 {
     AudioLimiterContext *s = ctx->priv;
 
-    s->attack   /= 1000.;
-    s->release  /= 1000.;
     s->att       = 1.;
     s->asc_pos   = -1;
-    s->asc_coeff = pow(0.5, s->asc_coeff - 0.5) * 2 * -1;
 
     return 0;
 }
 
-static double get_rdelta(AudioLimiterContext *s, double release, int 
sample_rate,
+static double get_rdelta(AudioLimiterContext *s, double release, double 
asc_coeff, int sample_rate,
                          double peak, double limit, double patt, int asc)
 {
     double rdelta = (1.0 - patt) / (sample_rate * release);
 
     if (asc && s->auto_release && s->asc_c > 0) {
-        double a_att = limit / (s->asc_coeff * s->asc) * (double)s->asc_c;
+        double a_att = limit / (asc_coeff * s->asc) * (double)s->asc_c;
 
         if (a_att > patt) {
             double delta = FFMAX((a_att - patt) / (sample_rate * release), 
rdelta / 10);
@@ -134,7 +131,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     const int channels = inlink->ch_layout.nb_channels;
     const int buffer_size = s->buffer_size;
     double *dst, *buffer = s->buffer;
-    const double release = s->release;
+    const double release = s->release / 1000.;
+    const double asc_coeff = pow(0.5, s->asc_coeff - 0.5) * 2 * -1;
     const double limit = s->limit;
     double *nextdelta = s->nextdelta;
     double level = s->auto_level ? 1 / limit : 1;
@@ -179,7 +177,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
         if (peak > limit) {
             double patt = FFMIN(limit / peak, 1.);
-            double rdelta = get_rdelta(s, release, inlink->sample_rate,
+            double rdelta = get_rdelta(s, release, asc_coeff, 
inlink->sample_rate,
                                        peak, limit, patt, 0);
             double delta = (limit / peak - s->att) / buffer_size * channels;
             int found = 0;
@@ -240,7 +238,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
         if ((s->pos + channels) % buffer_size == nextpos[s->nextiter]) {
             if (s->auto_release) {
-                s->delta = get_rdelta(s, release, inlink->sample_rate,
+                s->delta = get_rdelta(s, release, asc_coeff, 
inlink->sample_rate,
                                       peak, limit, s->att, 1);
                 if (s->nextlen > 1) {
                     double ppeak = 0, pdelta;
@@ -373,7 +371,7 @@ static int config_input(AVFilterLink *inlink)
         return AVERROR(ENOMEM);
 
     memset(s->nextpos, -1, obuffer_size * sizeof(*s->nextpos));
-    s->buffer_size = inlink->sample_rate * s->attack * 
inlink->ch_layout.nb_channels;
+    s->buffer_size = inlink->sample_rate * (s->attack / 1000.) * 
inlink->ch_layout.nb_channels;
     s->buffer_size -= s->buffer_size % inlink->ch_layout.nb_channels;
     if (s->latency)
         s->in_trim = s->out_pad = s->buffer_size / 
inlink->ch_layout.nb_channels - 1;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to