PR #26220 opened by Pu Cheng (GeekQAQ) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26220 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26220.patch
cdg_scroll() returns early when neither the horizontal nor the vertical offset changes, before copying the palette and the picture into new_frame. The caller then replaces the canvas with new_frame anyway, so a SCROLL_PRESET or SCROLL_COPY without offset (only presetting the color, or a no-op scroll) loses the whole picture and the palette: later tiles are drawn on whatever the newly obtained buffer contains, with black colors. After avcodec_flush_buffers() that is a recycled pool buffer holding the previous stream's picture. Do the copy in this case as well. Signed-off-by: Pu Cheng <[email protected]> >From d5f340f5b57993a656a1be53cc186fdde73be574 Mon Sep 17 00:00:00 2001 From: Pu Cheng <[email protected]> Date: Fri, 20 Nov 2026 14:34:00 +0800 Subject: [PATCH] avcodec/cdgraphics: copy the canvas for scroll commands without offset cdg_scroll() returns early when neither the horizontal nor the vertical offset changes, before copying the palette and the picture into new_frame. The caller then replaces the canvas with new_frame anyway, so a SCROLL_PRESET or SCROLL_COPY without offset (only presetting the color, or a no-op scroll) loses the whole picture and the palette: later tiles are drawn on whatever the newly obtained buffer contains, with black colors. After avcodec_flush_buffers() that is a recycled pool buffer holding the previous stream's picture. Do the copy in this case as well. Signed-off-by: Pu Cheng <[email protected]> --- libavcodec/cdgraphics.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index 1b5a37875bf..fcab6b4d909 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -233,9 +233,6 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data, if (hscmd == RIGHT) hinc += 6; - if (!hinc && !vinc) - return; - memcpy(new_frame->data[1], cc->frame->data[1], CDG_PALETTE_SIZE * 4); for (y = FFMAX(0, vinc); y < FFMIN(CDG_FULL_HEIGHT + vinc, CDG_FULL_HEIGHT); y++) -- 2.54.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
