mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-11 08:13:06 +00:00
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 791b5954bc).
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user