mirror of https://git.ffmpeg.org/ffmpeg.git
swscale/rgb : move shuffle func shuffle_bytes_1230, shuffle_bytes_3012, shuffle_bytes_3210 in order to add SIMD
This commit is contained in:
parent
923a324174
commit
d4f6640855
|
@ -53,6 +53,10 @@ 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_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_3210)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
||||
|
||||
void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc,
|
||||
const uint8_t *vsrc, uint8_t *dst,
|
||||
|
@ -319,25 +323,6 @@ void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#define DEFINE_SHUFFLE_BYTES(a, b, c, d) \
|
||||
void shuffle_bytes_ ## a ## b ## c ## d(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(1, 2, 3, 0)
|
||||
DEFINE_SHUFFLE_BYTES(3, 0, 1, 2)
|
||||
DEFINE_SHUFFLE_BYTES(3, 2, 1, 0)
|
||||
|
||||
#define DEFINE_RGB48TOBGR48(need_bswap, swap) \
|
||||
void rgb48tobgr48_ ## need_bswap(const uint8_t *src, \
|
||||
uint8_t *dst, int src_size) \
|
||||
|
|
|
@ -76,9 +76,9 @@ 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 rgb12to15(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_3210(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
extern void (*shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
extern void (*shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
extern void (*shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
||||
void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
|
||||
uint8_t *vdst, int width, int height, int lumStride,
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue