From 6f6907fd202a08826ceefe0fe2bd6501a696ed15 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sat, 29 Jul 2023 00:52:53 +0200 Subject: [PATCH] avfilter/avf_showcwt: fix very low freqs leakage --- libavfilter/avf_showcwt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/avf_showcwt.c b/libavfilter/avf_showcwt.c index 4aa008ca2e..85cb19103b 100644 --- a/libavfilter/avf_showcwt.c +++ b/libavfilter/avf_showcwt.c @@ -636,6 +636,7 @@ static int compute_kernel(AVFilterContext *ctx) const int fsize = s->frequency_band_count; int *kernel_start = s->kernel_start; int *kernel_stop = s->kernel_stop; + const int hsize = size >> 1; unsigned *index = s->index; int kernel_min = INT_MAX; int kernel_max = 0, ret = 0; @@ -656,6 +657,7 @@ static int compute_kernel(AVFilterContext *ctx) for (int n = 0; n < size; n++) { float ff, f = n-frequency; + f = hsize - fabsf(f - hsize); ff = expf(-f*f*deviation); tkernel[n] = ff; }