diff --git a/libswscale/input.c b/libswscale/input.c index 5259603fb4..21dfeca573 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -755,56 +755,6 @@ static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_sr } } -static void planar_rgb9le_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 9, 0, rgb2yuv); -} - -static void planar_rgb9be_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 9, 1, rgb2yuv); -} - -static void planar_rgb10le_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 10, 0, rgb2yuv); -} - -static void planar_rgb10be_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 10, 1, rgb2yuv); -} - -static void planar_rgb12le_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 12, 0, rgb2yuv); -} - -static void planar_rgb12be_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 12, 1, rgb2yuv); -} - -static void planar_rgb14le_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 14, 0, rgb2yuv); -} - -static void planar_rgb14be_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 14, 1, rgb2yuv); -} - -static void planar_rgb16le_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 16, 0, rgb2yuv); -} - -static void planar_rgb16be_to_y(uint8_t *dst, const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_y(dst, src, w, 16, 1, rgb2yuv); -} - static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width, int bpc, int is_be, int32_t *rgb2yuv) @@ -826,65 +776,27 @@ static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV, } #undef rdpx -static void planar_rgb9le_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 9, 0, rgb2yuv); -} +#define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \ +static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \ + int w, int32_t *rgb2yuv) \ +{ \ + planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \ +} \ +static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \ + const uint8_t *src[4], int w, int32_t *rgb2yuv) \ +{ \ + planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \ +} \ -static void planar_rgb9be_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 9, 1, rgb2yuv); -} +#define rgb9plus_planar_funcs(nbits) \ + rgb9plus_planar_funcs_endian(nbits, le, 0) \ + rgb9plus_planar_funcs_endian(nbits, be, 1) -static void planar_rgb10le_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 10, 0, rgb2yuv); -} - -static void planar_rgb10be_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 10, 1, rgb2yuv); -} - -static void planar_rgb12le_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 12, 0, rgb2yuv); -} - -static void planar_rgb12be_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 12, 1, rgb2yuv); -} - -static void planar_rgb14le_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 14, 0, rgb2yuv); -} - -static void planar_rgb14be_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 14, 1, rgb2yuv); -} - -static void planar_rgb16le_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 16, 0, rgb2yuv); -} - -static void planar_rgb16be_to_uv(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src[4], int w, int32_t *rgb2yuv) -{ - planar_rgb16_to_uv(dstU, dstV, src, w, 16, 1, rgb2yuv); -} +rgb9plus_planar_funcs(9) +rgb9plus_planar_funcs(10) +rgb9plus_planar_funcs(12) +rgb9plus_planar_funcs(14) +rgb9plus_planar_funcs(16) av_cold void ff_sws_init_input_funcs(SwsContext *c) {