aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-01-21 22:52:19 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-03 12:10:23 +0200
commitcfd165dda7c0914de592a9d13efdb5640ae8ee8e (patch)
tree25cbb16b94eb5f8f77a4c6f76740240b3e166bb6
parentf541744f735d0773177f40da81e64f3401cadbc1 (diff)
downloadffmpeg-cfd165dda7c0914de592a9d13efdb5640ae8ee8e.tar.gz
swscale/input: Fix several invalid shifts related to rgb2yuv constants
Fixes: Invalid shifts Fixes: #8140 Fixes: #8146 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit d48e510124d0fea24e2ec27271687c92e4428a18) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libswscale/input.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libswscale/input.c b/libswscale/input.c
index 4099c19c2b..172f5b2b0f 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -286,8 +286,8 @@ static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
int gsh, int bsh, int S,
int32_t *rgb2yuv)
{
- const int ru = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, bu = rgb2yuv[BU_IDX] << bsh,
- rv = rgb2yuv[RV_IDX] << rsh, gv = rgb2yuv[GV_IDX] << gsh, bv = rgb2yuv[BV_IDX] << bsh;
+ const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
+ rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
int i;
@@ -314,8 +314,8 @@ static av_always_inline void rgb16_32ToUV_half_c_template(int16_t *dstU,
int gsh, int bsh, int S,
int32_t *rgb2yuv)
{
- const int ru = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, bu = rgb2yuv[BU_IDX] << bsh,
- rv = rgb2yuv[RV_IDX] << rsh, gv = rgb2yuv[GV_IDX] << gsh, bv = rgb2yuv[BV_IDX] << bsh,
+ const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
+ rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
maskgx = ~(maskr | maskb);
const unsigned rnd = (256U<<(S)) + (1<<(S-6));
int i;