From afd2102f43586916092836a793f46a7131dc2eee Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Wed, 18 Apr 2012 11:31:07 +0000 Subject: [PATCH] Fix cross-color transform in lossless encoder make elements of "Multiplier" struct unsigned, so that any negative values are automatically converted to "mod 256" values. Change-Id: Iab4f9bacc50dcd94a557944727d9338dbb0982f7 --- src/dsp/lossless.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dsp/lossless.c b/src/dsp/lossless.c index 6a7fee33..c05f6d46 100644 --- a/src/dsp/lossless.c +++ b/src/dsp/lossless.c @@ -557,9 +557,11 @@ static void AddGreenToBlueAndRed(const VP8LTransform* const transform, } typedef struct { - int green_to_red_; - int green_to_blue_; - int red_to_blue_; + // Note: the members are uint8_t, so that any negative values are + // automatically converted to "mod 256" values. + uint8_t green_to_red_; + uint8_t green_to_blue_; + uint8_t red_to_blue_; } Multipliers; static WEBP_INLINE void MultipliersClear(Multipliers* m) {