diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-15 00:49:00 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-15 01:31:01 +0200 |
commit | 17ad06c753576a444e85761e5dc389cb980afaf8 (patch) | |
tree | 12870a6033dd89ac17fc0296660786e8f399f185 /libswscale/utils.c | |
parent | 9aafb95ae23095343601baa852043fe77aeeb903 (diff) | |
download | ffmpeg-17ad06c753576a444e85761e5dc389cb980afaf8.tar.gz |
sws/x86: update rgb/bgr->yuv code to use provided coefficient table
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r-- | libswscale/utils.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index 98ba283eb3..ce2604b225 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -808,6 +808,22 @@ static void fill_rgb2yuv_table(SwsContext *c, const int table[4], int dstRange) int64_t vg = -table[3]; int64_t ONE = 65536; int64_t cy = ONE; + uint8_t *p = (uint8_t*)c->input_rgb2yuv_table; + int i; + static const int8_t map[] = { + BY_IDX, GY_IDX, -1 , BY_IDX, BY_IDX, GY_IDX, -1 , BY_IDX, + RY_IDX, -1 , GY_IDX, RY_IDX, RY_IDX, -1 , GY_IDX, RY_IDX, + RY_IDX, GY_IDX, -1 , RY_IDX, RY_IDX, GY_IDX, -1 , RY_IDX, + BY_IDX, -1 , GY_IDX, BY_IDX, BY_IDX, -1 , GY_IDX, BY_IDX, + BU_IDX, GU_IDX, -1 , BU_IDX, BU_IDX, GU_IDX, -1 , BU_IDX, + RU_IDX, -1 , GU_IDX, RU_IDX, RU_IDX, -1 , GU_IDX, RU_IDX, + RU_IDX, GU_IDX, -1 , RU_IDX, RU_IDX, GU_IDX, -1 , RU_IDX, + BU_IDX, -1 , GU_IDX, BU_IDX, BU_IDX, -1 , GU_IDX, BU_IDX, + BV_IDX, GV_IDX, -1 , BV_IDX, BV_IDX, GV_IDX, -1 , BV_IDX, + RV_IDX, -1 , GV_IDX, RV_IDX, RV_IDX, -1 , GV_IDX, RV_IDX, + RV_IDX, GV_IDX, -1 , RV_IDX, RV_IDX, GV_IDX, -1 , RV_IDX, + BV_IDX, -1 , GV_IDX, BV_IDX, BV_IDX, -1 , GV_IDX, BV_IDX, + }; dstRange = 0; //FIXME range = 1 is handled elsewhere @@ -846,6 +862,9 @@ 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<FF_ARRAY_ELEMS(map); i++) + AV_WL16(p + 16*4 + 2*i, map[i] >= 0 ? c->input_rgb2yuv_table[map[i]] : 0); } int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], |