Commit 26db4de2 authored by Frank Barchard's avatar Frank Barchard

break up unittests into categories

R=harryjin@google.com
BUG=none

Review URL: https://codereview.chromium.org/1399523004 .
parent be4d445e
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1507
Version: 1508
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1507
#define LIBYUV_VERSION 1508
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -13,7 +13,7 @@
namespace libyuv {
TEST_F(libyuvTest, Endian) {
TEST_F(LibYUVBaseTest, Endian) {
uint16 v16 = 0x1234u;
uint8 first_byte = *reinterpret_cast<uint8*>(&v16);
#if defined(LIBYUV_LITTLE_ENDIAN)
......@@ -23,7 +23,7 @@ TEST_F(libyuvTest, Endian) {
#endif
}
TEST_F(libyuvTest, SizeOfTypes) {
TEST_F(LibYUVBaseTest, SizeOfTypes) {
int8 i8 = -1;
uint8 u8 = 1u;
int16 i16 = -1;
......@@ -50,7 +50,7 @@ TEST_F(libyuvTest, SizeOfTypes) {
EXPECT_LT(0u, u64);
}
TEST_F(libyuvTest, SizeOfConstants) {
TEST_F(LibYUVBaseTest, SizeOfConstants) {
EXPECT_EQ(8u, sizeof(INT64_C(0)));
EXPECT_EQ(8u, sizeof(UINT64_C(0)));
EXPECT_EQ(8u, sizeof(INT64_C(0x1234567887654321)));
......
......@@ -37,7 +37,7 @@ namespace libyuv {
#endif
#define TESTCS(TESTNAME, YUVTOARGB, ARGBTOYUV, HS1, HS, HN, DIFF) \
TEST_F(libyuvTest, TESTNAME) { \
TEST_F(LibYUVConvertTest, TESTNAME) { \
const int kPixels = benchmark_width_ * benchmark_height_; \
const int kHalfPixels = ((benchmark_width_ + 1) / 2) * \
((benchmark_height_ + HS1) / HS); \
......@@ -312,7 +312,7 @@ static int RoundToByte(float f) {
#define RANDOM256(s) ((s & 1) ? ((s >> 1) ^ 0xb8) : (s >> 1))
TEST_F(libyuvTest, TestRoundToByte) {
TEST_F(LibYUVConvertTest, TestRoundToByte) {
int allb = 0;
int count = benchmark_width_ * benchmark_height_;
for (int i = 0; i < benchmark_iterations_; ++i) {
......@@ -339,7 +339,7 @@ static void YUVJToRGBReference(int y, int u, int v, int* r, int* g, int* b) {
*b = RoundToByte(y - (u - 128) * -1.77200);
}
TEST_F(libyuvTest, TestYUV) {
TEST_F(LibYUVConvertTest, TestYUV) {
int r0, g0, b0, r1, g1, b1;
// cyan (less red)
......@@ -385,7 +385,7 @@ TEST_F(libyuvTest, TestYUV) {
}
}
TEST_F(libyuvTest, TestGreyYUV) {
TEST_F(LibYUVConvertTest, TestGreyYUV) {
int r0, g0, b0, r1, g1, b1, r2, g2, b2;
// black
......@@ -464,7 +464,7 @@ static void PrintHistogram(int rh[256], int gh[256], int bh[256]) {
printf("\n");
}
TEST_F(libyuvTest, TestFullYUV) {
TEST_F(LibYUVConvertTest, TestFullYUV) {
int rh[256] = { 0, }, gh[256] = { 0, }, bh[256] = { 0, };
for (int u = 0; u < 256; ++u) {
for (int v = 0; v < 256; ++v) {
......@@ -485,7 +485,7 @@ TEST_F(libyuvTest, TestFullYUV) {
PrintHistogram(rh, gh, bh);
}
TEST_F(libyuvTest, TestFullYUVJ) {
TEST_F(LibYUVConvertTest, TestFullYUVJ) {
int rh[256] = { 0, }, gh[256] = { 0, }, bh[256] = { 0, };
for (int u = 0; u < 256; ++u) {
for (int v = 0; v < 256; ++v) {
......@@ -506,7 +506,7 @@ TEST_F(libyuvTest, TestFullYUVJ) {
PrintHistogram(rh, gh, bh);
}
TEST_F(libyuvTest, TestGreyYUVJ) {
TEST_F(LibYUVConvertTest, TestGreyYUVJ) {
int r0, g0, b0, r1, g1, b1, r2, g2, b2;
// black
......
......@@ -32,7 +32,7 @@ static uint32 ReferenceHashDjb2(const uint8* src, uint64 count, uint32 seed) {
return hash;
}
TEST_F(libyuvTest, Djb2_Test) {
TEST_F(LibYUVBaseTest, Djb2_Test) {
const int kMaxTest = benchmark_width_ * benchmark_height_;
align_buffer_64(src_a, kMaxTest);
align_buffer_64(src_b, kMaxTest);
......@@ -116,7 +116,7 @@ TEST_F(libyuvTest, Djb2_Test) {
free_aligned_buffer_64(src_b);
}
TEST_F(libyuvTest, BenchmarkDjb2_Opt) {
TEST_F(LibYUVBaseTest, BenchmarkDjb2_Opt) {
const int kMaxTest = benchmark_width_ * benchmark_height_;
align_buffer_64(src_a, kMaxTest);
......@@ -132,7 +132,7 @@ TEST_F(libyuvTest, BenchmarkDjb2_Opt) {
free_aligned_buffer_64(src_a);
}
TEST_F(libyuvTest, BenchmarkDjb2_Unaligned) {
TEST_F(LibYUVBaseTest, BenchmarkDjb2_Unaligned) {
const int kMaxTest = benchmark_width_ * benchmark_height_;
align_buffer_64(src_a, kMaxTest + 1);
for (int i = 0; i < kMaxTest; ++i) {
......@@ -147,7 +147,7 @@ TEST_F(libyuvTest, BenchmarkDjb2_Unaligned) {
free_aligned_buffer_64(src_a);
}
TEST_F(libyuvTest, BenchmarkARGBDetect_Opt) {
TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Opt) {
uint32 fourcc;
const int kMaxTest = benchmark_width_ * benchmark_height_ * 4;
align_buffer_64(src_a, kMaxTest);
......@@ -175,7 +175,7 @@ TEST_F(libyuvTest, BenchmarkARGBDetect_Opt) {
free_aligned_buffer_64(src_a);
}
TEST_F(libyuvTest, BenchmarkARGBDetect_Unaligned) {
TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Unaligned) {
uint32 fourcc;
const int kMaxTest = benchmark_width_ * benchmark_height_ * 4 + 1;
align_buffer_64(src_a, kMaxTest);
......@@ -202,7 +202,7 @@ TEST_F(libyuvTest, BenchmarkARGBDetect_Unaligned) {
free_aligned_buffer_64(src_a);
}
TEST_F(libyuvTest, BenchmarkSumSquareError_Opt) {
TEST_F(LibYUVBaseTest, BenchmarkSumSquareError_Opt) {
const int kMaxWidth = 4096 * 3;
align_buffer_64(src_a, kMaxWidth);
align_buffer_64(src_b, kMaxWidth);
......@@ -233,7 +233,7 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_Opt) {
free_aligned_buffer_64(src_b);
}
TEST_F(libyuvTest, SumSquareError) {
TEST_F(LibYUVBaseTest, SumSquareError) {
const int kMaxWidth = 4096 * 3;
align_buffer_64(src_a, kMaxWidth);
align_buffer_64(src_b, kMaxWidth);
......@@ -273,7 +273,7 @@ TEST_F(libyuvTest, SumSquareError) {
free_aligned_buffer_64(src_b);
}
TEST_F(libyuvTest, BenchmarkPsnr_Opt) {
TEST_F(LibYUVBaseTest, BenchmarkPsnr_Opt) {
align_buffer_64(src_a, benchmark_width_ * benchmark_height_);
align_buffer_64(src_b, benchmark_width_ * benchmark_height_);
for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
......@@ -298,7 +298,7 @@ TEST_F(libyuvTest, BenchmarkPsnr_Opt) {
free_aligned_buffer_64(src_b);
}
TEST_F(libyuvTest, BenchmarkPsnr_Unaligned) {
TEST_F(LibYUVBaseTest, BenchmarkPsnr_Unaligned) {
align_buffer_64(src_a, benchmark_width_ * benchmark_height_ + 1);
align_buffer_64(src_b, benchmark_width_ * benchmark_height_);
for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
......@@ -323,7 +323,7 @@ TEST_F(libyuvTest, BenchmarkPsnr_Unaligned) {
free_aligned_buffer_64(src_b);
}
TEST_F(libyuvTest, Psnr) {
TEST_F(LibYUVBaseTest, Psnr) {
const int kSrcWidth = benchmark_width_;
const int kSrcHeight = benchmark_height_;
const int b = 128;
......@@ -400,7 +400,7 @@ TEST_F(libyuvTest, Psnr) {
free_aligned_buffer_64(src_b);
}
TEST_F(libyuvTest, DISABLED_BenchmarkSsim_Opt) {
TEST_F(LibYUVBaseTest, DISABLED_BenchmarkSsim_Opt) {
align_buffer_64(src_a, benchmark_width_ * benchmark_height_);
align_buffer_64(src_b, benchmark_width_ * benchmark_height_);
for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
......@@ -425,7 +425,7 @@ TEST_F(libyuvTest, DISABLED_BenchmarkSsim_Opt) {
free_aligned_buffer_64(src_b);
}
TEST_F(libyuvTest, Ssim) {
TEST_F(LibYUVBaseTest, Ssim) {
const int kSrcWidth = benchmark_width_;
const int kSrcHeight = benchmark_height_;
const int b = 128;
......
This diff is collapsed.
......@@ -19,7 +19,7 @@
namespace libyuv {
TEST_F(libyuvTest, TestCpuHas) {
TEST_F(LibYUVBaseTest, TestCpuHas) {
int cpu_flags = TestCpuFlag(-1);
printf("Cpu Flags %x\n", cpu_flags);
int has_arm = TestCpuFlag(kCpuHasARM);
......@@ -52,7 +52,7 @@ TEST_F(libyuvTest, TestCpuHas) {
printf("Has MIPS DSPR2 %x\n", has_mips_dspr2);
}
TEST_F(libyuvTest, TestCompilerHasAVX2) {
TEST_F(LibYUVBaseTest, TestCompilerHasAVX2) {
#ifdef _MSC_VER
printf("_MSC_VER %d\n", _MSC_VER);
#endif
......@@ -74,7 +74,7 @@ printf("_MSC_VER %d\n", _MSC_VER);
#if defined(__i386__) || defined(__x86_64__) || \
defined(_M_IX86) || defined(_M_X64)
TEST_F(libyuvTest, TestCpuId) {
TEST_F(LibYUVBaseTest, TestCpuId) {
int has_x86 = TestCpuFlag(kCpuHasX86);
if (has_x86) {
uint32 cpu_info[4];
......@@ -122,7 +122,7 @@ static int FileExists(const char* file_name) {
return 1;
}
TEST_F(libyuvTest, TestLinuxNeon) {
TEST_F(LibYUVBaseTest, TestLinuxNeon) {
if (FileExists("../../unit_test/testdata/arm_v7.txt")) {
EXPECT_EQ(0, ArmCpuCaps("../../unit_test/testdata/arm_v7.txt"));
EXPECT_EQ(kCpuHasNEON, ArmCpuCaps("../../unit_test/testdata/tegra3.txt"));
......
......@@ -21,7 +21,7 @@
namespace libyuv {
TEST_F(libyuvTest, TestFixedDiv) {
TEST_F(LibYUVBaseTest, TestFixedDiv) {
int num[1280];
int div[1280];
int result_opt[1280];
......@@ -85,7 +85,7 @@ TEST_F(libyuvTest, TestFixedDiv) {
}
}
TEST_F(libyuvTest, TestFixedDiv_Opt) {
TEST_F(LibYUVBaseTest, TestFixedDiv_Opt) {
int num[1280];
int div[1280];
int result_opt[1280];
......@@ -119,7 +119,7 @@ TEST_F(libyuvTest, TestFixedDiv_Opt) {
}
}
TEST_F(libyuvTest, TestFixedDiv1_Opt) {
TEST_F(LibYUVBaseTest, TestFixedDiv1_Opt) {
int num[1280];
int div[1280];
int result_opt[1280];
......
This diff is collapsed.
......@@ -93,49 +93,49 @@ static void ARGBTestRotate(int src_width, int src_height,
mode, benchmark_iterations, disable_cpu_flags, 4);
}
TEST_F(libyuvTest, ARGBRotate0) {
TEST_F(LibYUVRotateTest, ARGBRotate0) {
ARGBTestRotate(benchmark_width_, benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, ARGBRotate90) {
TEST_F(LibYUVRotateTest, ARGBRotate90) {
ARGBTestRotate(benchmark_width_, benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, ARGBRotate180) {
TEST_F(LibYUVRotateTest, ARGBRotate180) {
ARGBTestRotate(benchmark_width_, benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, ARGBRotate270) {
TEST_F(LibYUVRotateTest, ARGBRotate270) {
ARGBTestRotate(benchmark_width_, benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, ARGBRotate0_Odd) {
TEST_F(LibYUVRotateTest, ARGBRotate0_Odd) {
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_width_ - 3, benchmark_height_ - 1,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, ARGBRotate90_Odd) {
TEST_F(LibYUVRotateTest, ARGBRotate90_Odd) {
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_height_ - 1, benchmark_width_ - 3,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, ARGBRotate180_Odd) {
TEST_F(LibYUVRotateTest, ARGBRotate180_Odd) {
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_width_ - 3, benchmark_height_ - 1,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, ARGBRotate270_Odd) {
TEST_F(LibYUVRotateTest, ARGBRotate270_Odd) {
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_height_ - 1, benchmark_width_ - 3,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
......@@ -150,49 +150,49 @@ static void TestRotatePlane(int src_width, int src_height,
mode, benchmark_iterations, disable_cpu_flags, 1);
}
TEST_F(libyuvTest, RotatePlane0) {
TEST_F(LibYUVRotateTest, RotatePlane0) {
TestRotatePlane(benchmark_width_, benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, RotatePlane90) {
TEST_F(LibYUVRotateTest, RotatePlane90) {
TestRotatePlane(benchmark_width_, benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, RotatePlane180) {
TEST_F(LibYUVRotateTest, RotatePlane180) {
TestRotatePlane(benchmark_width_, benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, RotatePlane270) {
TEST_F(LibYUVRotateTest, RotatePlane270) {
TestRotatePlane(benchmark_width_, benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, RotatePlane0_Odd) {
TEST_F(LibYUVRotateTest, RotatePlane0_Odd) {
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_width_ - 3, benchmark_height_ - 1,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, RotatePlane90_Odd) {
TEST_F(LibYUVRotateTest, RotatePlane90_Odd) {
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_height_ - 1, benchmark_width_ - 3,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, RotatePlane180_Odd) {
TEST_F(LibYUVRotateTest, RotatePlane180_Odd) {
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_width_ - 3, benchmark_height_ - 1,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, RotatePlane270_Odd) {
TEST_F(LibYUVRotateTest, RotatePlane270_Odd) {
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_height_ - 1, benchmark_width_ - 3,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
......
......@@ -82,49 +82,49 @@ static void I420TestRotate(int src_width, int src_height,
free_aligned_buffer_64(src_i420);
}
TEST_F(libyuvTest, I420Rotate0) {
TEST_F(LibYUVRotateTest, I420Rotate0) {
I420TestRotate(benchmark_width_, benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, I420Rotate90) {
TEST_F(LibYUVRotateTest, I420Rotate90) {
I420TestRotate(benchmark_width_, benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, I420Rotate180) {
TEST_F(LibYUVRotateTest, I420Rotate180) {
I420TestRotate(benchmark_width_, benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, I420Rotate270) {
TEST_F(LibYUVRotateTest, I420Rotate270) {
I420TestRotate(benchmark_width_, benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, I420Rotate0_Odd) {
TEST_F(LibYUVRotateTest, I420Rotate0_Odd) {
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_width_ - 3, benchmark_height_ - 1,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, I420Rotate90_Odd) {
TEST_F(LibYUVRotateTest, I420Rotate90_Odd) {
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_height_ - 1, benchmark_width_ - 3,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, I420Rotate180_Odd) {
TEST_F(LibYUVRotateTest, I420Rotate180_Odd) {
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_width_ - 3, benchmark_height_ - 1,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, I420Rotate270_Odd) {
TEST_F(LibYUVRotateTest, I420Rotate270_Odd) {
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_height_ - 1, benchmark_width_ - 3,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
......@@ -147,7 +147,8 @@ static void NV12TestRotate(int src_width, int src_height,
dst_height = 1;
}
int src_nv12_y_size = src_width * Abs(src_height);
int src_nv12_uv_size = ((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2) * 2;
int src_nv12_uv_size =
((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2) * 2;
int src_nv12_size = src_nv12_y_size + src_nv12_uv_size;
align_buffer_64(src_nv12, src_nv12_size);
for (int i = 0; i < src_nv12_size; ++i) {
......@@ -192,73 +193,73 @@ static void NV12TestRotate(int src_width, int src_height,
free_aligned_buffer_64(src_nv12);
}
TEST_F(libyuvTest, NV12Rotate0) {
TEST_F(LibYUVRotateTest, NV12Rotate0) {
NV12TestRotate(benchmark_width_, benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate90) {
TEST_F(LibYUVRotateTest, NV12Rotate90) {
NV12TestRotate(benchmark_width_, benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate180) {
TEST_F(LibYUVRotateTest, NV12Rotate180) {
NV12TestRotate(benchmark_width_, benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate270) {
TEST_F(LibYUVRotateTest, NV12Rotate270) {
NV12TestRotate(benchmark_width_, benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate0_Odd) {
TEST_F(LibYUVRotateTest, NV12Rotate0_Odd) {
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_width_ - 3, benchmark_height_ - 1,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate90_Odd) {
TEST_F(LibYUVRotateTest, NV12Rotate90_Odd) {
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_height_ - 1, benchmark_width_ - 3,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate180_Odd) {
TEST_F(LibYUVRotateTest, NV12Rotate180_Odd) {
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_width_ - 3, benchmark_height_ - 1,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate270_Odd) {
TEST_F(LibYUVRotateTest, NV12Rotate270_Odd) {
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
benchmark_height_ - 1, benchmark_width_ - 3,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate0_Inverted) {
TEST_F(LibYUVRotateTest, NV12Rotate0_Inverted) {
NV12TestRotate(benchmark_width_, -benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate0, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate90_Inverted) {
TEST_F(LibYUVRotateTest, NV12Rotate90_Inverted) {
NV12TestRotate(benchmark_width_, -benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate90, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate180_Inverted) {
TEST_F(LibYUVRotateTest, NV12Rotate180_Inverted) {
NV12TestRotate(benchmark_width_, -benchmark_height_,
benchmark_width_, benchmark_height_,
kRotate180, benchmark_iterations_, disable_cpu_flags_);
}
TEST_F(libyuvTest, NV12Rotate270_Inverted) {
TEST_F(LibYUVRotateTest, NV12Rotate270_Inverted) {
NV12TestRotate(benchmark_width_, -benchmark_height_,
benchmark_height_, benchmark_width_,
kRotate270, benchmark_iterations_, disable_cpu_flags_);
......
......@@ -214,11 +214,11 @@ static int ARGBClipTestFilter(int src_width, int src_height,
// The following adjustments in dimensions ensure the scale factor will be
// exactly achieved.
#define DX(x, nom, denom) ((int)(Abs(x) / nom) * nom)
#define SX(x, nom, denom) ((int)(x / nom) * denom)
#define DX(x, nom, denom) static_cast<int>((Abs(x) / nom) * nom)
#define SX(x, nom, denom) static_cast<int>((x / nom) * denom)
#define TEST_FACTOR1(name, filter, nom, denom, max_diff) \
TEST_F(libyuvTest, ARGBScaleDownBy##name##_##filter) { \
TEST_F(LibYUVScaleTest, ARGBScaleDownBy##name##_##filter) { \
int diff = ARGBTestFilter(SX(benchmark_width_, nom, denom), \
SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), \
......@@ -227,7 +227,7 @@ static int ARGBClipTestFilter(int src_width, int src_height,
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, ARGBScaleDownClipBy##name##_##filter) { \
TEST_F(LibYUVScaleTest, ARGBScaleDownClipBy##name##_##filter) { \
int diff = ARGBClipTestFilter(SX(benchmark_width_, nom, denom), \
SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), \
......@@ -256,27 +256,27 @@ TEST_FACTOR(3, 1, 3)
#undef DX
#define TEST_SCALETO1(name, width, height, filter, max_diff) \
TEST_F(libyuvTest, name##To##width##x##height##_##filter) { \
TEST_F(LibYUVScaleTest, name##To##width##x##height##_##filter) { \
int diff = ARGBTestFilter(benchmark_width_, benchmark_height_, \
width, height, \
kFilter##filter, benchmark_iterations_, \
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, name##From##width##x##height##_##filter) { \
TEST_F(LibYUVScaleTest, name##From##width##x##height##_##filter) { \
int diff = ARGBTestFilter(width, height, \
Abs(benchmark_width_), Abs(benchmark_height_), \
kFilter##filter, benchmark_iterations_, \
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, name##ClipTo##width##x##height##_##filter) { \
TEST_F(LibYUVScaleTest, name##ClipTo##width##x##height##_##filter) { \
int diff = ARGBClipTestFilter(benchmark_width_, benchmark_height_, \
width, height, \
kFilter##filter, benchmark_iterations_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, name##ClipFrom##width##x##height##_##filter) { \
TEST_F(LibYUVScaleTest, name##ClipFrom##width##x##height##_##filter) { \
int diff = ARGBClipTestFilter(width, height, \
Abs(benchmark_width_), \
Abs(benchmark_height_), \
......
......@@ -37,7 +37,7 @@ namespace libyuv {
#endif
#define TESTCS(TESTNAME, YUVTOARGB, ARGBTOYUV, HS1, HS, HN, DIFF) \
TEST_F(libyuvTest, TESTNAME) { \
TEST_F(LibYUVScaleTest, TESTNAME) { \
const int kPixels = benchmark_width_ * benchmark_height_; \
const int kHalfPixels = ((benchmark_width_ + 1) / 2) * \
((benchmark_height_ + HS1) / HS); \
......@@ -251,7 +251,7 @@ static void YUVJToRGBReference(int y, int u, int v, int* r, int* g, int* b) {
*b = RoundToByte(y - (u - 128) * -1.77200);
}
TEST_F(libyuvTest, ScaleTestYUV) {
TEST_F(LibYUVScaleTest, ScaleTestYUV) {
int r0, g0, b0, r1, g1, b1;
// cyan (less red)
......@@ -297,7 +297,7 @@ TEST_F(libyuvTest, ScaleTestYUV) {
}
}
TEST_F(libyuvTest, ScaleTestGreyYUV) {
TEST_F(LibYUVScaleTest, ScaleTestGreyYUV) {
int r0, g0, b0, r1, g1, b1, r2, g2, b2;
// black
......@@ -376,7 +376,7 @@ static void ScalePrintHistogram(int rh[256], int gh[256], int bh[256]) {
printf("\n");
}
TEST_F(libyuvTest, ScaleTestFullYUV) {
TEST_F(LibYUVScaleTest, ScaleTestFullYUV) {
int rh[256] = { 0, }, gh[256] = { 0, }, bh[256] = { 0, };
for (int u = 0; u < 256; ++u) {
for (int v = 0; v < 256; ++v) {
......@@ -397,7 +397,7 @@ TEST_F(libyuvTest, ScaleTestFullYUV) {
ScalePrintHistogram(rh, gh, bh);
}
TEST_F(libyuvTest, ScaleTestFullYUVJ) {
TEST_F(LibYUVScaleTest, ScaleTestFullYUVJ) {
int rh[256] = { 0, }, gh[256] = { 0, }, bh[256] = { 0, };
for (int u = 0; u < 256; ++u) {
for (int v = 0; v < 256; ++v) {
......@@ -418,7 +418,7 @@ TEST_F(libyuvTest, ScaleTestFullYUVJ) {
ScalePrintHistogram(rh, gh, bh);
}
TEST_F(libyuvTest, ScaleTestGreyYUVJ) {
TEST_F(LibYUVScaleTest, ScaleTestGreyYUVJ) {
int r0, g0, b0, r1, g1, b1, r2, g2, b2;
// black
......
......@@ -274,11 +274,11 @@ static int TestFilter_16(int src_width, int src_height,
// The following adjustments in dimensions ensure the scale factor will be
// exactly achieved.
// 2 is chroma subsample
#define DX(x, nom, denom) ((int)(Abs(x) / nom / 2) * nom * 2)
#define SX(x, nom, denom) ((int)(x / nom / 2) * denom * 2)
#define DX(x, nom, denom) static_cast<int>((Abs(x) / nom / 2) * nom * 2)
#define SX(x, nom, denom) static_cast<int>((x / nom / 2) * denom * 2)
#define TEST_FACTOR1(name, filter, nom, denom, max_diff) \
TEST_F(libyuvTest, ScaleDownBy##name##_##filter) { \
TEST_F(LibYUVScaleTest, ScaleDownBy##name##_##filter) { \
int diff = TestFilter(SX(benchmark_width_, nom, denom), \
SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), \
......@@ -287,7 +287,7 @@ static int TestFilter_16(int src_width, int src_height,
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, DISABLED_ScaleDownBy##name##_##filter##_16) { \
TEST_F(LibYUVScaleTest, DISABLED_ScaleDownBy##name##_##filter##_16) { \
int diff = TestFilter_16(SX(benchmark_width_, nom, denom), \
SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), \
......@@ -316,28 +316,28 @@ TEST_FACTOR(3, 1, 3)
#undef DX
#define TEST_SCALETO1(name, width, height, filter, max_diff) \
TEST_F(libyuvTest, name##To##width##x##height##_##filter) { \
TEST_F(LibYUVScaleTest, name##To##width##x##height##_##filter) { \
int diff = TestFilter(benchmark_width_, benchmark_height_, \
width, height, \
kFilter##filter, benchmark_iterations_, \
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, name##From##width##x##height##_##filter) { \
TEST_F(LibYUVScaleTest, name##From##width##x##height##_##filter) { \
int diff = TestFilter(width, height, \
Abs(benchmark_width_), Abs(benchmark_height_), \
kFilter##filter, benchmark_iterations_, \
disable_cpu_flags_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, \
TEST_F(LibYUVScaleTest, \
DISABLED_##name##To##width##x##height##_##filter##_16) { \
int diff = TestFilter_16(benchmark_width_, benchmark_height_, \
width, height, \
kFilter##filter, benchmark_iterations_); \
EXPECT_LE(diff, max_diff); \
} \
TEST_F(libyuvTest, \
TEST_F(LibYUVScaleTest, \
DISABLED_##name##From##width##x##height##_##filter##_16) { \
int diff = TestFilter_16(width, height, \
Abs(benchmark_width_), Abs(benchmark_height_), \
......
......@@ -20,7 +20,147 @@
int fastrand_seed = 0xfb;
libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128),
LibYUVConvertTest::LibYUVConvertTest() : rotate_max_w_(128), rotate_max_h_(128),
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
if (repeat) {
benchmark_iterations_ = atoi(repeat); // NOLINT
// For quicker unittests, default is 128 x 72. But when benchmarking,
// default to 720p. Allow size to specify.
if (benchmark_iterations_ > 1) {
benchmark_width_ = 1280;
benchmark_height_ = 720;
}
}
const char* width = getenv("LIBYUV_WIDTH");
if (width) {
benchmark_width_ = atoi(width); // NOLINT
}
const char* height = getenv("LIBYUV_HEIGHT");
if (height) {
benchmark_height_ = atoi(height); // NOLINT
}
const char* cpu_flags = getenv("LIBYUV_FLAGS");
if (cpu_flags) {
disable_cpu_flags_ = atoi(cpu_flags); // NOLINT
}
benchmark_pixels_div256_ = static_cast<int>((
static_cast<double>(Abs(benchmark_width_)) *
static_cast<double>(Abs(benchmark_height_)) *
static_cast<double>(benchmark_iterations_) + 255.0) / 256.0);
benchmark_pixels_div1280_ = static_cast<int>((
static_cast<double>(Abs(benchmark_width_)) *
static_cast<double>(Abs(benchmark_height_)) *
static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
}
LibYUVScaleTest::LibYUVScaleTest() : rotate_max_w_(128), rotate_max_h_(128),
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
if (repeat) {
benchmark_iterations_ = atoi(repeat); // NOLINT
// For quicker unittests, default is 128 x 72. But when benchmarking,
// default to 720p. Allow size to specify.
if (benchmark_iterations_ > 1) {
benchmark_width_ = 1280;
benchmark_height_ = 720;
}
}
const char* width = getenv("LIBYUV_WIDTH");
if (width) {
benchmark_width_ = atoi(width); // NOLINT
}
const char* height = getenv("LIBYUV_HEIGHT");
if (height) {
benchmark_height_ = atoi(height); // NOLINT
}
const char* cpu_flags = getenv("LIBYUV_FLAGS");
if (cpu_flags) {
disable_cpu_flags_ = atoi(cpu_flags); // NOLINT
}
benchmark_pixels_div256_ = static_cast<int>((
static_cast<double>(Abs(benchmark_width_)) *
static_cast<double>(Abs(benchmark_height_)) *
static_cast<double>(benchmark_iterations_) + 255.0) / 256.0);
benchmark_pixels_div1280_ = static_cast<int>((
static_cast<double>(Abs(benchmark_width_)) *
static_cast<double>(Abs(benchmark_height_)) *
static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
}
LibYUVRotateTest::LibYUVRotateTest() : rotate_max_w_(128), rotate_max_h_(128),
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
if (repeat) {
benchmark_iterations_ = atoi(repeat); // NOLINT
// For quicker unittests, default is 128 x 72. But when benchmarking,
// default to 720p. Allow size to specify.
if (benchmark_iterations_ > 1) {
benchmark_width_ = 1280;
benchmark_height_ = 720;
}
}
const char* width = getenv("LIBYUV_WIDTH");
if (width) {
benchmark_width_ = atoi(width); // NOLINT
}
const char* height = getenv("LIBYUV_HEIGHT");
if (height) {
benchmark_height_ = atoi(height); // NOLINT
}
const char* cpu_flags = getenv("LIBYUV_FLAGS");
if (cpu_flags) {
disable_cpu_flags_ = atoi(cpu_flags); // NOLINT
}
benchmark_pixels_div256_ = static_cast<int>((
static_cast<double>(Abs(benchmark_width_)) *
static_cast<double>(Abs(benchmark_height_)) *
static_cast<double>(benchmark_iterations_) + 255.0) / 256.0);
benchmark_pixels_div1280_ = static_cast<int>((
static_cast<double>(Abs(benchmark_width_)) *
static_cast<double>(Abs(benchmark_height_)) *
static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
}
LibYUVPlanarTest::LibYUVPlanarTest() : rotate_max_w_(128), rotate_max_h_(128),
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
if (repeat) {
benchmark_iterations_ = atoi(repeat); // NOLINT
// For quicker unittests, default is 128 x 72. But when benchmarking,
// default to 720p. Allow size to specify.
if (benchmark_iterations_ > 1) {
benchmark_width_ = 1280;
benchmark_height_ = 720;
}
}
const char* width = getenv("LIBYUV_WIDTH");
if (width) {
benchmark_width_ = atoi(width); // NOLINT
}
const char* height = getenv("LIBYUV_HEIGHT");
if (height) {
benchmark_height_ = atoi(height); // NOLINT
}
const char* cpu_flags = getenv("LIBYUV_FLAGS");
if (cpu_flags) {
disable_cpu_flags_ = atoi(cpu_flags); // NOLINT
}
benchmark_pixels_div256_ = static_cast<int>((
static_cast<double>(Abs(benchmark_width_)) *
static_cast<double>(Abs(benchmark_height_)) *
static_cast<double>(benchmark_iterations_) + 255.0) / 256.0);
benchmark_pixels_div1280_ = static_cast<int>((
static_cast<double>(Abs(benchmark_width_)) *
static_cast<double>(Abs(benchmark_height_)) *
static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
}
LibYUVBaseTest::LibYUVBaseTest() : rotate_max_w_(128), rotate_max_h_(128),
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
......
......@@ -72,9 +72,69 @@ static inline void MemRandomize(uint8* dst, int64 len) {
}
}
class libyuvTest : public ::testing::Test {
class LibYUVConvertTest : public ::testing::Test {
protected:
libyuvTest();
LibYUVConvertTest();
const int rotate_max_w_;
const int rotate_max_h_;
int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
int benchmark_pixels_div256_; // Total pixels to benchmark / 256.
int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
int disable_cpu_flags_; // Default 0. Use -1 for benchmarking.
};
class LibYUVScaleTest : public ::testing::Test {
protected:
LibYUVScaleTest();
const int rotate_max_w_;
const int rotate_max_h_;
int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
int benchmark_pixels_div256_; // Total pixels to benchmark / 256.
int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
int disable_cpu_flags_; // Default 0. Use -1 for benchmarking.
};
class LibYUVRotateTest : public ::testing::Test {
protected:
LibYUVRotateTest();
const int rotate_max_w_;
const int rotate_max_h_;
int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
int benchmark_pixels_div256_; // Total pixels to benchmark / 256.
int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
int disable_cpu_flags_; // Default 0. Use -1 for benchmarking.
};
class LibYUVPlanarTest : public ::testing::Test {
protected:
LibYUVPlanarTest();
const int rotate_max_w_;
const int rotate_max_h_;
int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
int benchmark_pixels_div256_; // Total pixels to benchmark / 256.
int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
int disable_cpu_flags_; // Default 0. Use -1 for benchmarking.
};
class LibYUVBaseTest : public ::testing::Test {
protected:
LibYUVBaseTest();
const int rotate_max_w_;
const int rotate_max_h_;
......
......@@ -20,7 +20,7 @@ namespace libyuv {
// Tests SVN version against include/libyuv/version.h
// SVN version is bumped by documentation changes as well as code.
// Although the versions should match, once checked in, a tolerance is allowed.
TEST_F(libyuvTest, DISABLED_TestVersion) {
TEST_F(LibYUVBaseTest, DISABLED_TestVersion) {
EXPECT_GE(LIBYUV_VERSION, 169); // 169 is first version to support version.
printf("LIBYUV_VERSION %d\n", LIBYUV_VERSION);
#ifdef LIBYUV_SVNREVISION
......
......@@ -41,7 +41,7 @@ static bool TestValidFourCC(uint32 fourcc, int bpp) {
return true;
}
TEST_F(libyuvTest, TestCanonicalFourCC) {
TEST_F(LibYUVBaseTest, TestCanonicalFourCC) {
EXPECT_EQ(FOURCC_I420, CanonicalFourCC(FOURCC_IYUV));
EXPECT_EQ(FOURCC_I422, CanonicalFourCC(FOURCC_YU16));
EXPECT_EQ(FOURCC_I444, CanonicalFourCC(FOURCC_YU24));
......@@ -60,7 +60,7 @@ TEST_F(libyuvTest, TestCanonicalFourCC) {
EXPECT_EQ(FOURCC_RGBO, CanonicalFourCC(FOURCC_5551));
}
TEST_F(libyuvTest, TestFourCC) {
TEST_F(LibYUVBaseTest, TestFourCC) {
EXPECT_TRUE(TestValidFourCC(FOURCC_I420, FOURCC_BPP_I420));
EXPECT_TRUE(TestValidFourCC(FOURCC_I420, FOURCC_BPP_I420));
EXPECT_TRUE(TestValidFourCC(FOURCC_I422, FOURCC_BPP_I422));
......
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