diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-06-22 02:32:30 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-22 02:32:30 +0200 |
commit | a1a76b209b42cdd9f8f16bfce7509883d636b940 (patch) | |
tree | 54d9cb163a11a2a91a13da0d7ca3c3d47bc4f0c2 /libswscale/x86 | |
parent | 84de3ed795d058b1affe4961c3bc83dc4cae1076 (diff) | |
download | ffmpeg-a1a76b209b42cdd9f8f16bfce7509883d636b940.tar.gz |
swscale/x86/input: prevent RGB32_TO_UV_FN from reading into the padding
This avoids reading uninitialized bytes and confusing valgrind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/x86')
-rw-r--r-- | libswscale/x86/input.asm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libswscale/x86/input.asm b/libswscale/x86/input.asm index 0c4f30e6e0..1f0f1ef808 100644 --- a/libswscale/x86/input.asm +++ b/libswscale/x86/input.asm @@ -406,6 +406,7 @@ cglobal %2%3%4%5 %+ ToUV, 7, 7, %1, dstU, dstV, u1, src, u2, w, table mov wq, r5m %endif add wq, wq + sub wq, mmsize - 1 add dstUq, wq add dstVq, wq lea srcq, [srcq+wq*2] @@ -449,6 +450,31 @@ cglobal %2%3%4%5 %+ ToUV, 7, 7, %1, dstU, dstV, u1, src, u2, w, table %endif ; mmsize == 8/16 add wq, mmsize jl .loop + sub wq, mmsize - 1 + jz .end + add srcq , 2*mmsize - 2 + add dstUq, mmsize - 1 + add dstVq, mmsize - 1 +.loop2: + movd m0, [srcq+wq*2] ; (byte) { Bx, Gx, Rx, xx }[0-3] + DEINTB 1, 0, 5, 4, 7 ; (word) { Gx, xx (m0/m4) or Bx, Rx (m1/m5) }[0-3]/[4-7] + pmaddwd m3, m1, coeffV1 ; (dword) { Bx*BV + Rx*RV }[0-3] + pmaddwd m2, m0, coeffV2 ; (dword) { Gx*GV }[0-3] + pmaddwd m1, coeffU1 ; (dword) { Bx*BU + Rx*RU }[0-3] + pmaddwd m0, coeffU2 ; (dword) { Gx*GU }[0-3] + paddd m3, m6 ; += rgb_UVrnd + paddd m1, m6 ; += rgb_UVrnd + paddd m2, m3 ; (dword) { V[0-3] } + paddd m0, m1 ; (dword) { U[0-3] } + psrad m0, 9 + psrad m2, 9 + packssdw m0, m0 ; (word) { U[0-7] } + packssdw m2, m2 ; (word) { V[0-7] } + movd [dstUq+wq], m0 + movd [dstVq+wq], m2 + add wq, 2 + jl .loop2 +.end: REP_RET %endif ; ARCH_X86_64 && %0 == 3 %endmacro |