Commit 169d516b35 for ffmpeg
commit 169d516b35100af815275f3fa0f3311fbf4f833e
Author: romainhedouin <romain.hedouin@epitech.eu>
Date: Fri Oct 16 16:35:47 2026 +0200
avfilter/vf_nnedi: fix stale prescreener flags after pscrn=none
The prescreener flags are only written when a prescreener is used. If
pscrn is changed to none at runtime, the flags of the previous frames
stayed in the buffer, so the predictor skipped those pixels and the
output was wrong. Clear the flags when pscrn is none.
Checked by switching pscrn with sendcmd: the frames after the switch
now match a run that started with pscrn=none.
Found during a code review sweep of ffmpeg using an LLM.
Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c
index 5c4b47e0a2..dff5915e21 100644
--- a/libavfilter/vf_nnedi.c
+++ b/libavfilter/vf_nnedi.c
@@ -631,6 +631,9 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
src_linesize * 2, srcbuf_stride,
width, 1, in_scale);
+ if (!s->pscrn)
+ memset(prescreen_buf, 0, width);
+
for (int y = 0; y < slice_end - slice_start; y += 2) {
if (s->pscrn > 0)
s->prescreen[s->pscrn > 1](ctx, srcbuf + (y / 2) * srcbuf_stride + 32,