This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 2b9aea7756355f54fb68c5e41020de8cd6fb7d57 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Wed Oct 22 15:53:24 2025 +0200 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Sun Dec 14 10:16:25 2025 +0100 avcodec/x86/lossless_videoencdsp_init: Don't read from before the buffer sub_median_pred_mmxext() calculates a predictor from the left, top and topleft pixel values. The left value is simply read via ptr[-1], although this is not guaranteed to be inside the buffer in case of negative strides. This happens e.g. with ffmpeg -i fate-suite/mpeg2/dvd_single_frame.vob -vf vflip \ -c:v magicyuv -pred median -f null - Fix this by reading the first value like the topleft value. Also change the documentation of sub_median_pred to reflect this change (and the one from 791b5954bc8fe7c0077d7eb959ebd17e40d0a7c6). Reviewed-by: Lynne <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/lossless_videoencdsp.h | 1 - libavcodec/x86/lossless_videoencdsp_init.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/lossless_videoencdsp.h b/libavcodec/lossless_videoencdsp.h index 7fd0ad32c7..44b33e7edb 100644 --- a/libavcodec/lossless_videoencdsp.h +++ b/libavcodec/lossless_videoencdsp.h @@ -29,7 +29,6 @@ typedef struct LLVidEncDSPContext { intptr_t w); /** * Subtract HuffYUV's variant of median prediction. - * Note, this might read from src1[-1], src2[-1]. */ void (*sub_median_pred)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, intptr_t w, diff --git a/libavcodec/x86/lossless_videoencdsp_init.c b/libavcodec/x86/lossless_videoencdsp_init.c index 22a4014ef1..c20f3ec04f 100644 --- a/libavcodec/x86/lossless_videoencdsp_init.c +++ b/libavcodec/x86/lossless_videoencdsp_init.c @@ -49,9 +49,13 @@ static void sub_median_pred_mmxext(uint8_t *dst, const uint8_t *src1, __asm__ volatile ( "movq (%1, %0), %%mm0 \n\t" // LT "psllq $8, %%mm0 \n\t" + "movq (%2, %0), %%mm2 \n\t" // L + "psllq $8, %%mm2 \n\t" + "jmp 2f \n\t" "1: \n\t" - "movq (%1, %0), %%mm1 \n\t" // T "movq -1(%2, %0), %%mm2 \n\t" // L + "2: \n\t" + "movq (%1, %0), %%mm1 \n\t" // T "movq (%2, %0), %%mm3 \n\t" // X "movq %%mm2, %%mm4 \n\t" // L "psubb %%mm0, %%mm2 \n\t" _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
