diff options
author | Frank Barchard <fbarchard@google.com> | 2016-11-07 17:37:23 -0800 |
---|---|---|
committer | Frank Barchard <fbarchard@google.com> | 2016-11-07 17:37:23 -0800 |
commit | e62309f2591d8b87acae5f4560ab9eeed8f91471 (patch) | |
tree | e3315107bf2f96276ecb00e6212ee518de60c489 /unit_test/unit_test.cc | |
parent | f2c27dafa2950510ba767cd59937ddf5d1974937 (diff) | |
download | libyuv-e62309f2591d8b87acae5f4560ab9eeed8f91471.tar.gz |
clang-format libyuv
BUG=libyuv:654
R=kjellander@chromium.org
Review URL: https://codereview.chromium.org/2469353005 .
Diffstat (limited to 'unit_test/unit_test.cc')
-rw-r--r-- | unit_test/unit_test.cc | 180 |
1 files changed, 111 insertions, 69 deletions
diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc index e75510fd..7f8bcf8f 100644 --- a/unit_test/unit_test.cc +++ b/unit_test/unit_test.cc @@ -25,18 +25,21 @@ unsigned int fastrand_seed = 0xfb; DEFINE_int32(libyuv_width, 0, "width of test image."); DEFINE_int32(libyuv_height, 0, "height of test image."); DEFINE_int32(libyuv_repeat, 0, "number of times to repeat test."); -DEFINE_int32(libyuv_flags, 0, - "cpu flags for reference code. 1 = C, -1 = SIMD"); -DEFINE_int32(libyuv_cpu_info, 0, +DEFINE_int32(libyuv_flags, 0, "cpu flags for reference code. 1 = C, -1 = SIMD"); +DEFINE_int32(libyuv_cpu_info, + 0, "cpu flags for benchmark code. 1 = C, -1 = SIMD"); // For quicker unittests, default is 128 x 72. But when benchmarking, // default to 720p. Allow size to specify. // Set flags to -1 for benchmarking to avoid slower C code. -LibYUVConvertTest::LibYUVConvertTest() : - benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), - benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { +LibYUVConvertTest::LibYUVConvertTest() + : benchmark_iterations_(BENCHMARK_ITERATIONS), + benchmark_width_(128), + benchmark_height_(72), + disable_cpu_flags_(1), + benchmark_cpu_info_(-1) { const char* repeat = getenv("LIBYUV_REPEAT"); if (repeat) { benchmark_iterations_ = atoi(repeat); // NOLINT @@ -76,19 +79,26 @@ LibYUVConvertTest::LibYUVConvertTest() : if (FLAGS_libyuv_cpu_info) { benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; } - 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); + 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); } -LibYUVColorTest::LibYUVColorTest() : - benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), - benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { +LibYUVColorTest::LibYUVColorTest() + : benchmark_iterations_(BENCHMARK_ITERATIONS), + benchmark_width_(128), + benchmark_height_(72), + disable_cpu_flags_(1), + benchmark_cpu_info_(-1) { const char* repeat = getenv("LIBYUV_REPEAT"); if (repeat) { benchmark_iterations_ = atoi(repeat); // NOLINT @@ -128,19 +138,26 @@ LibYUVColorTest::LibYUVColorTest() : if (FLAGS_libyuv_cpu_info) { benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; } - 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); + 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() : - benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), - benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { +LibYUVScaleTest::LibYUVScaleTest() + : benchmark_iterations_(BENCHMARK_ITERATIONS), + benchmark_width_(128), + benchmark_height_(72), + disable_cpu_flags_(1), + benchmark_cpu_info_(-1) { const char* repeat = getenv("LIBYUV_REPEAT"); if (repeat) { benchmark_iterations_ = atoi(repeat); // NOLINT @@ -180,19 +197,26 @@ LibYUVScaleTest::LibYUVScaleTest() : if (FLAGS_libyuv_cpu_info) { benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; } - 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); + 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() : - benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), - benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { +LibYUVRotateTest::LibYUVRotateTest() + : benchmark_iterations_(BENCHMARK_ITERATIONS), + benchmark_width_(128), + benchmark_height_(72), + disable_cpu_flags_(1), + benchmark_cpu_info_(-1) { const char* repeat = getenv("LIBYUV_REPEAT"); if (repeat) { benchmark_iterations_ = atoi(repeat); // NOLINT @@ -232,19 +256,26 @@ LibYUVRotateTest::LibYUVRotateTest() : if (FLAGS_libyuv_cpu_info) { benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; } - 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); + 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() : - benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), - benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { +LibYUVPlanarTest::LibYUVPlanarTest() + : benchmark_iterations_(BENCHMARK_ITERATIONS), + benchmark_width_(128), + benchmark_height_(72), + disable_cpu_flags_(1), + benchmark_cpu_info_(-1) { const char* repeat = getenv("LIBYUV_REPEAT"); if (repeat) { benchmark_iterations_ = atoi(repeat); // NOLINT @@ -284,19 +315,26 @@ LibYUVPlanarTest::LibYUVPlanarTest() : if (FLAGS_libyuv_cpu_info) { benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; } - 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); + 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() : - benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), - benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { +LibYUVBaseTest::LibYUVBaseTest() + : benchmark_iterations_(BENCHMARK_ITERATIONS), + benchmark_width_(128), + benchmark_height_(72), + disable_cpu_flags_(1), + benchmark_cpu_info_(-1) { const char* repeat = getenv("LIBYUV_REPEAT"); if (repeat) { benchmark_iterations_ = atoi(repeat); // NOLINT @@ -336,14 +374,18 @@ LibYUVBaseTest::LibYUVBaseTest() : if (FLAGS_libyuv_cpu_info) { benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; } - 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); + 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); } int main(int argc, char** argv) { |