mirror of https://git.ffmpeg.org/ffmpeg.git
swscale/x86/rgb2rgb_template: Fix planar2x() for short width
Fixes: 451b3e0cf956c0bd2f27ed753ac24050/asan_heap-oob_2873c01_3231_7ed10a9464d15f0d57277f5917c566a8.AVI Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
a6dc1eb837
commit
c8a9aaab26
|
@ -1434,7 +1434,9 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWid
|
||||||
dst+= dstStride;
|
dst+= dstStride;
|
||||||
|
|
||||||
for (y=1; y<srcHeight; y++) {
|
for (y=1; y<srcHeight; y++) {
|
||||||
const x86_reg mmxSize= srcWidth&~15;
|
x86_reg mmxSize= srcWidth&~15;
|
||||||
|
|
||||||
|
if (mmxSize) {
|
||||||
__asm__ volatile(
|
__asm__ volatile(
|
||||||
"mov %4, %%"REG_a" \n\t"
|
"mov %4, %%"REG_a" \n\t"
|
||||||
"movq "MANGLE(mmx_ff)", %%mm0 \n\t"
|
"movq "MANGLE(mmx_ff)", %%mm0 \n\t"
|
||||||
|
@ -1481,6 +1483,11 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWid
|
||||||
NAMED_CONSTRAINTS_ADD(mmx_ff)
|
NAMED_CONSTRAINTS_ADD(mmx_ff)
|
||||||
: "%"REG_a
|
: "%"REG_a
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
mmxSize = 1;
|
||||||
|
dst[0] = (src[0] * 3 + src[srcStride]) >> 2;
|
||||||
|
dst[dstStride] = (src[0] + 3 * src[srcStride]) >> 2;
|
||||||
|
}
|
||||||
|
|
||||||
for (x=mmxSize-1; x<srcWidth-1; x++) {
|
for (x=mmxSize-1; x<srcWidth-1; x++) {
|
||||||
dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2;
|
dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2;
|
||||||
|
|
Loading…
Reference in New Issue