Commit efbf1575 authored by Frank Barchard's avatar Frank Barchard Committed by Commit Bot

Step thru full color test by increments of 5 for better test speed.

Full color test is the slowest of the unittests, and not catching any
additional bugs at the moment.  Step thru range of 0 to 255 in steps of
5 to speed up the test.  255 is 3 * 5 * 17, so any of those primes would
hit 0 and 255 exactly.

Was LibYUVColorTest.TestFullYUV (896 ms)
Now LibYUVColorTest.TestFullYUV (212 ms)

TBR=kjellander@chromium.org
Bug: libyuv:736
Test: LibYUVColorTest.TestFullYUV
Change-Id: I5b55fb07ada0dc7bdc3c3c20569d36bf09bb3804
Reviewed-on: https://chromium-review.googlesource.com/672064
Commit-Queue: Frank Barchard <fbarchard@google.com>
Reviewed-by: 's avatarFrank Barchard <fbarchard@google.com>
parent 3886069d
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 1670 Version: 1671
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ #ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1670 #define LIBYUV_VERSION 1671
#endif // INCLUDE_LIBYUV_VERSION_H_ #endif // INCLUDE_LIBYUV_VERSION_H_
...@@ -124,7 +124,7 @@ void CpuId(int eax, int ecx, int* cpu_info) { ...@@ -124,7 +124,7 @@ void CpuId(int eax, int ecx, int* cpu_info) {
int GetXCR0() { int GetXCR0() {
int xcr0 = 0; int xcr0 = 0;
#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160040219) #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160040219)
xcr0 = (int) _xgetbv(0); // VS2010 SP1 required. NOLINT xcr0 = (int)_xgetbv(0); // VS2010 SP1 required. NOLINT
#elif defined(__i386__) || defined(__x86_64__) #elif defined(__i386__) || defined(__x86_64__)
asm(".byte 0x0f, 0x01, 0xd0" : "=a"(xcr0) : "c"(0) : "%edx"); asm(".byte 0x0f, 0x01, 0xd0" : "=a"(xcr0) : "c"(0) : "%edx");
#endif // defined(__i386__) || defined(__x86_64__) #endif // defined(__i386__) || defined(__x86_64__)
......
...@@ -471,21 +471,22 @@ static void PrintHistogram(int rh[256], int gh[256], int bh[256]) { ...@@ -471,21 +471,22 @@ static void PrintHistogram(int rh[256], int gh[256], int bh[256]) {
printf("\n"); printf("\n");
} }
// Step by 5 on inner loop goes from 0 to 255 inclusive.
// Set to 1 for better converage. 3, 5 or 17 for faster testing.
#define FASTSTEP 5
TEST_F(LibYUVColorTest, TestFullYUV) { TEST_F(LibYUVColorTest, TestFullYUV) {
int rh[256] = int rh[256] = {
{
0, 0,
}, };
gh[256] = int gh[256] = {
{
0, 0,
}, };
bh[256] = { int bh[256] = {
0, 0,
}; };
for (int u = 0; u < 256; ++u) { for (int u = 0; u < 256; ++u) {
for (int v = 0; v < 256; ++v) { for (int v = 0; v < 256; ++v) {
for (int y2 = 0; y2 < 256; ++y2) { for (int y2 = 0; y2 < 256; y2 += FASTSTEP) {
int r0, g0, b0, r1, g1, b1; int r0, g0, b0, r1, g1, b1;
int y = RANDOM256(y2); int y = RANDOM256(y2);
YUVToRGBReference(y, u, v, &r0, &g0, &b0); YUVToRGBReference(y, u, v, &r0, &g0, &b0);
...@@ -503,20 +504,18 @@ TEST_F(LibYUVColorTest, TestFullYUV) { ...@@ -503,20 +504,18 @@ TEST_F(LibYUVColorTest, TestFullYUV) {
} }
TEST_F(LibYUVColorTest, TestFullYUVJ) { TEST_F(LibYUVColorTest, TestFullYUVJ) {
int rh[256] = int rh[256] = {
{
0, 0,
}, };
gh[256] = int gh[256] = {
{
0, 0,
}, };
bh[256] = { int bh[256] = {
0, 0,
}; };
for (int u = 0; u < 256; ++u) { for (int u = 0; u < 256; ++u) {
for (int v = 0; v < 256; ++v) { for (int v = 0; v < 256; ++v) {
for (int y2 = 0; y2 < 256; ++y2) { for (int y2 = 0; y2 < 256; y2 += FASTSTEP) {
int r0, g0, b0, r1, g1, b1; int r0, g0, b0, r1, g1, b1;
int y = RANDOM256(y2); int y = RANDOM256(y2);
YUVJToRGBReference(y, u, v, &r0, &g0, &b0); YUVJToRGBReference(y, u, v, &r0, &g0, &b0);
...@@ -532,6 +531,7 @@ TEST_F(LibYUVColorTest, TestFullYUVJ) { ...@@ -532,6 +531,7 @@ TEST_F(LibYUVColorTest, TestFullYUVJ) {
} }
PrintHistogram(rh, gh, bh); PrintHistogram(rh, gh, bh);
} }
#undef FASTSTEP
TEST_F(LibYUVColorTest, TestGreyYUVJ) { TEST_F(LibYUVColorTest, TestGreyYUVJ) {
int r0, g0, b0, r1, g1, b1, r2, g2, b2; int r0, g0, b0, r1, g1, b1, r2, g2, 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