PR #25103 opened by romainhedouin URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25103 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25103.patch
The float input and output paths called memcpy() for a whole row inside the per-pixel loop, so every row was copied as many times as there are pixels in width. 1080p gbrpf32le: 1.84 s -> 37 ms per frame on a single thread. Output is unchanged. Found during a code review sweep of ffmpeg using an LLM. Signed-off-by: romainhedouin <[email protected]> <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From abb08fb2c2319f85bee729a8a54b2b6541758d5a Mon Sep 17 00:00:00 2001 From: romainhedouin <[email protected]> Date: Thu, 15 Oct 2026 19:46:18 +0200 Subject: [PATCH] avfilter/vf_dblur: Copy float rows once instead of once per pixel The float input and output paths called memcpy() for a whole row inside the per-pixel loop, so every row was copied width times. 1080p gbrpf32le: 1.84 s -> 37 ms per frame on a single thread. Output is unchanged. Found during a code review sweep of ffmpeg using an LLM. Signed-off-by: romainhedouin <[email protected]> --- libavfilter/vf_dblur.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_dblur.c b/libavfilter/vf_dblur.c index 517d4e5617..0b5085b92b 100644 --- a/libavfilter/vf_dblur.c +++ b/libavfilter/vf_dblur.c @@ -247,9 +247,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } } else { for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - memcpy(bptr, src32, width * sizeof(float)); - } + memcpy(bptr, src32, width * sizeof(float)); bptr += width; src32 += in->linesize[plane] / 4; } @@ -276,9 +274,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } } else { for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - memcpy(dst32, bptr, width * sizeof(float)); - } + memcpy(dst32, bptr, width * sizeof(float)); bptr += width; dst32 += out->linesize[plane] / 4; } -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
