mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
add command line cpu info to allow android neon test
in order to compare C and Neon code, a new command line flag is added. historically environment variables controlled cpu features, but on android apk it is easier to pass a command line option to disable cpu optimizations. R=harryjin@google.com BUG=libyuv:516 Review URL: https://codereview.chromium.org/1407193009 .
This commit is contained in:
parent
1f1d140bb6
commit
c629cb3afe
@ -37,7 +37,7 @@ namespace libyuv {
|
||||
#endif
|
||||
|
||||
#define TESTCS(TESTNAME, YUVTOARGB, ARGBTOYUV, HS1, HS, HN, DIFF) \
|
||||
TEST_F(LibYUVColorTest, TESTNAME) { \
|
||||
TEST_F(LibYUVColorTest, TESTNAME) { \
|
||||
const int kPixels = benchmark_width_ * benchmark_height_; \
|
||||
const int kHalfPixels = ((benchmark_width_ + 1) / 2) * \
|
||||
((benchmark_height_ + HS1) / HS); \
|
||||
@ -101,7 +101,7 @@ namespace libyuv {
|
||||
temp_v, (benchmark_width_ + 1) / 2, \
|
||||
dst_pixels_c, benchmark_width_ * 4, \
|
||||
benchmark_width_, benchmark_height_); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
\
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
YUVTOARGB(temp_y, benchmark_width_, \
|
||||
|
||||
@ -264,7 +264,7 @@ TEST_F(LibYUVBaseTest, SumSquareError) {
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
uint64 c_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
|
||||
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
uint64 opt_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
|
||||
|
||||
EXPECT_EQ(c_err, opt_err);
|
||||
@ -281,7 +281,7 @@ TEST_F(LibYUVBaseTest, BenchmarkPsnr_Opt) {
|
||||
src_b[i] = i;
|
||||
}
|
||||
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
double opt_time = get_time();
|
||||
for (int i = 0; i < benchmark_iterations_; ++i)
|
||||
@ -306,7 +306,7 @@ TEST_F(LibYUVBaseTest, BenchmarkPsnr_Unaligned) {
|
||||
src_b[i] = i;
|
||||
}
|
||||
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
double opt_time = get_time();
|
||||
for (int i = 0; i < benchmark_iterations_; ++i)
|
||||
@ -388,7 +388,7 @@ TEST_F(LibYUVBaseTest, Psnr) {
|
||||
src_b + kSrcStride * b + b, kSrcStride,
|
||||
kSrcWidth, kSrcHeight);
|
||||
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
opt_err = CalcFramePsnr(src_a + kSrcStride * b + b, kSrcStride,
|
||||
src_b + kSrcStride * b + b, kSrcStride,
|
||||
@ -408,7 +408,7 @@ TEST_F(LibYUVBaseTest, DISABLED_BenchmarkSsim_Opt) {
|
||||
src_b[i] = i;
|
||||
}
|
||||
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
double opt_time = get_time();
|
||||
for (int i = 0; i < benchmark_iterations_; ++i)
|
||||
@ -497,7 +497,7 @@ TEST_F(LibYUVBaseTest, Ssim) {
|
||||
src_b + kSrcStride * b + b, kSrcStride,
|
||||
kSrcWidth, kSrcHeight);
|
||||
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
opt_err = CalcFrameSsim(src_a + kSrcStride * b + b, kSrcStride,
|
||||
src_b + kSrcStride * b + b, kSrcStride,
|
||||
|
||||
@ -87,7 +87,7 @@ TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \
|
||||
src_u + OFF, \
|
||||
@ -218,7 +218,7 @@ TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
dst_y_c, kWidth, \
|
||||
dst_uv_c, SUBSAMPLE(kWidth * 2, SUBSAMP_X), \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \
|
||||
src_u + OFF, \
|
||||
@ -331,7 +331,7 @@ TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \
|
||||
src_uv + OFF, \
|
||||
@ -437,7 +437,7 @@ TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##N) { \
|
||||
src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
dst_argb_c + OFF, kStrideB, \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \
|
||||
src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
@ -549,7 +549,7 @@ TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##N) { \
|
||||
src_a + OFF, kWidth, \
|
||||
dst_argb_c + OFF, kStrideB, \
|
||||
kWidth, NEG kHeight, ATTEN); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \
|
||||
src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
@ -620,7 +620,7 @@ TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##N) { \
|
||||
src_uv + OFF, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \
|
||||
dst_argb_c, kWidth * BPP_B, \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \
|
||||
src_uv + OFF, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \
|
||||
@ -713,7 +713,7 @@ TEST_F(LibYUVConvertTest, FMT_A##To##FMT_PLANAR##N) { \
|
||||
dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \
|
||||
dst_y_opt, kWidth, \
|
||||
@ -819,7 +819,7 @@ TEST_F(LibYUVConvertTest, FMT_A##To##FMT_PLANAR##N) { \
|
||||
dst_y_c, kWidth, \
|
||||
dst_uv_c, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \
|
||||
dst_y_opt, kWidth, \
|
||||
@ -895,7 +895,7 @@ TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##N) { \
|
||||
FMT_A##To##FMT_B(src_argb + OFF, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_A##To##FMT_B(src_argb + OFF, kStrideA, \
|
||||
dst_argb_opt, kStrideB, \
|
||||
@ -938,7 +938,7 @@ TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##_Random) { \
|
||||
FMT_A##To##FMT_B(src_argb, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
kWidth, kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
FMT_A##To##FMT_B(src_argb, kStrideA, \
|
||||
dst_argb_opt, kStrideB, \
|
||||
kWidth, kHeight); \
|
||||
@ -1028,7 +1028,7 @@ TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##Dither##N) { \
|
||||
FMT_A##To##FMT_B##Dither(src_argb + OFF, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
NULL, kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_A##To##FMT_B##Dither(src_argb + OFF, kStrideA, \
|
||||
dst_argb_opt, kStrideB, \
|
||||
@ -1071,7 +1071,7 @@ TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##Dither_Random) { \
|
||||
FMT_A##To##FMT_B##Dither(src_argb, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
NULL, kWidth, kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
FMT_A##To##FMT_B##Dither(src_argb, kStrideA, \
|
||||
dst_argb_opt, kStrideB, \
|
||||
NULL, kWidth, kHeight); \
|
||||
@ -1129,7 +1129,7 @@ TEST_F(LibYUVConvertTest, FMT_ATOB##_Symetric##N) { \
|
||||
FMT_ATOB(src_argb + OFF, kStrideA, \
|
||||
dst_argb_c, kStrideA, \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_ATOB(src_argb + OFF, kStrideA, \
|
||||
dst_argb_opt, kStrideA, \
|
||||
@ -1139,7 +1139,7 @@ TEST_F(LibYUVConvertTest, FMT_ATOB##_Symetric##N) { \
|
||||
FMT_ATOB(dst_argb_c, kStrideA, \
|
||||
dst_argb_c, kStrideA, \
|
||||
kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
FMT_ATOB(dst_argb_opt, kStrideA, \
|
||||
dst_argb_opt, kStrideA, \
|
||||
kWidth, NEG kHeight); \
|
||||
@ -1570,7 +1570,7 @@ TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##Dither##N) { \
|
||||
src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
dst_argb_c + OFF, kStrideB, \
|
||||
NULL, kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_PLANAR##To##FMT_B##Dither(src_y + OFF, kWidth, \
|
||||
src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
|
||||
@ -52,7 +52,16 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
|
||||
printf("Has MIPS DSPR2 %x\n", has_mips_dspr2);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVBaseTest, TestCompilerHasAVX2) {
|
||||
TEST_F(LibYUVBaseTest, TestCpuCompilerEnabled) {
|
||||
#if defined(__aarch64__)
|
||||
printf("Arm64 build\n");
|
||||
#endif
|
||||
#if defined(__aarch64__) || defined(__ARM_NEON__) || defined(LIBYUV_NEON)
|
||||
printf("Neon build enabled\n");
|
||||
#endif
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
printf("x64 build\n");
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
printf("_MSC_VER %d\n", _MSC_VER);
|
||||
#endif
|
||||
|
||||
@ -105,7 +105,8 @@ TEST_F(LibYUVPlanarTest, TestAttenuate) {
|
||||
}
|
||||
|
||||
static int TestAttenuateI(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -124,7 +125,7 @@ static int TestAttenuateI(int width, int height, int benchmark_iterations,
|
||||
ARGBAttenuate(src_argb + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBAttenuate(src_argb + off, kStride,
|
||||
dst_argb_opt, kStride,
|
||||
@ -147,34 +148,39 @@ static int TestAttenuateI(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBAttenuate_Any) {
|
||||
int max_diff = TestAttenuateI(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBAttenuate_Unaligned) {
|
||||
int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 1);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBAttenuate_Invert) {
|
||||
int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
-1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBAttenuate_Opt) {
|
||||
int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
static int TestUnattenuateI(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -196,7 +202,7 @@ static int TestUnattenuateI(int width, int height, int benchmark_iterations,
|
||||
ARGBUnattenuate(src_argb + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBUnattenuate(src_argb + off, kStride,
|
||||
dst_argb_opt, kStride,
|
||||
@ -219,28 +225,32 @@ static int TestUnattenuateI(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Any) {
|
||||
int max_diff = TestUnattenuateI(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Unaligned) {
|
||||
int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 1);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Invert) {
|
||||
int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
-1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Opt) {
|
||||
int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
@ -550,7 +560,7 @@ TEST_F(LibYUVPlanarTest, TestARGBColorMatrix) {
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
ARGBColorMatrix(&orig_pixels[0][0], 0, &dst_pixels_c[0][0], 0,
|
||||
&kRGBToSepia[0], 1280, 1);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_pixels_div1280_; ++i) {
|
||||
ARGBColorMatrix(&orig_pixels[0][0], 0, &dst_pixels_opt[0][0], 0,
|
||||
@ -951,7 +961,7 @@ TEST_F(LibYUVPlanarTest, ARGBInterpolate##TERP##N) { \
|
||||
src_argb_b + OFF, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
kWidth, NEG kHeight, TERP); \
|
||||
MaskCpuFlags(-1); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
ARGBInterpolate(src_argb_a + OFF, kStrideA, \
|
||||
src_argb_b + OFF, kStrideA, \
|
||||
@ -993,7 +1003,8 @@ TESTINTERPOLATE(192)
|
||||
TESTINTERPOLATE(255)
|
||||
|
||||
static int TestBlend(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1019,7 +1030,7 @@ static int TestBlend(int width, int height, int benchmark_iterations,
|
||||
src_argb_b + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBBlend(src_argb_a + off, kStride,
|
||||
src_argb_b + off, kStride,
|
||||
@ -1044,25 +1055,29 @@ static int TestBlend(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlend_Any) {
|
||||
int max_diff = TestBlend(benchmark_width_ - 4, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlend_Unaligned) {
|
||||
int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlend_Invert) {
|
||||
int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, -1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlend_Opt) {
|
||||
int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
@ -1344,7 +1359,7 @@ TEST_F(LibYUVPlanarTest, TestCopyPlane) {
|
||||
c_time = (get_time() - c_time) / benchmark_iterations_;
|
||||
|
||||
// Enable optimizations.
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
double opt_time = get_time();
|
||||
for (j = 0; j < benchmark_iterations_; j++) {
|
||||
CopyPlane(orig_y + y_off, y_st, dst_opt + y_off, stride, yw, yh);
|
||||
@ -1364,7 +1379,8 @@ TEST_F(LibYUVPlanarTest, TestCopyPlane) {
|
||||
}
|
||||
|
||||
static int TestMultiply(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1386,7 +1402,7 @@ static int TestMultiply(int width, int height, int benchmark_iterations,
|
||||
src_argb_b + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBMultiply(src_argb_a + off, kStride,
|
||||
src_argb_b + off, kStride,
|
||||
@ -1411,30 +1427,35 @@ static int TestMultiply(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBMultiply_Any) {
|
||||
int max_diff = TestMultiply(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBMultiply_Unaligned) {
|
||||
int max_diff = TestMultiply(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBMultiply_Invert) {
|
||||
int max_diff = TestMultiply(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, -1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBMultiply_Opt) {
|
||||
int max_diff = TestMultiply(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
static int TestAdd(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1456,7 +1477,7 @@ static int TestAdd(int width, int height, int benchmark_iterations,
|
||||
src_argb_b + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBAdd(src_argb_a + off, kStride,
|
||||
src_argb_b + off, kStride,
|
||||
@ -1481,30 +1502,35 @@ static int TestAdd(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBAdd_Any) {
|
||||
int max_diff = TestAdd(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBAdd_Unaligned) {
|
||||
int max_diff = TestAdd(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBAdd_Invert) {
|
||||
int max_diff = TestAdd(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, -1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBAdd_Opt) {
|
||||
int max_diff = TestAdd(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
static int TestSubtract(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1526,7 +1552,7 @@ static int TestSubtract(int width, int height, int benchmark_iterations,
|
||||
src_argb_b + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBSubtract(src_argb_a + off, kStride,
|
||||
src_argb_b + off, kStride,
|
||||
@ -1551,30 +1577,35 @@ static int TestSubtract(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSubtract_Any) {
|
||||
int max_diff = TestSubtract(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSubtract_Unaligned) {
|
||||
int max_diff = TestSubtract(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSubtract_Invert) {
|
||||
int max_diff = TestSubtract(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, -1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSubtract_Opt) {
|
||||
int max_diff = TestSubtract(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
static int TestSobel(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1594,7 +1625,7 @@ static int TestSobel(int width, int height, int benchmark_iterations,
|
||||
ARGBSobel(src_argb_a + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBSobel(src_argb_a + off, kStride,
|
||||
dst_argb_opt, kStride,
|
||||
@ -1617,30 +1648,35 @@ static int TestSobel(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobel_Any) {
|
||||
int max_diff = TestSobel(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobel_Unaligned) {
|
||||
int max_diff = TestSobel(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobel_Invert) {
|
||||
int max_diff = TestSobel(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, -1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobel_Opt) {
|
||||
int max_diff = TestSobel(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
static int TestSobelToPlane(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1662,7 +1698,7 @@ static int TestSobelToPlane(int width, int height, int benchmark_iterations,
|
||||
ARGBSobelToPlane(src_argb_a + off, kSrcStride,
|
||||
dst_argb_c, kDstStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBSobelToPlane(src_argb_a + off, kSrcStride,
|
||||
dst_argb_opt, kDstStride,
|
||||
@ -1685,34 +1721,39 @@ static int TestSobelToPlane(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Any) {
|
||||
int max_diff = TestSobelToPlane(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Unaligned) {
|
||||
int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Invert) {
|
||||
int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
-1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Opt) {
|
||||
int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
static int TestSobelXY(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1732,7 +1773,7 @@ static int TestSobelXY(int width, int height, int benchmark_iterations,
|
||||
ARGBSobelXY(src_argb_a + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBSobelXY(src_argb_a + off, kStride,
|
||||
dst_argb_opt, kStride,
|
||||
@ -1755,30 +1796,35 @@ static int TestSobelXY(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobelXY_Any) {
|
||||
int max_diff = TestSobelXY(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobelXY_Unaligned) {
|
||||
int max_diff = TestSobelXY(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobelXY_Invert) {
|
||||
int max_diff = TestSobelXY(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, -1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBSobelXY_Opt) {
|
||||
int max_diff = TestSobelXY(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
static int TestBlur(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off, int radius) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off, int radius) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1800,7 +1846,7 @@ static int TestBlur(int width, int height, int benchmark_iterations,
|
||||
dst_argb_c, kStride,
|
||||
reinterpret_cast<int32*>(dst_cumsum), width * 4,
|
||||
width, invert * height, radius);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBBlur(src_argb_a + off, kStride,
|
||||
dst_argb_opt, kStride,
|
||||
@ -1826,28 +1872,32 @@ static int TestBlur(int width, int height, int benchmark_iterations,
|
||||
static const int kBlurSize = 55;
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlur_Any) {
|
||||
int max_diff = TestBlur(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0, kBlurSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlur_Unaligned) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 1, kBlurSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlur_Invert) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
-1, 0, kBlurSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlur_Opt) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0, kBlurSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
@ -1855,28 +1905,32 @@ TEST_F(LibYUVPlanarTest, ARGBBlur_Opt) {
|
||||
static const int kBlurSmallSize = 5;
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Any) {
|
||||
int max_diff = TestBlur(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0, kBlurSmallSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Unaligned) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 1, kBlurSmallSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Invert) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
-1, 0, kBlurSmallSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Opt) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0, kBlurSmallSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
@ -1953,7 +2007,7 @@ TEST_F(LibYUVPlanarTest, TestARGBPolynomial) {
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
ARGBPolynomial(&orig_pixels[0][0], 0, &dst_pixels_c[0][0], 0,
|
||||
&kWarmifyPolynomial[0], 1280, 1);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_pixels_div1280_; ++i) {
|
||||
ARGBPolynomial(&orig_pixels[0][0], 0, &dst_pixels_opt[0][0], 0,
|
||||
@ -2030,7 +2084,7 @@ TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) {
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
ARGBLumaColorTable(&orig_pixels[0][0], 0, &dst_pixels_c[0][0], 0,
|
||||
lumacolortable, 1280, 1);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_pixels_div1280_; ++i) {
|
||||
ARGBLumaColorTable(&orig_pixels[0][0], 0, &dst_pixels_opt[0][0], 0,
|
||||
@ -2060,7 +2114,7 @@ TEST_F(LibYUVPlanarTest, TestARGBCopyAlpha) {
|
||||
ARGBCopyAlpha(orig_pixels, benchmark_width_ * 4,
|
||||
dst_pixels_c, benchmark_width_ * 4,
|
||||
benchmark_width_, benchmark_height_);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
ARGBCopyAlpha(orig_pixels, benchmark_width_ * 4,
|
||||
@ -2090,7 +2144,7 @@ TEST_F(LibYUVPlanarTest, TestARGBCopyYToAlpha) {
|
||||
ARGBCopyYToAlpha(orig_pixels, benchmark_width_,
|
||||
dst_pixels_c, benchmark_width_ * 4,
|
||||
benchmark_width_, benchmark_height_);
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
ARGBCopyYToAlpha(orig_pixels, benchmark_width_,
|
||||
@ -2107,7 +2161,8 @@ TEST_F(LibYUVPlanarTest, TestARGBCopyYToAlpha) {
|
||||
}
|
||||
|
||||
static int TestARGBRect(int width, int height, int benchmark_iterations,
|
||||
int disable_cpu_flags, int invert, int off, int bpp) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info,
|
||||
int invert, int off, int bpp) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -2128,7 +2183,7 @@ static int TestARGBRect(int width, int height, int benchmark_iterations,
|
||||
SetPlane(dst_argb_c + off, kStride, width, invert * height, v32);
|
||||
}
|
||||
|
||||
MaskCpuFlags(-1);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
if (bpp == 4) {
|
||||
ARGBRect(dst_argb_opt + off, kStride, 0, 0, width, invert * height, v32);
|
||||
@ -2152,56 +2207,64 @@ static int TestARGBRect(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBRect_Any) {
|
||||
int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBRect_Unaligned) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 1, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBRect_Invert) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
-1, 0, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, ARGBRect_Opt) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, SetPlane_Any) {
|
||||
int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, SetPlane_Unaligned) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 1, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, SetPlane_Invert) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
-1, 0, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, SetPlane_Opt) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_,
|
||||
+1, 0, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
@ -20,7 +20,9 @@ namespace libyuv {
|
||||
void TestRotateBpp(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations, int disable_cpu_flags,
|
||||
int benchmark_iterations,
|
||||
int disable_cpu_flags,
|
||||
int benchmark_cpu_info,
|
||||
const int kBpp) {
|
||||
if (src_width < 1) {
|
||||
src_width = 1;
|
||||
@ -54,7 +56,7 @@ void TestRotateBpp(int src_width, int src_height,
|
||||
dst_argb_c, dst_stride_argb,
|
||||
src_width, src_height, mode);
|
||||
|
||||
MaskCpuFlags(-1); // Enable all CPU optimization.
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
RotatePlane(src_argb, src_stride_argb,
|
||||
dst_argb_opt, dst_stride_argb,
|
||||
@ -66,7 +68,7 @@ void TestRotateBpp(int src_width, int src_height,
|
||||
dst_argb_c, dst_stride_argb,
|
||||
src_width, src_height, mode);
|
||||
|
||||
MaskCpuFlags(-1); // Enable all CPU optimization.
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBRotate(src_argb, src_stride_argb,
|
||||
dst_argb_opt, dst_stride_argb,
|
||||
@ -87,115 +89,137 @@ void TestRotateBpp(int src_width, int src_height,
|
||||
static void ARGBTestRotate(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations, int disable_cpu_flags) {
|
||||
int benchmark_iterations,
|
||||
int disable_cpu_flags,
|
||||
int benchmark_cpu_info) {
|
||||
TestRotateBpp(src_width, src_height,
|
||||
dst_width, dst_height,
|
||||
mode, benchmark_iterations, disable_cpu_flags, 4);
|
||||
mode, benchmark_iterations,
|
||||
disable_cpu_flags, benchmark_cpu_info, 4);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, ARGBRotate0) {
|
||||
ARGBTestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, ARGBRotate90) {
|
||||
ARGBTestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, ARGBRotate180) {
|
||||
ARGBTestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, ARGBRotate270) {
|
||||
ARGBTestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, ARGBRotate0_Odd) {
|
||||
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, ARGBRotate90_Odd) {
|
||||
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, ARGBRotate180_Odd) {
|
||||
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, ARGBRotate270_Odd) {
|
||||
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
static void TestRotatePlane(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations, int disable_cpu_flags) {
|
||||
int benchmark_iterations,
|
||||
int disable_cpu_flags,
|
||||
int benchmark_cpu_info) {
|
||||
TestRotateBpp(src_width, src_height,
|
||||
dst_width, dst_height,
|
||||
mode, benchmark_iterations, disable_cpu_flags, 1);
|
||||
mode, benchmark_iterations,
|
||||
disable_cpu_flags, benchmark_cpu_info, 1);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, RotatePlane0) {
|
||||
TestRotatePlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, RotatePlane90) {
|
||||
TestRotatePlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, RotatePlane180) {
|
||||
TestRotatePlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, RotatePlane270) {
|
||||
TestRotatePlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, RotatePlane0_Odd) {
|
||||
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, RotatePlane90_Odd) {
|
||||
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, RotatePlane180_Odd) {
|
||||
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, RotatePlane270_Odd) {
|
||||
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
@ -20,7 +20,8 @@ namespace libyuv {
|
||||
static void I420TestRotate(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations, int disable_cpu_flags) {
|
||||
int benchmark_iterations,
|
||||
int disable_cpu_flags, int benchmark_cpu_info) {
|
||||
if (src_width < 1) {
|
||||
src_width = 1;
|
||||
}
|
||||
@ -59,7 +60,7 @@ static void I420TestRotate(int src_width, int src_height,
|
||||
(dst_width + 1) / 2,
|
||||
src_width, src_height, mode);
|
||||
|
||||
MaskCpuFlags(-1); // Enable all CPU optimization.
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
I420Rotate(src_i420, src_width,
|
||||
src_i420 + src_i420_y_size, (src_width + 1) / 2,
|
||||
@ -85,55 +86,64 @@ static void I420TestRotate(int src_width, int src_height,
|
||||
TEST_F(LibYUVRotateTest, I420Rotate0) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate90) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate180) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate270) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate0_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate90_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate180_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate270_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
static void NV12TestRotate(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations, int disable_cpu_flags) {
|
||||
int benchmark_iterations,
|
||||
int disable_cpu_flags, int benchmark_cpu_info) {
|
||||
if (src_width < 1) {
|
||||
src_width = 1;
|
||||
}
|
||||
@ -172,7 +182,7 @@ static void NV12TestRotate(int src_width, int src_height,
|
||||
(dst_width + 1) / 2,
|
||||
src_width, src_height, mode);
|
||||
|
||||
MaskCpuFlags(-1); // Enable all CPU optimization.
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
NV12ToI420Rotate(src_nv12, src_width,
|
||||
src_nv12 + src_nv12_y_size, (src_width + 1) & ~1,
|
||||
@ -196,73 +206,85 @@ static void NV12TestRotate(int src_width, int src_height,
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate0) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate90) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate180) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate270) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate0_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate90_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate180_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate270_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate0_Inverted) {
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate90_Inverted) {
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate180_Inverted) {
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate270_Inverted) {
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ namespace libyuv {
|
||||
static int ARGBTestFilter(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
FilterMode f, int benchmark_iterations,
|
||||
int disable_cpu_flags) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info) {
|
||||
int i, j;
|
||||
const int b = 0; // 128 to test for padding/stride.
|
||||
int64 src_argb_plane_size = (Abs(src_width) + b * 2) *
|
||||
@ -57,7 +57,7 @@ static int ARGBTestFilter(int src_width, int src_height,
|
||||
src_width, src_height,
|
||||
dst_argb_c + (dst_stride_argb * b) + b * 4, dst_stride_argb,
|
||||
dst_width, dst_height, f);
|
||||
MaskCpuFlags(-1); // Enable all CPU optimization.
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
ARGBScale(src_argb + (src_stride_argb * b) + b * 4, src_stride_argb,
|
||||
src_width, src_height,
|
||||
dst_argb_opt + (dst_stride_argb * b) + b * 4, dst_stride_argb,
|
||||
@ -72,7 +72,7 @@ static int ARGBTestFilter(int src_width, int src_height,
|
||||
|
||||
c_time = (get_time() - c_time);
|
||||
|
||||
MaskCpuFlags(-1); // Enable all CPU optimization.
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
double opt_time = get_time();
|
||||
for (i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBScale(src_argb + (src_stride_argb * b) + b * 4, src_stride_argb,
|
||||
@ -224,7 +224,7 @@ static int ARGBClipTestFilter(int src_width, int src_height,
|
||||
DX(benchmark_width_, nom, denom), \
|
||||
DX(benchmark_height_, nom, denom), \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
disable_cpu_flags_, benchmark_cpu_info_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(LibYUVScaleTest, ARGBScaleDownClipBy##name##_##filter) { \
|
||||
@ -260,14 +260,14 @@ TEST_FACTOR(3, 1, 3)
|
||||
int diff = ARGBTestFilter(benchmark_width_, benchmark_height_, \
|
||||
width, height, \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
disable_cpu_flags_, benchmark_cpu_info_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
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_); \
|
||||
disable_cpu_flags_, benchmark_cpu_info_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(LibYUVScaleTest, name##ClipTo##width##x##height##_##filter) { \
|
||||
|
||||
@ -24,7 +24,7 @@ namespace libyuv {
|
||||
static int TestFilter(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
FilterMode f, int benchmark_iterations,
|
||||
int disable_cpu_flags) {
|
||||
int disable_cpu_flags, int benchmark_cpu_info) {
|
||||
int i, j;
|
||||
const int b = 0; // 128 to test for padding/stride.
|
||||
int src_width_uv = (Abs(src_width) + 1) >> 1;
|
||||
@ -80,7 +80,7 @@ static int TestFilter(int src_width, int src_height,
|
||||
dst_width, dst_height, f);
|
||||
c_time = (get_time() - c_time);
|
||||
|
||||
MaskCpuFlags(-1); // Enable all CPU optimization.
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
double opt_time = get_time();
|
||||
for (i = 0; i < benchmark_iterations; ++i) {
|
||||
I420Scale(src_y + (src_stride_y * b) + b, src_stride_y,
|
||||
@ -284,7 +284,7 @@ static int TestFilter_16(int src_width, int src_height,
|
||||
DX(benchmark_width_, nom, denom), \
|
||||
DX(benchmark_height_, nom, denom), \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
disable_cpu_flags_, benchmark_cpu_info_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(LibYUVScaleTest, DISABLED_ScaleDownBy##name##_##filter##_16) { \
|
||||
@ -320,14 +320,14 @@ TEST_FACTOR(3, 1, 3)
|
||||
int diff = TestFilter(benchmark_width_, benchmark_height_, \
|
||||
width, height, \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
disable_cpu_flags_, benchmark_cpu_info_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
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_); \
|
||||
disable_cpu_flags_, benchmark_cpu_info_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(LibYUVScaleTest, \
|
||||
|
||||
@ -27,6 +27,8 @@ 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. 0 = C -1 = asm");
|
||||
DEFINE_int32(libyuv_cpu_info, -1,
|
||||
"cpu flags for benchmark code. -1 = SIMD, 1 = C");
|
||||
|
||||
// For quicker unittests, default is 128 x 72. But when benchmarking,
|
||||
// default to 720p. Allow size to specify.
|
||||
@ -34,7 +36,7 @@ DEFINE_int32(libyuv_flags, 0, "cpu flags for reference code. 0 = C -1 = asm");
|
||||
|
||||
LibYUVConvertTest::LibYUVConvertTest() :
|
||||
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(130),
|
||||
benchmark_height_(72), disable_cpu_flags_(0) {
|
||||
benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) {
|
||||
const char* repeat = getenv("LIBYUV_REPEAT");
|
||||
if (repeat) {
|
||||
benchmark_iterations_ = atoi(repeat); // NOLINT
|
||||
@ -67,6 +69,13 @@ LibYUVConvertTest::LibYUVConvertTest() :
|
||||
if (FLAGS_libyuv_flags) {
|
||||
disable_cpu_flags_ = FLAGS_libyuv_flags;
|
||||
}
|
||||
const char* cpu_info = getenv("LIBYUV_CPU_INFO");
|
||||
if (cpu_info) {
|
||||
benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT
|
||||
}
|
||||
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_)) *
|
||||
@ -79,7 +88,7 @@ LibYUVConvertTest::LibYUVConvertTest() :
|
||||
|
||||
LibYUVColorTest::LibYUVColorTest() :
|
||||
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
|
||||
benchmark_height_(72), disable_cpu_flags_(0) {
|
||||
benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) {
|
||||
const char* repeat = getenv("LIBYUV_REPEAT");
|
||||
if (repeat) {
|
||||
benchmark_iterations_ = atoi(repeat); // NOLINT
|
||||
@ -112,6 +121,13 @@ LibYUVColorTest::LibYUVColorTest() :
|
||||
if (FLAGS_libyuv_flags) {
|
||||
disable_cpu_flags_ = FLAGS_libyuv_flags;
|
||||
}
|
||||
const char* cpu_info = getenv("LIBYUV_CPU_INFO");
|
||||
if (cpu_info) {
|
||||
benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT
|
||||
}
|
||||
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_)) *
|
||||
@ -124,7 +140,7 @@ LibYUVColorTest::LibYUVColorTest() :
|
||||
|
||||
LibYUVScaleTest::LibYUVScaleTest() :
|
||||
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
|
||||
benchmark_height_(72), disable_cpu_flags_(0) {
|
||||
benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) {
|
||||
const char* repeat = getenv("LIBYUV_REPEAT");
|
||||
if (repeat) {
|
||||
benchmark_iterations_ = atoi(repeat); // NOLINT
|
||||
@ -157,6 +173,13 @@ LibYUVScaleTest::LibYUVScaleTest() :
|
||||
if (FLAGS_libyuv_flags) {
|
||||
disable_cpu_flags_ = FLAGS_libyuv_flags;
|
||||
}
|
||||
const char* cpu_info = getenv("LIBYUV_CPU_INFO");
|
||||
if (cpu_info) {
|
||||
benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT
|
||||
}
|
||||
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_)) *
|
||||
@ -169,7 +192,7 @@ LibYUVScaleTest::LibYUVScaleTest() :
|
||||
|
||||
LibYUVRotateTest::LibYUVRotateTest() :
|
||||
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
|
||||
benchmark_height_(72), disable_cpu_flags_(0) {
|
||||
benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) {
|
||||
const char* repeat = getenv("LIBYUV_REPEAT");
|
||||
if (repeat) {
|
||||
benchmark_iterations_ = atoi(repeat); // NOLINT
|
||||
@ -202,6 +225,13 @@ LibYUVRotateTest::LibYUVRotateTest() :
|
||||
if (FLAGS_libyuv_flags) {
|
||||
disable_cpu_flags_ = FLAGS_libyuv_flags;
|
||||
}
|
||||
const char* cpu_info = getenv("LIBYUV_CPU_INFO");
|
||||
if (cpu_info) {
|
||||
benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT
|
||||
}
|
||||
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_)) *
|
||||
@ -214,7 +244,7 @@ LibYUVRotateTest::LibYUVRotateTest() :
|
||||
|
||||
LibYUVPlanarTest::LibYUVPlanarTest() :
|
||||
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
|
||||
benchmark_height_(72), disable_cpu_flags_(0) {
|
||||
benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) {
|
||||
const char* repeat = getenv("LIBYUV_REPEAT");
|
||||
if (repeat) {
|
||||
benchmark_iterations_ = atoi(repeat); // NOLINT
|
||||
@ -247,6 +277,13 @@ LibYUVPlanarTest::LibYUVPlanarTest() :
|
||||
if (FLAGS_libyuv_flags) {
|
||||
disable_cpu_flags_ = FLAGS_libyuv_flags;
|
||||
}
|
||||
const char* cpu_info = getenv("LIBYUV_CPU_INFO");
|
||||
if (cpu_info) {
|
||||
benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT
|
||||
}
|
||||
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_)) *
|
||||
@ -259,7 +296,7 @@ LibYUVPlanarTest::LibYUVPlanarTest() :
|
||||
|
||||
LibYUVBaseTest::LibYUVBaseTest() :
|
||||
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
|
||||
benchmark_height_(72), disable_cpu_flags_(0) {
|
||||
benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) {
|
||||
const char* repeat = getenv("LIBYUV_REPEAT");
|
||||
if (repeat) {
|
||||
benchmark_iterations_ = atoi(repeat); // NOLINT
|
||||
@ -292,6 +329,13 @@ LibYUVBaseTest::LibYUVBaseTest() :
|
||||
if (FLAGS_libyuv_flags) {
|
||||
disable_cpu_flags_ = FLAGS_libyuv_flags;
|
||||
}
|
||||
const char* cpu_info = getenv("LIBYUV_CPU_INFO");
|
||||
if (cpu_info) {
|
||||
benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT
|
||||
}
|
||||
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_)) *
|
||||
|
||||
@ -82,6 +82,7 @@ class LibYUVColorTest : public ::testing::Test {
|
||||
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.
|
||||
int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
|
||||
};
|
||||
|
||||
class LibYUVConvertTest : public ::testing::Test {
|
||||
@ -94,6 +95,7 @@ class LibYUVConvertTest : public ::testing::Test {
|
||||
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.
|
||||
int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
|
||||
};
|
||||
|
||||
class LibYUVScaleTest : public ::testing::Test {
|
||||
@ -106,6 +108,7 @@ class LibYUVScaleTest : public ::testing::Test {
|
||||
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.
|
||||
int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
|
||||
};
|
||||
|
||||
class LibYUVRotateTest : public ::testing::Test {
|
||||
@ -118,6 +121,7 @@ class LibYUVRotateTest : public ::testing::Test {
|
||||
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.
|
||||
int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
|
||||
};
|
||||
|
||||
class LibYUVPlanarTest : public ::testing::Test {
|
||||
@ -130,6 +134,7 @@ class LibYUVPlanarTest : public ::testing::Test {
|
||||
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.
|
||||
int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
|
||||
};
|
||||
|
||||
class LibYUVBaseTest : public ::testing::Test {
|
||||
@ -142,6 +147,7 @@ class LibYUVBaseTest : public ::testing::Test {
|
||||
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.
|
||||
int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
|
||||
};
|
||||
|
||||
#endif // UNIT_TEST_UNIT_TEST_H_ NOLINT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user