mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-01-01 03:12:16 +08:00
unittest simplify loop counter
BUG=none TEST=planar unittests Review URL: https://webrtc-codereview.appspot.com/935006 git-svn-id: http://libyuv.googlecode.com/svn/trunk@443 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
bd4fcb9877
commit
d3728d9222
@ -27,7 +27,7 @@ LOCAL_SRC_FILES := \
|
||||
source/video_common.cc \
|
||||
|
||||
# TODO(fbarchard): Enable mjpeg encoder.
|
||||
# source/mjpeg_decoder.cc
|
||||
# source/mjpeg_decoder.cc
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
LOCAL_CFLAGS += -DLIBYUV_NEON
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 442
|
||||
Version: 443
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 442
|
||||
#define LIBYUV_VERSION 443
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -756,7 +756,7 @@ TESTATOBRANDOM(ARGB, 4, 4, RGB565, 2, 2, 0)
|
||||
TESTATOBRANDOM(ARGB, 4, 4, ARGB1555, 2, 2, 0)
|
||||
TESTATOBRANDOM(ARGB, 4, 4, ARGB4444, 2, 2, 0)
|
||||
TESTATOBRANDOM(ARGB, 4, 4, I400, 1, 1, 2)
|
||||
// TODO(fbarchard, 0): Implement YUY2
|
||||
// TODO(fbarchard): Implement YUY2
|
||||
// TESTATOBRANDOM(ARGB, 4, 4, YUY2, 4, 2, 0)
|
||||
// TESTATOBRANDOM(ARGB, 4, 4, UYVY, 4, 2, 0)
|
||||
TESTATOBRANDOM(BGRA, 4, 4, ARGB, 4, 4, 0)
|
||||
|
||||
@ -80,9 +80,7 @@ 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);
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBAttenuate(&unatten_pixels[0][0], 0, &atten2_pixels[0][0], 0, 256, 1);
|
||||
}
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
@ -181,9 +179,7 @@ TEST_F(libyuvTest, TestARGBGray) {
|
||||
orig_pixels[i][2] = i / 3;
|
||||
orig_pixels[i][3] = i;
|
||||
}
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBGray(&orig_pixels[0][0], 0, 0, 0, 256, 1);
|
||||
}
|
||||
}
|
||||
@ -237,10 +233,7 @@ TEST_F(libyuvTest, TestARGBGrayTo) {
|
||||
orig_pixels[i][2] = i / 3;
|
||||
orig_pixels[i][3] = i;
|
||||
}
|
||||
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBGrayTo(&orig_pixels[0][0], 0, &gray_pixels[0][0], 0, 256, 1);
|
||||
}
|
||||
}
|
||||
@ -293,10 +286,7 @@ TEST_F(libyuvTest, TestARGBSepia) {
|
||||
orig_pixels[i][2] = i / 3;
|
||||
orig_pixels[i][3] = i;
|
||||
}
|
||||
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBSepia(&orig_pixels[0][0], 0, 0, 0, 256, 1);
|
||||
}
|
||||
}
|
||||
@ -356,10 +346,7 @@ TEST_F(libyuvTest, TestARGBColorMatrix) {
|
||||
orig_pixels[i][2] = i / 3;
|
||||
orig_pixels[i][3] = i;
|
||||
}
|
||||
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBColorMatrix(&orig_pixels[0][0], 0, &kARGBToSepia[0], 0, 0, 256, 1);
|
||||
}
|
||||
}
|
||||
@ -417,10 +404,7 @@ TEST_F(libyuvTest, TestARGBColorTable) {
|
||||
orig_pixels[i][2] = i / 3;
|
||||
orig_pixels[i][3] = i;
|
||||
}
|
||||
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 256, 1);
|
||||
}
|
||||
}
|
||||
@ -443,9 +427,7 @@ TEST_F(libyuvTest, TestARGBQuantize) {
|
||||
EXPECT_EQ(i / 3 / 8 * 8 + 8 / 2, orig_pixels[i][2]);
|
||||
EXPECT_EQ(i, orig_pixels[i][3]);
|
||||
}
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBQuantize(&orig_pixels[0][0], 0,
|
||||
(65536 + (8 / 2)) / 8, 8, 8 / 2, 0, 0, 256, 1);
|
||||
}
|
||||
@ -469,9 +451,7 @@ TEST_F(libyuvTest, TestARGBMirror) {
|
||||
EXPECT_EQ(i / 3, dst_pixels[255 - i][2]);
|
||||
EXPECT_EQ(i / 4, dst_pixels[255 - i][3]);
|
||||
}
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBMirror(&orig_pixels[0][0], 0, &dst_pixels[0][0], 0, 256, 1);
|
||||
}
|
||||
}
|
||||
@ -520,9 +500,7 @@ TEST_F(libyuvTest, TestShade) {
|
||||
EXPECT_EQ(20u, shade_pixels[0][2]);
|
||||
EXPECT_EQ(40u, shade_pixels[0][3]);
|
||||
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBShade(&orig_pixels[0][0], 0, &shade_pixels[0][0], 0, 256, 1,
|
||||
0x80808080);
|
||||
}
|
||||
@ -601,9 +579,7 @@ TEST_F(libyuvTest, TestInterpolate) {
|
||||
EXPECT_EQ(16u, interpolate_pixels[0][2]);
|
||||
EXPECT_EQ(32u, interpolate_pixels[0][3]);
|
||||
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0,
|
||||
&interpolate_pixels[0][0], 0, 256, 1, 128);
|
||||
}
|
||||
@ -639,17 +615,13 @@ TEST_F(libyuvTest, TestAffine) {
|
||||
#if defined(HAS_ARGBAFFINEROW_SSE2)
|
||||
int has_sse2 = TestCpuFlag(kCpuHasSSE2);
|
||||
if (has_sse2) {
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBAffineRow_SSE2(&orig_pixels_0[0][0], 0, &interpolate_pixels_Opt[0][0],
|
||||
uv_step, 256);
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
const int count = benchmark_iterations_ *
|
||||
benchmark_width_ * benchmark_height_ / 256;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < benchmark_pixels_div256_; ++i) {
|
||||
ARGBAffineRow_C(&orig_pixels_0[0][0], 0, &interpolate_pixels_C[0][0],
|
||||
uv_step, 256);
|
||||
}
|
||||
|
||||
@ -39,6 +39,8 @@ libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128),
|
||||
if (height) {
|
||||
benchmark_height_ = atoi(height); // NOLINT
|
||||
}
|
||||
benchmark_pixels_div256_ = (benchmark_iterations_ * benchmark_width_ *
|
||||
benchmark_height_ + 255) / 256;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
@ -69,6 +69,7 @@ class libyuvTest : public ::testing::Test {
|
||||
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.
|
||||
};
|
||||
|
||||
#endif // UNIT_TEST_UNIT_TEST_H_
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user