From 395023633232cb2fbcf868003d25d5e38f535e38 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 15 Apr 2013 21:26:06 +0200 Subject: sws/x86: update RENAME(rgb24toyv12)() to using the user provided rgb2yuv table Signed-off-by: Michael Niedermayer --- libswscale/swscale_internal.h | 2 +- libswscale/utils.c | 14 ++++++++++++-- libswscale/x86/rgb2rgb_template.c | 19 +++++++++++-------- 3 files changed, 24 insertions(+), 11 deletions(-) (limited to 'libswscale') diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 3bdc92eee9..37d6900396 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -358,7 +358,7 @@ typedef struct SwsContext { uint8_t *table_gU[256 + 2*YUVRGB_TABLE_HEADROOM]; int table_gV[256 + 2*YUVRGB_TABLE_HEADROOM]; uint8_t *table_bU[256 + 2*YUVRGB_TABLE_HEADROOM]; - int32_t input_rgb2yuv_table[16+32*4]; // This table can contain both C and SIMD formatted values, teh C vales are always at the XY_IDX points + int32_t input_rgb2yuv_table[16+40*4]; // This table can contain both C and SIMD formatted values, teh C vales are always at the XY_IDX points #define RY_IDX 0 #define GY_IDX 1 #define BY_IDX 2 diff --git a/libswscale/utils.c b/libswscale/utils.c index 4025e7284f..ee522c95fc 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -834,7 +834,18 @@ static void fill_rgb2yuv_table(SwsContext *c, const int table[4], int dstRange) RV_IDX, BV_IDX, RV_IDX, BV_IDX, RV_IDX, BV_IDX, RV_IDX, BV_IDX, BV_IDX, RV_IDX, BV_IDX, RV_IDX, BV_IDX, RV_IDX, BV_IDX, RV_IDX, GV_IDX, -1 , GV_IDX, -1 , GV_IDX, -1 , GV_IDX, -1 , - -1 , GV_IDX, -1 , GV_IDX, -1 , GV_IDX, -1 , GV_IDX, + -1 , GV_IDX, -1 , GV_IDX, -1 , GV_IDX, -1 , GV_IDX, //23 + -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , //24 + -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , //25 + -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , //26 + -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , //27 + -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , //28 + -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , //29 + -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , //30 + -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , //31 + BY_IDX, GY_IDX, RY_IDX, -1 , -1 , -1 , -1 , -1 , //32 + BU_IDX, GU_IDX, RU_IDX, -1 , -1 , -1 , -1 , -1 , //33 + BV_IDX, GV_IDX, RV_IDX, -1 , -1 , -1 , -1 , -1 , //34 }; dstRange = 0; //FIXME range = 1 is handled elsewhere @@ -874,7 +885,6 @@ static void fill_rgb2yuv_table(SwsContext *c, const int table[4], int dstRange) c->input_rgb2yuv_table[RV_IDX] = ((int)(0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)); c->input_rgb2yuv_table[RU_IDX] = (-(int)(0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)); } - for(i=0; i= 0 ? c->input_rgb2yuv_table[map[i]] : 0); } diff --git a/libswscale/x86/rgb2rgb_template.c b/libswscale/x86/rgb2rgb_template.c index 68e2821b56..8998fea2d6 100644 --- a/libswscale/x86/rgb2rgb_template.c +++ b/libswscale/x86/rgb2rgb_template.c @@ -1615,6 +1615,9 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_ int lumStride, int chromStride, int srcStride, int32_t *rgb2yuv) { +#define BGR2Y_IDX "16*4+16*32" +#define BGR2U_IDX "16*4+16*33" +#define BGR2V_IDX "16*4+16*34" int y; const x86_reg chromWidth= width>>1; for (y=0; y