Commit 2193727b88 for ffmpeg
commit 2193727b88820d20466ba1426d9ca87cc1d8c575
Author: romainhedouin <romain.hedouin@epitech.eu>
Date: Thu Oct 15 19:46:18 2026 +0200
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 <romain.hedouin@epitech.eu>
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;
}