* [FFmpeg-devel] [PATCH] avfilter/af_afftfilt: fix the overlap buffer size
@ 2025-11-16 10:48 nots1dd via ffmpeg-devel
2025-11-16 11:19 ` [FFmpeg-devel] " Sidd via ffmpeg-devel
2025-11-16 12:04 ` Sidd via ffmpeg-devel
0 siblings, 2 replies; 3+ messages in thread
From: nots1dd via ffmpeg-devel @ 2025-11-16 10:48 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: nots1dd
>From what I understand, we only need to be moving N bytes as window_size
- s->hop_size after inverse fft to the buffer for overlap. Currently the
compiler throws a warning regarding possible overflow and this patch
fixs it.
---
libavfilter/af_afftfilt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c
index 08cdcae2f7..4fc28c6143 100644
--- a/libavfilter/af_afftfilt.c
+++ b/libavfilter/af_afftfilt.c
@@ -250,6 +250,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
{
AFFTFiltContext *s = ctx->priv;
const int window_size = s->window_size;
+ const int hop_size = s->hop_size;
const float *window_lut = s->window_func_lut;
const float f = sqrtf(1.f - s->overlap);
const int channels = s->channels;
@@ -294,7 +295,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
s->itx_fn(s->ifft[ch], fft_out, fft_temp, sizeof(*fft_temp));
- memmove(buf, buf + s->hop_size, window_size * sizeof(float));
+ memmove(buf, buf + hop_size, (window_size - hop_size) * sizeof(float));
for (int i = 0; i < window_size; i++)
buf[i] += fft_out[i].re * window_lut[i] * f;
}
--
2.51.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] Re: [PATCH] avfilter/af_afftfilt: fix the overlap buffer size
2025-11-16 10:48 [FFmpeg-devel] [PATCH] avfilter/af_afftfilt: fix the overlap buffer size nots1dd via ffmpeg-devel
@ 2025-11-16 11:19 ` Sidd via ffmpeg-devel
2025-11-16 12:04 ` Sidd via ffmpeg-devel
1 sibling, 0 replies; 3+ messages in thread
From: Sidd via ffmpeg-devel @ 2025-11-16 11:19 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Sidd
Also I am a bit confused what happens after a maintainer accepts or is
satisfied with this patch (as I am unable to commit anything to my
fork on code.ffmpeg.org) so any help on this would be great (it is my
first time if it wasnt obvious enough)
On Sun, Nov 16, 2025 at 4:19 PM nots1dd <sid9.karanam@gmail.com> wrote:
>
> From what I understand, we only need to be moving N bytes as window_size
> - s->hop_size after inverse fft to the buffer for overlap. Currently the
> compiler throws a warning regarding possible overflow and this patch
> fixs it.
> ---
> libavfilter/af_afftfilt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c
> index 08cdcae2f7..4fc28c6143 100644
> --- a/libavfilter/af_afftfilt.c
> +++ b/libavfilter/af_afftfilt.c
> @@ -250,6 +250,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
> {
> AFFTFiltContext *s = ctx->priv;
> const int window_size = s->window_size;
> + const int hop_size = s->hop_size;
> const float *window_lut = s->window_func_lut;
> const float f = sqrtf(1.f - s->overlap);
> const int channels = s->channels;
> @@ -294,7 +295,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
>
> s->itx_fn(s->ifft[ch], fft_out, fft_temp, sizeof(*fft_temp));
>
> - memmove(buf, buf + s->hop_size, window_size * sizeof(float));
> + memmove(buf, buf + hop_size, (window_size - hop_size) * sizeof(float));
> for (int i = 0; i < window_size; i++)
> buf[i] += fft_out[i].re * window_lut[i] * f;
> }
> --
> 2.51.0
>
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] Re: [PATCH] avfilter/af_afftfilt: fix the overlap buffer size
2025-11-16 10:48 [FFmpeg-devel] [PATCH] avfilter/af_afftfilt: fix the overlap buffer size nots1dd via ffmpeg-devel
2025-11-16 11:19 ` [FFmpeg-devel] " Sidd via ffmpeg-devel
@ 2025-11-16 12:04 ` Sidd via ffmpeg-devel
1 sibling, 0 replies; 3+ messages in thread
From: Sidd via ffmpeg-devel @ 2025-11-16 12:04 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Sidd
PR: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20933
On Sun, Nov 16, 2025 at 4:19 PM nots1dd <sid9.karanam@gmail.com> wrote:
>
> From what I understand, we only need to be moving N bytes as window_size
> - s->hop_size after inverse fft to the buffer for overlap. Currently the
> compiler throws a warning regarding possible overflow and this patch
> fixs it.
> ---
> libavfilter/af_afftfilt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c
> index 08cdcae2f7..4fc28c6143 100644
> --- a/libavfilter/af_afftfilt.c
> +++ b/libavfilter/af_afftfilt.c
> @@ -250,6 +250,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
> {
> AFFTFiltContext *s = ctx->priv;
> const int window_size = s->window_size;
> + const int hop_size = s->hop_size;
> const float *window_lut = s->window_func_lut;
> const float f = sqrtf(1.f - s->overlap);
> const int channels = s->channels;
> @@ -294,7 +295,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
>
> s->itx_fn(s->ifft[ch], fft_out, fft_temp, sizeof(*fft_temp));
>
> - memmove(buf, buf + s->hop_size, window_size * sizeof(float));
> + memmove(buf, buf + hop_size, (window_size - hop_size) * sizeof(float));
> for (int i = 0; i < window_size; i++)
> buf[i] += fft_out[i].re * window_lut[i] * f;
> }
> --
> 2.51.0
>
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-16 12:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-16 10:48 [FFmpeg-devel] [PATCH] avfilter/af_afftfilt: fix the overlap buffer size nots1dd via ffmpeg-devel
2025-11-16 11:19 ` [FFmpeg-devel] " Sidd via ffmpeg-devel
2025-11-16 12:04 ` Sidd via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git