[FFmpeg-cvslog] avfilter/af_surround: move upmix before irdft

Paul B Mahol git at videolan.org
Wed Nov 16 21:38:08 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Nov 16 20:06:45 2022 +0100| [404c2955b121a1531483cba090fd340922ae7088] | committer: Paul B Mahol

avfilter/af_surround: move upmix before irdft

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

 libavfilter/af_surround.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c
index 9162788d03..9baea2dbef 100644
--- a/libavfilter/af_surround.c
+++ b/libavfilter/af_surround.c
@@ -121,7 +121,7 @@ typedef struct AudioSurroundContext {
     float *window_func_lut;
 
     void (*filter)(AVFilterContext *ctx);
-    int (*upmix)(AVFilterContext *ctx, void *arg, int ch, int nb_jobs);
+    int (*upmix)(AVFilterContext *ctx, int ch);
     void (*upmix_2_1)(AVFilterContext *ctx,
                       float l_phase,
                       float r_phase,
@@ -439,7 +439,7 @@ static inline void get_lfe(int output_lfe, int n, float lowcut, float highcut,
         dst[2 * n    ] = mag * cosf(ph);  \
         dst[2 * n + 1] = mag * sinf(ph);
 
-static int stereo_upmix(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
+static int stereo_upmix(AVFilterContext *ctx, int ch)
 {
     AudioSurroundContext *s = ctx->priv;
     float *dst = (float *)s->output->extended_data[ch];
@@ -1301,12 +1301,16 @@ static int ifft_channel(AVFilterContext *ctx, AVFrame *out, int ch)
 
 static int ifft_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 {
+    AudioSurroundContext *s = ctx->priv;
     AVFrame *out = arg;
     const int start = (out->ch_layout.nb_channels * jobnr) / nb_jobs;
     const int end = (out->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
 
-    for (int ch = start; ch < end; ch++)
+    for (int ch = start; ch < end; ch++) {
+        if (s->upmix)
+            s->upmix(ctx, ch);
         ifft_channel(ctx, out, ch);
+    }
 
     return 0;
 }
@@ -1323,8 +1327,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                             ff_filter_get_nb_threads(ctx)));
 
     s->filter(ctx);
-    if (s->upmix)
-        ff_filter_execute(ctx, s->upmix, NULL, NULL, outlink->ch_layout.nb_channels);
 
     out = ff_get_audio_buffer(outlink, s->hop_size);
     if (!out)



More information about the ffmpeg-cvslog mailing list