diff options
author | Martin Vignali <martin.vignali@gmail.com> | 2018-03-24 20:17:32 +0100 |
---|---|---|
committer | Martin Vignali <martin.vignali@gmail.com> | 2018-03-24 20:22:02 +0100 |
commit | d4f6640855faf57da1ccc3cade356975fcb00207 (patch) | |
tree | 73b0bc1e31a73e62634604b0d64ad0875262b730 /libswscale/rgb2rgb_template.c | |
parent | 923a324174c2d943b8d21d0b77fc0d0c847abca0 (diff) | |
download | ffmpeg-d4f6640855faf57da1ccc3cade356975fcb00207.tar.gz |
swscale/rgb : move shuffle func shuffle_bytes_1230, shuffle_bytes_3012, shuffle_bytes_3210 in order to add SIMD
Diffstat (limited to 'libswscale/rgb2rgb_template.c')
-rw-r--r-- | libswscale/rgb2rgb_template.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index 499d25b26d..fb7d663ccc 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -342,6 +342,24 @@ static inline void shuffle_bytes_0321_c(const uint8_t *src, uint8_t *dst, } } +#define DEFINE_SHUFFLE_BYTES(name, a, b, c, d) \ +static void shuffle_bytes_##name (const uint8_t *src, \ + uint8_t *dst, int src_size) \ +{ \ + int i; \ + \ + for (i = 0; i < src_size; i += 4) { \ + dst[i + 0] = src[i + a]; \ + dst[i + 1] = src[i + b]; \ + dst[i + 2] = src[i + c]; \ + dst[i + 3] = src[i + d]; \ + } \ +} + +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) + static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size) { unsigned i; @@ -949,6 +967,9 @@ static av_cold void rgb2rgb_init_c(void) #else shuffle_bytes_0321 = shuffle_bytes_0321_c; shuffle_bytes_2103 = shuffle_bytes_2103_c; + 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; |