Make color_test using if statements for clamping values from 0 to 255.

BUG=none
TESTED=libyuvTest.TestFullYUV

Review URL: https://webrtc-codereview.appspot.com/47479004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1316 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
fbarchard@google.com 2015-03-10 01:51:01 +00:00
parent 24152b2435
commit 1d87532f00

View File

@ -185,7 +185,13 @@ static void YToRGB(int y, int* r, int* g, int* b) {
static int RoundToByte(double f) {
int i = static_cast<int>(f + 0.5);
return (i & ~0xff) ? (int)(((int32)(-i) >> 31) & 0xff) : i;
if (i < 0) {
i = 0;
}
if (i > 255) {
i = 255;
}
return i;
}
static void YUVToRGBReference(int y, int u, int v, int* r, int* g, int* b) {