Change #271412
| Category | ffmpeg |
| Changed by | Michael Niedermayer <michael@niedermayer.cc> |
| Changed at | Wed 17 Jun 2026 02:40:59 |
| Repository | https://git.ffmpeg.org/ffmpeg.git |
| Project | ffmpeg |
| Branch | master |
| Revision | 21782b7b3143a3ed68de635c83b2094523e4cf39 |
Comments
swscale/x86/rgb_2_rgb: fix uyvytoyuv422 overwrite on odd width uyvytoyuv422 converts packed UYVY, whose macroblocks are pixel pairs, and the SIMD code only handled even widths. On an odd width the trailing half macroblock made the kernel write past the end of the Y/U/V destinations: the AVX512ICL masked tail dropped the odd pixel and the fall-through re-entered the SIMD loop, writing a full mmsize*2 chunk past the planes (127 bytes of Y, 63 of U and 63 of V); the sse2/avx/avx2 scalar tail wrote one byte past the Y plane. Process only whole pairs and emit the trailing odd column from a small per-row epilogue that matches uyvytoyuv422_c (ydst[w-1] = src[2w-1], udst[cw-1] = src[2w-2], vdst[cw-1] = src[2w]). All four SIMD variants are now bit-exact with the C reference for even and odd widths and no longer overwrite the destination. Verified on AVX512ICL hardware (Ryzen 9 9950X) with checkasm. Found-by: Claude (Anthropic). Human-verified and reported by Omkhar Arasaratnam <omkhar@linkedin.com>. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Changed files
- libswscale/x86/rgb_2_rgb.asm