forked from jengelh/ffmpeg-5
Jan Engelhardt
c7d526a909
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/ffmpeg-5?expand=0&rev=84
45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
From f1f973313b6edc460339c2dfa4675dd3ad72fe98 Mon Sep 17 00:00:00 2001
|
|
From: Paul B Mahol <onemda@gmail.com>
|
|
Date: Mon, 27 Nov 2023 11:52:37 +0100
|
|
Subject: [PATCH] avfilter/af_dialoguenhance: do output scaling once
|
|
References: https://bugzilla.opensuse.org/1222730
|
|
References: CVE-2023-49528
|
|
|
|
---
|
|
libavfilter/af_dialoguenhance.c | 11 ++++-------
|
|
1 file changed, 4 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/libavfilter/af_dialoguenhance.c b/libavfilter/af_dialoguenhance.c
|
|
index 5c8614c185..2674313f5c 100644
|
|
--- a/libavfilter/af_dialoguenhance.c
|
|
+++ b/libavfilter/af_dialoguenhance.c
|
|
@@ -108,7 +108,7 @@ static int config_input(AVFilterLink *inlink)
|
|
|
|
generate_window_func(s->window, s->fft_size, WFUNC_SINE, &overlap);
|
|
|
|
- iscale = 1.f / s->fft_size;
|
|
+ iscale = 1.f / (s->fft_size * 1.5f);
|
|
|
|
ret = av_tx_init(&s->tx_ctx[0], &s->tx_fn, AV_TX_FLOAT_RDFT, 0, s->fft_size, &scale, 0);
|
|
if (ret < 0)
|
|
@@ -296,13 +296,10 @@ static int de_stereo(AVFilterContext *ctx, AVFrame *out)
|
|
memcpy(left_osamples, left_in, overlap * sizeof(float));
|
|
memcpy(right_osamples, right_in, overlap * sizeof(float));
|
|
|
|
- // 4 times overlap with squared hanning window results in 1.5 time increase in amplitude
|
|
- if (!ctx->is_disabled) {
|
|
- for (int i = 0; i < overlap; i++)
|
|
- center_osamples[i] = left_out[i] / 1.5f;
|
|
- } else {
|
|
+ if (ctx->is_disabled)
|
|
memset(center_osamples, 0, overlap * sizeof(float));
|
|
- }
|
|
+ else
|
|
+ memcpy(center_osamples, left_out, overlap * sizeof(float));
|
|
|
|
return 0;
|
|
}
|
|
--
|
|
2.44.0
|
|
|