[FFmpeg-devel] [PATCH] sws: factorize rgb 9+ planar funcs declarations.
Clément Bœsch
ubitux at gmail.com
Sun Apr 21 22:35:14 CEST 2013
---
libswscale/input.c | 136 +++++++++++------------------------------------------
1 file changed, 27 insertions(+), 109 deletions(-)
diff --git a/libswscale/input.c b/libswscale/input.c
index 5259603..a7b2cc2 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,33 @@ 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);
-}
-
-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);
-}
-
-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);
-}
+#define DEFINE_RGB_9PLUS_PLANAR_FUNCS(nbits) \
+static void planar_rgb##nbits##le_to_y(uint8_t *dst, const uint8_t *src[4], \
+ int w, int32_t *rgb2yuv) \
+{ \
+ planar_rgb16_to_y(dst, src, w, nbits, 0, rgb2yuv); \
+} \
+static void planar_rgb##nbits##be_to_y(uint8_t *dst, const uint8_t *src[4], \
+ int w, int32_t *rgb2yuv) \
+{ \
+ planar_rgb16_to_y(dst, src, w, nbits, 1, rgb2yuv); \
+} \
+static void planar_rgb##nbits##le_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, 0, rgb2yuv); \
+} \
+static void planar_rgb##nbits##be_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, 1, rgb2yuv); \
+} \
+
+DEFINE_RGB_9PLUS_PLANAR_FUNCS(9)
+DEFINE_RGB_9PLUS_PLANAR_FUNCS(10)
+DEFINE_RGB_9PLUS_PLANAR_FUNCS(12)
+DEFINE_RGB_9PLUS_PLANAR_FUNCS(14)
+DEFINE_RGB_9PLUS_PLANAR_FUNCS(16)
av_cold void ff_sws_init_input_funcs(SwsContext *c)
{
--
1.8.2.1
More information about the ffmpeg-devel
mailing list