1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

swscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix shuffle_bytes_2103_c on BE

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-06-23 04:36:02 +02:00
parent 7a4b8817fe
commit abb833c568
3 changed files with 21 additions and 3 deletions

View File

@ -51,6 +51,7 @@ void (*rgb16to15)(const uint8_t *src, uint8_t *dst, int src_size);
void (*rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size); void (*rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size);
void (*rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size); void (*rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size);
void (*shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size);
void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size); void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc,
@ -333,7 +334,6 @@ void shuffle_bytes_ ## a ## b ## c ## d(const uint8_t *src, \
} \ } \
} }
DEFINE_SHUFFLE_BYTES(0, 3, 2, 1)
DEFINE_SHUFFLE_BYTES(1, 2, 3, 0) DEFINE_SHUFFLE_BYTES(1, 2, 3, 0)
DEFINE_SHUFFLE_BYTES(3, 0, 1, 2) DEFINE_SHUFFLE_BYTES(3, 0, 1, 2)
DEFINE_SHUFFLE_BYTES(3, 2, 1, 0) DEFINE_SHUFFLE_BYTES(3, 2, 1, 0)

View File

@ -50,6 +50,7 @@ extern void (*rgb24to15)(const uint8_t *src, uint8_t *dst, int src_size);
extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size); extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size);
extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size); extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
extern void (*shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size);
extern void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size); extern void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
void rgb64tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size); void rgb64tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
@ -71,7 +72,6 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size);
void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size); void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size);
void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size); void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size);
void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, int src_size);
void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, int src_size); void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, int src_size);
void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, int src_size); void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, int src_size);
void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, int src_size); void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, int src_size);

View File

@ -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) static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
{ {
unsigned i; unsigned i;
@ -929,7 +943,11 @@ static av_cold void rgb2rgb_init_c(void)
rgb24to15 = rgb24to15_c; rgb24to15 = rgb24to15_c;
rgb24to16 = rgb24to16_c; rgb24to16 = rgb24to16_c;
rgb24tobgr24 = rgb24tobgr24_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; shuffle_bytes_2103 = shuffle_bytes_2103_c;
#endif #endif
rgb32tobgr16 = rgb32tobgr16_c; rgb32tobgr16 = rgb32tobgr16_c;