[FFmpeg-devel] [PATCH] swscale/output: fix x2rbg10/x2bgr10 output
James Almer
jamrial at gmail.com
Wed Oct 30 00:19:13 EET 2024
Checking for AV_PIX_FMT_X2RGB10 means the condition will succeed only for the
version matching the host's endinaness, when only LE is supported, and thus
the wrong path will be taken on BE systems.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libswscale/output.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/libswscale/output.c b/libswscale/output.c
index b37568a10a..03aa76bd57 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1669,13 +1669,13 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,
dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
- } else if (target == AV_PIX_FMT_X2RGB10 || target == AV_PIX_FMT_X2BGR10) {
+ } else if (target == AV_PIX_FMT_X2RGB10LE || target == AV_PIX_FMT_X2BGR10LE) {
uint32_t *dest = (uint32_t *) _dest;
const uint32_t *r = (const uint32_t *) _r;
const uint32_t *g = (const uint32_t *) _g;
const uint32_t *b = (const uint32_t *) _b;
- dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1];
- dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2];
+ AV_WL32(&dest[i * 2 + 0], r[Y1] + g[Y1] + b[Y1]);
+ AV_WL32(&dest[i * 2 + 1], r[Y2] + g[Y2] + b[Y2]);
} else /* 8/4 bits */ {
uint8_t *dest = (uint8_t *) _dest;
const uint8_t *r = (const uint8_t *) _r;
@@ -1913,8 +1913,8 @@ YUV2RGBWRAPPER(yuv2rgb,, 12, AV_PIX_FMT_RGB444, 0)
YUV2RGBWRAPPER(yuv2rgb,, 8, AV_PIX_FMT_RGB8, 0)
YUV2RGBWRAPPER(yuv2rgb,, 4, AV_PIX_FMT_RGB4, 0)
YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0)
-YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10, 0)
-YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10, 0)
+YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10LE, 0)
+YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10LE, 0)
static av_always_inline void yuv2rgb_write_full(SwsInternal *c,
uint8_t *dest, int i, int Y, int A, int U, int V,
@@ -3604,13 +3604,11 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c,
*yuv2packedX = yuv2rgb4b_X_c;
break;
case AV_PIX_FMT_X2RGB10LE:
- case AV_PIX_FMT_X2RGB10BE:
*yuv2packed1 = yuv2x2rgb10_1_c;
*yuv2packed2 = yuv2x2rgb10_2_c;
*yuv2packedX = yuv2x2rgb10_X_c;
break;
case AV_PIX_FMT_X2BGR10LE:
- case AV_PIX_FMT_X2BGR10BE:
*yuv2packed1 = yuv2x2bgr10_1_c;
*yuv2packed2 = yuv2x2bgr10_2_c;
*yuv2packedX = yuv2x2bgr10_X_c;
--
2.47.0
More information about the ffmpeg-devel
mailing list