[FFmpeg-cvslog] swscale: fix overflows in RGB rounding constants.
Ronald S. Bultje
git at videolan.org
Sun Dec 18 03:12:21 CET 2011
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Dec 16 00:03:57 2011 +0000| [4391805916a1557278351f25428d0145b1073520] | committer: Mans Rullgard
swscale: fix overflows in RGB rounding constants.
Signed-off-by: Mans Rullgard <mans at mansr.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4391805916a1557278351f25428d0145b1073520
---
libswscale/swscale.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 116f780..f072378 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1456,8 +1456,8 @@ rgb16_32ToY_c_template(uint8_t *dst, const uint8_t *src,
int maskr, int maskg, int maskb,
int rsh, int gsh, int bsh, int S)
{
- const int ry = RY << rsh, gy = GY << gsh, by = BY << bsh,
- rnd = 33 << (S - 1);
+ const int ry = RY << rsh, gy = GY << gsh, by = BY << bsh;
+ const unsigned rnd = 33u << (S - 1);
int i;
for (i = 0; i < width; i++) {
@@ -1479,8 +1479,8 @@ rgb16_32ToUV_c_template(uint8_t *dstU, uint8_t *dstV,
int rsh, int gsh, int bsh, int S)
{
const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh,
- rv = RV << rsh, gv = GV << gsh, bv = BV << bsh,
- rnd = 257 << (S - 1);
+ rv = RV << rsh, gv = GV << gsh, bv = BV << bsh;
+ const unsigned rnd = 257u << (S - 1);
int i;
for (i = 0; i < width; i++) {
@@ -1504,7 +1504,8 @@ rgb16_32ToUV_half_c_template(uint8_t *dstU, uint8_t *dstV,
{
const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh,
rv = RV << rsh, gv = GV << gsh, bv = BV << bsh,
- rnd = 257 << S, maskgx = ~(maskr | maskb);
+ maskgx = ~(maskr | maskb);
+ const unsigned rnd = 257u << S;
int i;
maskr |= maskr << 1; maskb |= maskb << 1; maskg |= maskg << 1;
More information about the ffmpeg-cvslog
mailing list