summaryrefslogtreecommitdiff
path: root/chromium/third_party/libyuv/unit_test/unit_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libyuv/unit_test/unit_test.cc')
-rw-r--r--chromium/third_party/libyuv/unit_test/unit_test.cc180
1 files changed, 111 insertions, 69 deletions
diff --git a/chromium/third_party/libyuv/unit_test/unit_test.cc b/chromium/third_party/libyuv/unit_test/unit_test.cc
index e75510fd747..7f8bcf8f2c5 100644
--- a/chromium/third_party/libyuv/unit_test/unit_test.cc
+++ b/chromium/third_party/libyuv/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) {