From 3bb60b37fd01e5b9896794a31ec10addda66cfde Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Wed, 24 Oct 2012 18:31:55 +0000 Subject: [PATCH] Use width variable for all tests BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/934004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@441 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- unit_test/compare_test.cc | 28 ++++---- unit_test/planar_test.cc | 49 ++++++++++---- unit_test/rotate_argb_test.cc | 64 +++++++++---------- unit_test/rotate_test.cc | 32 +++++----- unit_test/scale_argb_test.cc | 56 ++++++---------- unit_test/scale_test.cc | 116 ++++++---------------------------- 6 files changed, 139 insertions(+), 206 deletions(-) diff --git a/unit_test/compare_test.cc b/unit_test/compare_test.cc index e57275de9..6170926a1 100644 --- a/unit_test/compare_test.cc +++ b/unit_test/compare_test.cc @@ -54,7 +54,7 @@ TEST_F(libyuvTest, TestDjb2) { } TEST_F(libyuvTest, BenchmakDjb2_C) { - const int kMaxTest = 1280 * 720; + const int kMaxTest = benchmark_width_ * benchmark_height_; align_buffer_16(src_a, kMaxTest) for (int i = 0; i < kMaxTest; ++i) { @@ -62,7 +62,7 @@ TEST_F(libyuvTest, BenchmakDjb2_C) { } uint32 h2 = ReferenceHashDjb2(src_a, kMaxTest, 5381); uint32 h1; - MaskCpuFlags(0); \ + MaskCpuFlags(0); for (int i = 0; i < benchmark_iterations_; ++i) { h1 = HashDjb2(src_a, kMaxTest, 5381); } @@ -72,7 +72,7 @@ TEST_F(libyuvTest, BenchmakDjb2_C) { } TEST_F(libyuvTest, BenchmakDjb2_OPT) { - const int kMaxTest = 1280 * 720; + const int kMaxTest = benchmark_width_ * benchmark_height_; align_buffer_16(src_a, kMaxTest) for (int i = 0; i < kMaxTest; ++i) { @@ -88,7 +88,7 @@ TEST_F(libyuvTest, BenchmakDjb2_OPT) { } TEST_F(libyuvTest, BenchmakDjb2_Unaligned_OPT) { - const int kMaxTest = 1280 * 720; + const int kMaxTest = benchmark_width_ * benchmark_height_; align_buffer_16(src_a, kMaxTest + 1) for (int i = 0; i < kMaxTest; ++i) { @@ -119,7 +119,8 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_C) { src_b[i] = i; } - int count = benchmark_iterations_ * 1280 * 720 / kMaxWidth; + int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / kMaxWidth; for (int i = 0; i < count; ++i) { h1 = ComputeSumSquareError(src_a, src_b, kMaxWidth); } @@ -146,7 +147,8 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_OPT) { src_b[i] = i; } - int count = benchmark_iterations_ * 1280 * 720 / kMaxWidth; + int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / kMaxWidth; for (int i = 0; i < count; ++i) { h1 = ComputeSumSquareError(src_a, src_b, kMaxWidth); } @@ -255,8 +257,8 @@ TEST_F(libyuvTest, BenchmarkPsnr_OPT) { } TEST_F(libyuvTest, Psnr) { - const int kSrcWidth = 1280; - const int kSrcHeight = 720; + const int kSrcWidth = benchmark_width_; + const int kSrcHeight = benchmark_height_; const int b = 128; const int kSrcPlaneSize = (kSrcWidth + b * 2) * (kSrcHeight + b * 2); const int kSrcStride = 2 * b + kSrcWidth; @@ -313,7 +315,7 @@ TEST_F(libyuvTest, Psnr) { } } - MaskCpuFlags(0); \ + MaskCpuFlags(0); double c_err, opt_err; c_err = CalcFramePsnr(src_a + kSrcStride * b + b, kSrcStride, @@ -341,7 +343,7 @@ TEST_F(libyuvTest, BenchmarkSsim_C) { src_b[i] = i; } - MaskCpuFlags(0); \ + MaskCpuFlags(0); double c_time = get_time(); for (int i = 0; i < benchmark_iterations_; ++i) @@ -387,8 +389,8 @@ TEST_F(libyuvTest, BenchmarkSsim_OPT) { } TEST_F(libyuvTest, Ssim) { - const int kSrcWidth = 1280; - const int kSrcHeight = 720; + const int kSrcWidth = benchmark_width_; + const int kSrcHeight = benchmark_height_; const int b = 128; const int kSrcPlaneSize = (kSrcWidth + b * 2) * (kSrcHeight + b * 2); const int kSrcStride = 2 * b + kSrcWidth; @@ -441,7 +443,7 @@ TEST_F(libyuvTest, Ssim) { } } - MaskCpuFlags(0); \ + MaskCpuFlags(0); double c_err, opt_err; c_err = CalcFrameSsim(src_a + kSrcStride * b + b, kSrcStride, diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index c57dcd3d5..37f47809d 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -80,7 +80,9 @@ TEST_F(libyuvTest, TestAttenuate) { } ARGBAttenuate(&orig_pixels[0][0], 0, &atten_pixels[0][0], 0, 256, 1); ARGBUnattenuate(&atten_pixels[0][0], 0, &unatten_pixels[0][0], 0, 256, 1); - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBAttenuate(&unatten_pixels[0][0], 0, &atten2_pixels[0][0], 0, 256, 1); } for (int i = 0; i < 256; ++i) { @@ -179,8 +181,9 @@ TEST_F(libyuvTest, TestARGBGray) { orig_pixels[i][2] = i / 3; orig_pixels[i][3] = i; } - - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBGray(&orig_pixels[0][0], 0, 0, 0, 256, 1); } } @@ -235,7 +238,9 @@ TEST_F(libyuvTest, TestARGBGrayTo) { orig_pixels[i][3] = i; } - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBGrayTo(&orig_pixels[0][0], 0, &gray_pixels[0][0], 0, 256, 1); } } @@ -289,7 +294,9 @@ TEST_F(libyuvTest, TestARGBSepia) { orig_pixels[i][3] = i; } - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBSepia(&orig_pixels[0][0], 0, 0, 0, 256, 1); } } @@ -350,7 +357,9 @@ TEST_F(libyuvTest, TestARGBColorMatrix) { orig_pixels[i][3] = i; } - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBColorMatrix(&orig_pixels[0][0], 0, &kARGBToSepia[0], 0, 0, 256, 1); } } @@ -409,7 +418,9 @@ TEST_F(libyuvTest, TestARGBColorTable) { orig_pixels[i][3] = i; } - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 256, 1); } } @@ -432,7 +443,9 @@ TEST_F(libyuvTest, TestARGBQuantize) { EXPECT_EQ(i / 3 / 8 * 8 + 8 / 2, orig_pixels[i][2]); EXPECT_EQ(i, orig_pixels[i][3]); } - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBQuantize(&orig_pixels[0][0], 0, (65536 + (8 / 2)) / 8, 8, 8 / 2, 0, 0, 256, 1); } @@ -456,7 +469,9 @@ TEST_F(libyuvTest, TestARGBMirror) { EXPECT_EQ(i / 3, dst_pixels[255 - i][2]); EXPECT_EQ(i / 4, dst_pixels[255 - i][3]); } - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBMirror(&orig_pixels[0][0], 0, &dst_pixels[0][0], 0, 256, 1); } } @@ -505,7 +520,9 @@ TEST_F(libyuvTest, TestShade) { EXPECT_EQ(20u, shade_pixels[0][2]); EXPECT_EQ(40u, shade_pixels[0][3]); - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBShade(&orig_pixels[0][0], 0, &shade_pixels[0][0], 0, 256, 1, 0x80808080); } @@ -584,7 +601,9 @@ TEST_F(libyuvTest, TestInterpolate) { EXPECT_EQ(16u, interpolate_pixels[0][2]); EXPECT_EQ(32u, interpolate_pixels[0][3]); - for (int i = 0; i < benchmark_iterations_ * (1280 * 720 / 256); ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, &interpolate_pixels[0][0], 0, 256, 1, 128); } @@ -620,13 +639,17 @@ TEST_F(libyuvTest, TestAffine) { #if defined(HAS_ARGBAFFINEROW_SSE2) int has_sse2 = TestCpuFlag(kCpuHasSSE2); if (has_sse2) { - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBAffineRow_SSE2(&orig_pixels_0[0][0], 0, &interpolate_pixels_Opt[0][0], uv_step, 256); } } else { #endif - for (int i = 0; i < benchmark_iterations_ * 1280 * 720 / 256; ++i) { + const int count = benchmark_iterations_ * + benchmark_width_ * benchmark_height_ / 256; + for (int i = 0; i < count; ++i) { ARGBAffineRow_C(&orig_pixels_0[0][0], 0, &interpolate_pixels_C[0][0], uv_step, 256); } diff --git a/unit_test/rotate_argb_test.cc b/unit_test/rotate_argb_test.cc index 42f53b269..6308cc763 100644 --- a/unit_test/rotate_argb_test.cc +++ b/unit_test/rotate_argb_test.cc @@ -98,10 +98,10 @@ static int ARGBTestRotate(int src_width, int src_height, } TEST_F(libyuvTest, ARGBRotate0) { - const int src_width = 1280; - const int src_height = 720; - const int dst_width = 1280; - const int dst_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; + const int dst_width = benchmark_width_; + const int dst_height = benchmark_height_; int err = ARGBTestRotate(src_width, src_height, dst_width, dst_height, kRotate0, @@ -110,10 +110,10 @@ TEST_F(libyuvTest, ARGBRotate0) { } TEST_F(libyuvTest, ARGBRotate90) { - const int src_width = 1280; - const int src_height = 720; - const int dst_width = 720; - const int dst_height = 1280; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; + const int dst_width = benchmark_height_; + const int dst_height = benchmark_width_; int err = ARGBTestRotate(src_width, src_height, dst_width, dst_height, kRotate90, @@ -122,10 +122,10 @@ TEST_F(libyuvTest, ARGBRotate90) { } TEST_F(libyuvTest, ARGBRotate180) { - const int src_width = 1280; - const int src_height = 720; - const int dst_width = 1280; - const int dst_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; + const int dst_width = benchmark_width_; + const int dst_height = benchmark_height_; int err = ARGBTestRotate(src_width, src_height, dst_width, dst_height, kRotate180, @@ -134,10 +134,10 @@ TEST_F(libyuvTest, ARGBRotate180) { } TEST_F(libyuvTest, ARGBRotate270) { - const int src_width = 1280; - const int src_height = 720; - const int dst_width = 720; - const int dst_height = 1280; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; + const int dst_width = benchmark_height_; + const int dst_height = benchmark_width_; int err = ARGBTestRotate(src_width, src_height, dst_width, dst_height, kRotate270, @@ -146,10 +146,10 @@ TEST_F(libyuvTest, ARGBRotate270) { } TEST_F(libyuvTest, ARGBRotate0_Odd) { - const int src_width = 1277; - const int src_height = 719; - const int dst_width = 1277; - const int dst_height = 719; + const int src_width = benchmark_width_ - 3; + const int src_height = benchmark_height_ - 1; + const int dst_width = benchmark_width_ - 3; + const int dst_height = benchmark_height_ - 1; int err = ARGBTestRotate(src_width, src_height, dst_width, dst_height, kRotate0, @@ -158,10 +158,10 @@ TEST_F(libyuvTest, ARGBRotate0_Odd) { } TEST_F(libyuvTest, ARGBRotate90_Odd) { - const int src_width = 1277; - const int src_height = 719; - const int dst_width = 719; - const int dst_height = 1277; + const int src_width = benchmark_width_ - 3; + const int src_height = benchmark_height_ - 1; + const int dst_width = benchmark_height_ - 1; + const int dst_height = benchmark_width_ - 3; int err = ARGBTestRotate(src_width, src_height, dst_width, dst_height, kRotate90, @@ -170,10 +170,10 @@ TEST_F(libyuvTest, ARGBRotate90_Odd) { } TEST_F(libyuvTest, ARGBRotate180_Odd) { - const int src_width = 1277; - const int src_height = 719; - const int dst_width = 1277; - const int dst_height = 719; + const int src_width = benchmark_width_ - 3; + const int src_height = benchmark_height_ - 1; + const int dst_width = benchmark_width_ - 3; + const int dst_height = benchmark_height_ - 1; int err = ARGBTestRotate(src_width, src_height, dst_width, dst_height, kRotate180, @@ -182,10 +182,10 @@ TEST_F(libyuvTest, ARGBRotate180_Odd) { } TEST_F(libyuvTest, ARGBRotate270_Odd) { - const int src_width = 1277; - const int src_height = 719; - const int dst_width = 719; - const int dst_height = 1277; + const int src_width = benchmark_width_ - 3; + const int src_height = benchmark_height_ - 1; + const int dst_width = benchmark_height_ - 1; + const int dst_height = benchmark_width_ - 3; int err = ARGBTestRotate(src_width, src_height, dst_width, dst_height, kRotate270, diff --git a/unit_test/rotate_test.cc b/unit_test/rotate_test.cc index 8e6140320..db586a884 100644 --- a/unit_test/rotate_test.cc +++ b/unit_test/rotate_test.cc @@ -700,8 +700,8 @@ TEST_F(libyuvTest, RotatePlane270Pitch) { TEST_F(libyuvTest, I420Rotate90) { int err = 0; - int yw = 1024; - int yh = 768; + int yw = benchmark_width_; + int yh = benchmark_height_; int b = 128; int uvw = (yw + 1) >> 1; int uvh = (yh + 1) >> 1; @@ -823,8 +823,8 @@ TEST_F(libyuvTest, I420Rotate90) { TEST_F(libyuvTest, I420Rotate270) { int err = 0; - int yw = 1024; - int yh = 768; + int yw = benchmark_width_; + int yh = benchmark_height_; int b = 128; int uvw = (yw + 1) >> 1; int uvh = (yh + 1) >> 1; @@ -946,8 +946,8 @@ TEST_F(libyuvTest, I420Rotate270) { TEST_F(libyuvTest, NV12ToI420Rotate90) { int err = 0; - int yw = 1024; - int yh = 768; + int yw = benchmark_width_; + int yh = benchmark_height_; int b = 128; int uvw = (yw + 1) >> 1; int uvh = (yh + 1) >> 1; @@ -1053,8 +1053,8 @@ TEST_F(libyuvTest, NV12ToI420Rotate90) { TEST_F(libyuvTest, NV12ToI420Rotate270) { int err = 0; - int yw = 1024; - int yh = 768; + int yw = benchmark_width_; + int yh = benchmark_height_; int b = 128; int uvw = (yw + 1) >> 1; int uvh = (yh + 1) >> 1; @@ -1161,8 +1161,8 @@ TEST_F(libyuvTest, NV12ToI420Rotate270) { TEST_F(libyuvTest, NV12ToI420Rotate180) { int err = 0; - int yw = 1024; - int yh = 768; + int yw = benchmark_width_; + int yh = benchmark_height_; int b = 128; int uvw = (yw + 1) >> 1; int uvh = (yh + 1) >> 1; @@ -1266,8 +1266,8 @@ TEST_F(libyuvTest, NV12ToI420Rotate180) { TEST_F(libyuvTest, NV12ToI420RotateNegHeight90) { int y_err = 0, uv_err = 0; - int yw = 1024; - int yh = 768; + int yw = benchmark_width_; + int yh = benchmark_height_; int b = 128; int uvw = (yw + 1) >> 1; int uvh = (yh + 1) >> 1; @@ -1423,8 +1423,8 @@ TEST_F(libyuvTest, NV12ToI420RotateNegHeight90) { TEST_F(libyuvTest, NV12ToI420RotateNegHeight180) { int y_err = 0, uv_err = 0; - int yw = 1024; - int yh = 768; + int yw = benchmark_width_; + int yh = benchmark_height_; int b = 128; int uvw = (yw + 1) >> 1; int uvh = (yh + 1) >> 1; @@ -1549,8 +1549,8 @@ TEST_F(libyuvTest, NV12ToI420RotateNegHeight180) { TEST_F(libyuvTest, NV12ToI420SplitUV) { int err = 0; - int yw = 1024; - int yh = 768; + int yw = benchmark_width_; + int yh = benchmark_height_; int b = 128; int uvw = (yw + 1) >> 1; diff --git a/unit_test/scale_argb_test.cc b/unit_test/scale_argb_test.cc index fef967645..1583741ca 100644 --- a/unit_test/scale_argb_test.cc +++ b/unit_test/scale_argb_test.cc @@ -102,8 +102,8 @@ static int ARGBTestFilter(int src_width, int src_height, } TEST_F(libyuvTest, ARGBScaleDownBy2) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 2; const int dst_height = src_height / 2; @@ -117,8 +117,8 @@ TEST_F(libyuvTest, ARGBScaleDownBy2) { } TEST_F(libyuvTest, ARGBScaleDownBy4) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 4; const int dst_height = src_height / 4; @@ -132,8 +132,8 @@ TEST_F(libyuvTest, ARGBScaleDownBy4) { } TEST_F(libyuvTest, ARGBScaleDownBy5) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 5; const int dst_height = src_height / 5; @@ -147,8 +147,8 @@ TEST_F(libyuvTest, ARGBScaleDownBy5) { } TEST_F(libyuvTest, ARGBScaleDownBy8) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 8; const int dst_height = src_height / 8; @@ -162,8 +162,8 @@ TEST_F(libyuvTest, ARGBScaleDownBy8) { } TEST_F(libyuvTest, ARGBScaleDownBy16) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 16; const int dst_height = src_height / 16; @@ -177,8 +177,8 @@ TEST_F(libyuvTest, ARGBScaleDownBy16) { } TEST_F(libyuvTest, ARGBScaleDownBy34) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width * 3 / 4; const int dst_height = src_height * 3 / 4; @@ -192,8 +192,8 @@ TEST_F(libyuvTest, ARGBScaleDownBy34) { } TEST_F(libyuvTest, ARGBScaleDownBy38) { - int src_width = 1280; - int src_height = 720; + int src_width = benchmark_width_; + int src_height = benchmark_height_; int dst_width = src_width * 3 / 8; int dst_height = src_height * 3 / 8; @@ -206,9 +206,9 @@ TEST_F(libyuvTest, ARGBScaleDownBy38) { } } -TEST_F(libyuvTest, ARGBScaleTo1366) { - int src_width = 1280; - int src_height = 720; +TEST_F(libyuvTest, ARGBScaleTo1366x768) { + int src_width = benchmark_width_; + int src_height = benchmark_height_; int dst_width = 1366; int dst_height = 768; @@ -221,25 +221,9 @@ TEST_F(libyuvTest, ARGBScaleTo1366) { } } -TEST_F(libyuvTest, ARGBScaleTo4074) { - int src_width = 2880 * 2; - int src_height = 1800; - int dst_width = 4074; - int dst_height = 1272; - - for (int f = 0; f < 2; ++f) { - int max_diff = ARGBTestFilter(src_width, src_height, - dst_width, dst_height, - static_cast(f), - benchmark_iterations_); - EXPECT_LE(max_diff, 1); - } -} - - -TEST_F(libyuvTest, ARGBScaleTo853) { - int src_width = 1280; - int src_height = 720; +TEST_F(libyuvTest, ARGBScaleTo853x480) { + int src_width = benchmark_width_; + int src_height = benchmark_height_; int dst_width = 853; int dst_height = 480; diff --git a/unit_test/scale_test.cc b/unit_test/scale_test.cc index 55b4148d2..1a90c5f17 100644 --- a/unit_test/scale_test.cc +++ b/unit_test/scale_test.cc @@ -163,8 +163,8 @@ static int TestFilter(int src_width, int src_height, } TEST_F(libyuvTest, ScaleDownBy2) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 2; const int dst_height = src_height / 2; @@ -178,8 +178,8 @@ TEST_F(libyuvTest, ScaleDownBy2) { } TEST_F(libyuvTest, ScaleDownBy4) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 4; const int dst_height = src_height / 4; @@ -193,8 +193,8 @@ TEST_F(libyuvTest, ScaleDownBy4) { } TEST_F(libyuvTest, ScaleDownBy5) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 5; const int dst_height = src_height / 5; @@ -208,8 +208,8 @@ TEST_F(libyuvTest, ScaleDownBy5) { } TEST_F(libyuvTest, ScaleDownBy8) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 8; const int dst_height = src_height / 8; @@ -223,8 +223,8 @@ TEST_F(libyuvTest, ScaleDownBy8) { } TEST_F(libyuvTest, ScaleDownBy16) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width / 16; const int dst_height = src_height / 16; @@ -238,8 +238,8 @@ TEST_F(libyuvTest, ScaleDownBy16) { } TEST_F(libyuvTest, ScaleDownBy34) { - const int src_width = 1280; - const int src_height = 720; + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; const int dst_width = src_width * 3 / 4; const int dst_height = src_height * 3 / 4; @@ -253,8 +253,8 @@ TEST_F(libyuvTest, ScaleDownBy34) { } TEST_F(libyuvTest, ScaleDownBy38) { - int src_width = 1280; - int src_height = 720; + int src_width = benchmark_width_; + int src_height = benchmark_height_; int dst_width = src_width * 3 / 8; int dst_height = src_height * 3 / 8; @@ -267,9 +267,9 @@ TEST_F(libyuvTest, ScaleDownBy38) { } } -TEST_F(libyuvTest, ScaleTo1366) { - int src_width = 1280; - int src_height = 720; +TEST_F(libyuvTest, ScaleTo1366x768) { + int src_width = benchmark_width_; + int src_height = benchmark_height_; int dst_width = 1366; int dst_height = 768; @@ -282,24 +282,9 @@ TEST_F(libyuvTest, ScaleTo1366) { } } -TEST_F(libyuvTest, ScaleTo4074) { - int src_width = 2880 * 2; - int src_height = 1800; - int dst_width = 4074; - int dst_height = 1272; - - for (int f = 0; f < 3; ++f) { - int max_diff = TestFilter(src_width, src_height, - dst_width, dst_height, - static_cast(f), 1, - benchmark_iterations_); - EXPECT_LE(max_diff, 1); - } -} - -TEST_F(libyuvTest, ScaleTo853) { - int src_width = 1280; - int src_height = 720; +TEST_F(libyuvTest, ScaleTo853x480) { + int src_width = benchmark_width_; + int src_height = benchmark_height_; int dst_width = 853; int dst_height = 480; @@ -312,65 +297,4 @@ TEST_F(libyuvTest, ScaleTo853) { } } -TEST_F(libyuvTest, ScaleTo853Wrong) { - int src_width = 1280; - int src_height = 720; - int dst_width = 853; - int dst_height = 480; - - for (int f = 0; f < 3; ++f) { - int max_diff = TestFilter(src_width, src_height, - dst_width, dst_height, - static_cast(f), 0, - benchmark_iterations_); - EXPECT_LE(max_diff, 1); - } -} - -// A one off test for a screen cast resolution scale. -TEST_F(libyuvTest, ScaleTo684) { - int src_width = 686; - int src_height = 557; - int dst_width = 684; - int dst_height = 552; - - for (int f = 0; f < 3; ++f) { - int max_diff = TestFilter(src_width, src_height, - dst_width, dst_height, - static_cast(f), 1, - benchmark_iterations_); - EXPECT_LE(max_diff, 1); - } -} - -TEST_F(libyuvTest, ScaleTo342) { - int src_width = 686; - int src_height = 557; - int dst_width = 342; - int dst_height = 276; - - for (int f = 0; f < 3; ++f) { - int max_diff = TestFilter(src_width, src_height, - dst_width, dst_height, - static_cast(f), 1, - benchmark_iterations_); - EXPECT_LE(max_diff, 1); - } -} - -TEST_F(libyuvTest, ScaleToHalf342) { - int src_width = 684; - int src_height = 552; - int dst_width = 342; - int dst_height = 276; - - for (int f = 0; f < 3; ++f) { - int max_diff = TestFilter(src_width, src_height, - dst_width, dst_height, - static_cast(f), 1, - benchmark_iterations_); - EXPECT_LE(max_diff, 1); - } -} - } // namespace libyuv