aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-16 11:13:20 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-16 11:13:20 +0200
commit2fa11a94a312aa072d7d14204a09582950bebccb (patch)
tree46ffa4ab8cb987a84fe01a092ebb0988d2224532
parent97b2865aa27c1e50885338e594eff8af374fb41c (diff)
downloadffmpeg-2fa11a94a312aa072d7d14204a09582950bebccb.tar.gz
sws/fill_rgb2yuv_table: avoid 2 divisions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libswscale/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index ee522c95fc..71e85e010f 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -868,9 +868,9 @@ static void fill_rgb2yuv_table(SwsContext *c, const int table[4], int dstRange)
c->input_rgb2yuv_table[RU_IDX] = (1 << RGB2YUV_SHIFT)*ONE*V/(Z*ub);
c->input_rgb2yuv_table[GU_IDX] = -(1 << RGB2YUV_SHIFT)*ONE*ONE/(Z*ub);
- c->input_rgb2yuv_table[BU_IDX] = (1 << RGB2YUV_SHIFT)*(ONE + ONE*W/Z)/ub;
+ c->input_rgb2yuv_table[BU_IDX] = (1 << RGB2YUV_SHIFT)*ONE*(Z+W)/(Z*ub);
- c->input_rgb2yuv_table[RV_IDX] = (1 << RGB2YUV_SHIFT)*(ONE + ONE*V/Z)/vr;
+ c->input_rgb2yuv_table[RV_IDX] = (1 << RGB2YUV_SHIFT)*ONE*(V+Z)/(Z*vr);
c->input_rgb2yuv_table[GV_IDX] = -(1 << RGB2YUV_SHIFT)*ONE*ONE/(Z*vr);
c->input_rgb2yuv_table[BV_IDX] = (1 << RGB2YUV_SHIFT)*ONE*W/(Z*vr);