diff options
author | Rachad <rachad@google.com> | 2015-03-02 17:33:02 -0800 |
---|---|---|
committer | Rachad Alao <rachad@google.com> | 2015-03-03 01:36:55 +0000 |
commit | d7e1d08c2ac21cdd2f3b7f83fec7094f6a98fc08 (patch) | |
tree | e62939f39cdb54bacedb3635ed68390a2832fb85 /media/libstagefright | |
parent | 13e71707522a212b192063acb0b221abbe618f60 (diff) | |
download | frameworks_av-d7e1d08c2ac21cdd2f3b7f83fec7094f6a98fc08.zip frameworks_av-d7e1d08c2ac21cdd2f3b7f83fec7094f6a98fc08.tar.gz frameworks_av-d7e1d08c2ac21cdd2f3b7f83fec7094f6a98fc08.tar.bz2 |
YUVImage.cpp: Fix hidden overflow error in YUV to RGB conversion
Bug: 19573730
Change-Id: I4a233d9dd49fc590df33258b6a288ad058f11f73
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/yuv/YUVImage.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/media/libstagefright/yuv/YUVImage.cpp b/media/libstagefright/yuv/YUVImage.cpp index bb3e2fd..c098135 100644 --- a/media/libstagefright/yuv/YUVImage.cpp +++ b/media/libstagefright/yuv/YUVImage.cpp @@ -374,13 +374,13 @@ uint8_t clamp(uint8_t v, uint8_t minValue, uint8_t maxValue) { void YUVImage::yuv2rgb(uint8_t yValue, uint8_t uValue, uint8_t vValue, uint8_t *r, uint8_t *g, uint8_t *b) const { - *r = yValue + (1.370705 * (vValue-128)); - *g = yValue - (0.698001 * (vValue-128)) - (0.337633 * (uValue-128)); - *b = yValue + (1.732446 * (uValue-128)); + int rTmp = yValue + (1.370705 * (vValue-128)); + int gTmp = yValue - (0.698001 * (vValue-128)) - (0.337633 * (uValue-128)); + int bTmp = yValue + (1.732446 * (uValue-128)); - *r = clamp(*r, 0, 255); - *g = clamp(*g, 0, 255); - *b = clamp(*b, 0, 255); + *r = clamp(rTmp, 0, 255); + *g = clamp(gTmp, 0, 255); + *b = clamp(bTmp, 0, 255); } bool YUVImage::writeToPPM(const char *filename) const { |