[FFmpeg-cvslog] swscale/rgb2rgb_template: use shuffle macro on big-endian arches

Andriy Gelman git at videolan.org
Sun Dec 13 06:21:38 EET 2020


ffmpeg | branch: master | Andriy Gelman <andriy.gelman at gmail.com> | Mon Nov 30 00:46:51 2020 -0500| [1200264fc4122dbb58bd08861f926cd6448593eb] | committer: Andriy Gelman

swscale/rgb2rgb_template: use shuffle macro on big-endian arches

Fixes fate-qtrle-32bit on big-endian.

The macro does a simple byte swap on uint8 array without any casts, so
it's valid on big-endian arches.

The mentioned test was failing because the byteswap function
shuffle_bytes_3210_c() is used in the pixel format conversion
(argb->bgra).

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1200264fc4122dbb58bd08861f926cd6448593eb
---

 libswscale/rgb2rgb_template.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
index f7385e3722..42c69801ba 100644
--- a/libswscale/rgb2rgb_template.c
+++ b/libswscale/rgb2rgb_template.c
@@ -342,7 +342,6 @@ static inline void shuffle_bytes_0321_c(const uint8_t *src, uint8_t *dst,
     }
 }
 
-#if !HAVE_BIGENDIAN
 #define DEFINE_SHUFFLE_BYTES(name, a, b, c, d)                          \
 static void shuffle_bytes_##name (const uint8_t *src,                   \
                                         uint8_t *dst, int src_size)     \
@@ -360,7 +359,6 @@ static void shuffle_bytes_##name (const uint8_t *src,                   \
 DEFINE_SHUFFLE_BYTES(1230_c, 1, 2, 3, 0)
 DEFINE_SHUFFLE_BYTES(3012_c, 3, 0, 1, 2)
 DEFINE_SHUFFLE_BYTES(3210_c, 3, 2, 1, 0)
-#endif
 
 static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
 {
@@ -969,10 +967,10 @@ static av_cold void rgb2rgb_init_c(void)
 #else
     shuffle_bytes_0321 = shuffle_bytes_0321_c;
     shuffle_bytes_2103 = shuffle_bytes_2103_c;
+#endif
     shuffle_bytes_1230 = shuffle_bytes_1230_c;
     shuffle_bytes_3012 = shuffle_bytes_3012_c;
     shuffle_bytes_3210 = shuffle_bytes_3210_c;
-#endif
     rgb32tobgr16       = rgb32tobgr16_c;
     rgb32tobgr15       = rgb32tobgr15_c;
     yv12toyuy2         = yv12toyuy2_c;



More information about the ffmpeg-cvslog mailing list