aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/rgb2rgb_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-23 04:36:02 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-28 02:42:14 +0200
commit17b7262b4f9dca6a69dc35ac236c3407476cb21a (patch)
tree7686ac2fc6ad3860ed7d46d7ce3b2c8bae1a6aa9 /libswscale/rgb2rgb_template.c
parentf9dbe8ab2a03c8843c45536589b5d4fe9546ae8d (diff)
downloadffmpeg-17b7262b4f9dca6a69dc35ac236c3407476cb21a.tar.gz
swscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix shuffle_bytes_2103_c on BE
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit abb833c5681b84d7025c083e2191140eaa30dca7) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/rgb2rgb_template.c')
-rw-r--r--libswscale/rgb2rgb_template.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
index 70294aec97..5b446debfa 100644
--- a/libswscale/rgb2rgb_template.c
+++ b/libswscale/rgb2rgb_template.c
@@ -328,6 +328,20 @@ static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst,
}
}
+static inline void shuffle_bytes_0321_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
+{
+ int idx = 15 - src_size;
+ const uint8_t *s = src - idx;
+ uint8_t *d = dst - idx;
+
+ for (; idx < 15; idx += 4) {
+ register unsigned v = *(const uint32_t *)&s[idx], g = v & 0x00ff00ff;
+ v &= 0xff00ff00;
+ *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16);
+ }
+}
+
static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
{
unsigned i;
@@ -929,7 +943,11 @@ static av_cold void rgb2rgb_init_c(void)
rgb24to15 = rgb24to15_c;
rgb24to16 = rgb24to16_c;
rgb24tobgr24 = rgb24tobgr24_c;
-#if !HAVE_BIGENDIAN
+#if HAVE_BIGENDIAN
+ shuffle_bytes_0321 = shuffle_bytes_2103_c;
+ shuffle_bytes_2103 = shuffle_bytes_0321_c;
+#else
+ shuffle_bytes_0321 = shuffle_bytes_0321_c;
shuffle_bytes_2103 = shuffle_bytes_2103_c;
#endif
rgb32tobgr16 = rgb32tobgr16_c;