This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 31446525881208afd0620f40d361e7940b0723c3
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Dec 10 14:27:47 2025 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Sun Dec 14 10:16:29 2025 +0100

    avcodec/x86/lossless_videoencdsp_init: Don't read too often
    
    sub_median_pred_mmxext() calculates a predictor from the left, top
    and topleft pixel values. The topleft values need to be initialized
    differently for the first loop initialization than for the others
    in order to avoid reading ptr[-1]. So it has been initialized before
    the loop and then read again at the end of the loop, so that the last
    value read was never used. Yet this can lead to reads beyond the end
    of the buffer, e.g. with
    ffmpeg -cpuflags mmx+mmxext -f lavfi -i "color=size=64x4,format=yuv420p" \
    -vf vflip -c:v ffvhuff -pred median -frames 1 -f null -
    
    Fix this by not reading the value at the end of the loop.
    
    Reviewed-by: Lynne <[email protected]>
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/x86/lossless_videoencdsp_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/lossless_videoencdsp_init.c 
b/libavcodec/x86/lossless_videoencdsp_init.c
index c20f3ec04f..d7dfa2e3ae 100644
--- a/libavcodec/x86/lossless_videoencdsp_init.c
+++ b/libavcodec/x86/lossless_videoencdsp_init.c
@@ -54,6 +54,7 @@ static void sub_median_pred_mmxext(uint8_t *dst, const 
uint8_t *src1,
         "jmp 2f                         \n\t"
         "1:                             \n\t"
         "movq  -1(%2, %0), %%mm2        \n\t" // L
+        "movq -1(%1, %0), %%mm0         \n\t" // LT
         "2:                             \n\t"
         "movq  (%1, %0), %%mm1          \n\t" // T
         "movq  (%2, %0), %%mm3          \n\t" // X
@@ -68,7 +69,6 @@ static void sub_median_pred_mmxext(uint8_t *dst, const 
uint8_t *src1,
         "psubb %%mm4, %%mm3             \n\t" // dst - pred
         "movq %%mm3, (%3, %0)           \n\t"
         "add $8, %0                     \n\t"
-        "movq -1(%1, %0), %%mm0         \n\t" // LT
         "cmp %4, %0                     \n\t"
         " jb 1b                         \n\t"
         : "+r" (i)

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to