mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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>
This commit is contained in:
parent
a3e67c2d2f
commit
d48e510124
@ -286,8 +286,8 @@ static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
|
|||||||
int gsh, int bsh, int S,
|
int gsh, int bsh, int S,
|
||||||
int32_t *rgb2yuv)
|
int32_t *rgb2yuv)
|
||||||
{
|
{
|
||||||
const int ru = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, bu = rgb2yuv[BU_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] << rsh, gv = rgb2yuv[GV_IDX] << gsh, bv = rgb2yuv[BV_IDX] << 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));
|
const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
|
||||||
int i;
|
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,
|
int gsh, int bsh, int S,
|
||||||
int32_t *rgb2yuv)
|
int32_t *rgb2yuv)
|
||||||
{
|
{
|
||||||
const int ru = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, bu = rgb2yuv[BU_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] << rsh, gv = rgb2yuv[GV_IDX] << gsh, bv = rgb2yuv[BV_IDX] << bsh,
|
rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
|
||||||
maskgx = ~(maskr | maskb);
|
maskgx = ~(maskr | maskb);
|
||||||
const unsigned rnd = (256U<<(S)) + (1<<(S-6));
|
const unsigned rnd = (256U<<(S)) + (1<<(S-6));
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
Reference in New Issue
Block a user