Commit f0845348 authored by fbarchard@google.com's avatar fbarchard@google.com

Add a test for YToARGB to match exactly I420ToARGB

BUG=392
TESTED=TestGreyYUV
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1252 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 29db9b0b
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1251
Version: 1252
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1251
#define LIBYUV_VERSION 1252
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -161,6 +161,25 @@ static void YUVToRGB(int y, int u, int v, int* r, int* g, int* b) {
*r = orig_pixels[2];
}
static void YToRGB(int y, int* r, int* g, int* b) {
const int kWidth = 16;
const int kHeight = 1;
const int kPixels = kWidth * kHeight;
SIMD_ALIGNED(uint8 orig_y[16]);
SIMD_ALIGNED(uint8 orig_pixels[16 * 1 * 4]);
memset(orig_y, y, kPixels);
/* YUV converted to ARGB. */
YToARGB(orig_y, kWidth,
orig_pixels, kWidth * 4,
kWidth, kHeight);
*b = orig_pixels[0];
*g = orig_pixels[1];
*r = orig_pixels[2];
}
static int RoundToByte(double f) {
int i = lrintf(f);
if (i < 0) {
......@@ -259,13 +278,17 @@ TEST_F(libyuvTest, TestYUV) {
}
TEST_F(libyuvTest, TestGreyYUV) {
int r0, g0, b0, r1, g1, b1;
int r0, g0, b0, r1, g1, b1, r2, g2, b2;
for (int y = 0; y < 256; ++y) {
YUVToRGBReference(y, 128, 128, &r0, &g0, &b0);
YUVToRGB(y, 128, 128, &r1, &g1, &b1);
YToRGB(y, &r2, &g2, &b2);
EXPECT_NEAR(r0, r1, ERROR_R);
EXPECT_NEAR(g0, g1, ERROR_G);
EXPECT_NEAR(b0, b1, ERROR_B);
EXPECT_EQ(r1, r2);
EXPECT_EQ(g1, g2);
EXPECT_EQ(b1, b2);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment