mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
All cpu flags to be set so that instead of comparing C code, compare assembler to assembler, for benchmarking purposes.
BUG=none TESTED=libyuv_unittest.exe R=bcornell@google.com Review URL: https://webrtc-codereview.appspot.com/50499004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@1346 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
4f46a3e03d
commit
f16f33d4ce
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1341
|
||||
Version: 1346
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1341
|
||||
#define LIBYUV_VERSION 1346
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -93,7 +93,7 @@ TEST_F(libyuvTest, TESTNAME) { \
|
||||
temp_v, (benchmark_width_ + 1) / 2, \
|
||||
benchmark_width_, benchmark_height_); \
|
||||
\
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
YUVTOARGB(temp_y, benchmark_width_, \
|
||||
temp_u, (benchmark_width_ + 1) / 2, \
|
||||
temp_v, (benchmark_width_ + 1) / 2, \
|
||||
|
||||
@ -263,7 +263,7 @@ TEST_F(libyuvTest, SumSquareError) {
|
||||
src_b[i] = (random() & 0xff);
|
||||
}
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
uint64 c_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
|
||||
|
||||
MaskCpuFlags(-1);
|
||||
@ -385,7 +385,7 @@ TEST_F(libyuvTest, Psnr) {
|
||||
}
|
||||
}
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
double c_err, opt_err;
|
||||
|
||||
c_err = CalcFramePsnr(src_a + kSrcStride * b + b, kSrcStride,
|
||||
@ -495,7 +495,7 @@ TEST_F(libyuvTest, Ssim) {
|
||||
}
|
||||
}
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
double c_err, opt_err;
|
||||
|
||||
c_err = CalcFrameSsim(src_a + kSrcStride * b + b, kSrcStride,
|
||||
|
||||
@ -78,7 +78,7 @@ TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
SUBSAMPLE(kHeight, SUBSAMP_Y)); \
|
||||
memset(dst_v_opt, 103, SUBSAMPLE(kWidth, SUBSAMP_X) * \
|
||||
SUBSAMPLE(kHeight, SUBSAMP_Y)); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \
|
||||
src_u + OFF, \
|
||||
SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \
|
||||
@ -211,7 +211,7 @@ TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
memset(dst_y_opt, 101, kWidth * kHeight); \
|
||||
memset(dst_uv_opt, 102, SUBSAMPLE(kWidth * 2, SUBSAMP_X) * \
|
||||
SUBSAMPLE(kHeight, SUBSAMP_Y)); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \
|
||||
src_u + OFF, \
|
||||
SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \
|
||||
@ -326,7 +326,7 @@ TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
SUBSAMPLE(kHeight, SUBSAMP_Y)); \
|
||||
memset(dst_v_opt, 103, SUBSAMPLE(kWidth, SUBSAMP_X) * \
|
||||
SUBSAMPLE(kHeight, SUBSAMP_Y)); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \
|
||||
src_uv + OFF, \
|
||||
2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \
|
||||
@ -435,7 +435,7 @@ TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \
|
||||
} \
|
||||
memset(dst_argb_c + OFF, 1, kStrideB * kHeight); \
|
||||
memset(dst_argb_opt + OFF, 101, kStrideB * kHeight); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \
|
||||
src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
@ -538,7 +538,7 @@ TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \
|
||||
} \
|
||||
memset(dst_argb_c, 1, kStrideB * kHeight); \
|
||||
memset(dst_argb_opt, 101, kStrideB * kHeight); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \
|
||||
src_uv + OFF, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \
|
||||
dst_argb_c, kWidth * BPP_B, \
|
||||
@ -632,7 +632,7 @@ TEST_F(libyuvTest, FMT_A##To##FMT_PLANAR##N) { \
|
||||
for (int i = 0; i < kHeight; ++i) \
|
||||
for (int j = 0; j < kStride; ++j) \
|
||||
src_argb[(i * kStride) + j + OFF] = (random() & 0xff); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \
|
||||
dst_y_c, kWidth, \
|
||||
dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
@ -738,7 +738,7 @@ TEST_F(libyuvTest, FMT_A##To##FMT_PLANAR##N) { \
|
||||
memset(dst_y_opt, 101, kWidth * kHeight); \
|
||||
memset(dst_uv_opt, 102, SUBSAMPLE(kWidth, SUBSAMP_X) * 2 * \
|
||||
SUBSAMPLE(kHeight, SUBSAMP_Y)); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \
|
||||
dst_y_c, kWidth, \
|
||||
dst_uv_c, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \
|
||||
@ -814,7 +814,7 @@ TEST_F(libyuvTest, FMT_A##To##FMT_B##N) { \
|
||||
} \
|
||||
memset(dst_argb_c, 1, kStrideB * kHeightB); \
|
||||
memset(dst_argb_opt, 101, kStrideB * kHeightB); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_A##To##FMT_B(src_argb + OFF, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
kWidth, NEG kHeight); \
|
||||
@ -858,7 +858,7 @@ TEST_F(libyuvTest, FMT_A##To##FMT_B##_Random) { \
|
||||
} \
|
||||
memset(dst_argb_c, 123, kStrideB * kHeightB); \
|
||||
memset(dst_argb_opt, 123, kStrideB * kHeightB); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_A##To##FMT_B(src_argb, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
kWidth, kHeight); \
|
||||
@ -948,7 +948,7 @@ TEST_F(libyuvTest, FMT_A##To##FMT_B##Dither##N) { \
|
||||
} \
|
||||
memset(dst_argb_c, 1, kStrideB * kHeightB); \
|
||||
memset(dst_argb_opt, 101, kStrideB * kHeightB); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_A##To##FMT_B##Dither(src_argb + OFF, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
NULL, kWidth, NEG kHeight); \
|
||||
@ -992,7 +992,7 @@ TEST_F(libyuvTest, FMT_A##To##FMT_B##Dither_Random) { \
|
||||
} \
|
||||
memset(dst_argb_c, 123, kStrideB * kHeightB); \
|
||||
memset(dst_argb_opt, 123, kStrideB * kHeightB); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_A##To##FMT_B##Dither(src_argb, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
NULL, kWidth, kHeight); \
|
||||
@ -1051,7 +1051,7 @@ TEST_F(libyuvTest, FMT_ATOB##_Symetric##N) { \
|
||||
} \
|
||||
memset(dst_argb_c, 1, kStrideA * kHeightA); \
|
||||
memset(dst_argb_opt, 101, kStrideA * kHeightA); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_ATOB(src_argb + OFF, kStrideA, \
|
||||
dst_argb_c, kStrideA, \
|
||||
kWidth, NEG kHeight); \
|
||||
@ -1061,7 +1061,7 @@ TEST_F(libyuvTest, FMT_ATOB##_Symetric##N) { \
|
||||
dst_argb_opt, kStrideA, \
|
||||
kWidth, NEG kHeight); \
|
||||
} \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_ATOB(dst_argb_c, kStrideA, \
|
||||
dst_argb_c, kStrideA, \
|
||||
kWidth, NEG kHeight); \
|
||||
@ -1470,7 +1470,7 @@ TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##Dither##N) { \
|
||||
} \
|
||||
memset(dst_argb_c + OFF, 1, kStrideB * kHeight); \
|
||||
memset(dst_argb_opt + OFF, 101, kStrideB * kHeight); \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_PLANAR##To##FMT_B##Dither(src_y + OFF, kWidth, \
|
||||
src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \
|
||||
|
||||
@ -105,7 +105,7 @@ TEST_F(libyuvTest, TestAttenuate) {
|
||||
}
|
||||
|
||||
static int TestAttenuateI(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -121,7 +121,7 @@ static int TestAttenuateI(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kStride * height);
|
||||
memset(dst_argb_opt, 0, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBAttenuate(src_argb + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
@ -148,30 +148,30 @@ static int TestAttenuateI(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBAttenuate_Any) {
|
||||
int max_diff = TestAttenuateI(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBAttenuate_Unaligned) {
|
||||
int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBAttenuate_Invert) {
|
||||
int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBAttenuate_Opt) {
|
||||
int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
static int TestUnattenuateI(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -190,7 +190,7 @@ static int TestUnattenuateI(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kStride * height);
|
||||
memset(dst_argb_opt, 0, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBUnattenuate(src_argb + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
@ -217,25 +217,25 @@ static int TestUnattenuateI(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBUnattenuate_Any) {
|
||||
int max_diff = TestUnattenuateI(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBUnattenuate_Unaligned) {
|
||||
int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBUnattenuate_Invert) {
|
||||
int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBUnattenuate_Opt) {
|
||||
int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 2);
|
||||
}
|
||||
|
||||
@ -541,7 +541,7 @@ TEST_F(libyuvTest, TestARGBColorMatrix) {
|
||||
orig_pixels[i][2] = i / 3;
|
||||
orig_pixels[i][3] = i;
|
||||
}
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
ARGBColorMatrix(&orig_pixels[0][0], 0, &dst_pixels_c[0][0], 0,
|
||||
&kRGBToSepia[0], 1280, 1);
|
||||
MaskCpuFlags(-1);
|
||||
@ -941,7 +941,7 @@ TEST_F(libyuvTest, ARGBInterpolate##TERP##N) { \
|
||||
src_argb_a[i + OFF] = (random() & 0xff); \
|
||||
src_argb_b[i + OFF] = (random() & 0xff); \
|
||||
} \
|
||||
MaskCpuFlags(0); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
ARGBInterpolate(src_argb_a + OFF, kStrideA, \
|
||||
src_argb_b + OFF, kStrideA, \
|
||||
dst_argb_c, kStrideB, \
|
||||
@ -988,7 +988,7 @@ TESTINTERPOLATE(192)
|
||||
TESTINTERPOLATE(255)
|
||||
|
||||
static int TestBlend(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1010,7 +1010,7 @@ static int TestBlend(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 255, kStride * height);
|
||||
memset(dst_argb_opt, 255, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBBlend(src_argb_a + off, kStride,
|
||||
src_argb_b + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
@ -1040,25 +1040,25 @@ static int TestBlend(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlend_Any) {
|
||||
int max_diff = TestBlend(benchmark_width_ - 4, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlend_Unaligned) {
|
||||
int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlend_Invert) {
|
||||
int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlend_Opt) {
|
||||
int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
@ -1333,7 +1333,7 @@ TEST_F(libyuvTest, TestCopyPlane) {
|
||||
int stride = 8;
|
||||
|
||||
// Disable all optimizations.
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
double c_time = get_time();
|
||||
for (j = 0; j < benchmark_iterations_; j++) {
|
||||
CopyPlane(orig_y + y_off, y_st, dst_c + y_off, stride, yw, yh);
|
||||
@ -1361,7 +1361,7 @@ TEST_F(libyuvTest, TestCopyPlane) {
|
||||
}
|
||||
|
||||
static int TestMultiply(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1379,7 +1379,7 @@ static int TestMultiply(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kStride * height);
|
||||
memset(dst_argb_opt, 0, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBMultiply(src_argb_a + off, kStride,
|
||||
src_argb_b + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
@ -1409,30 +1409,30 @@ static int TestMultiply(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBMultiply_Any) {
|
||||
int max_diff = TestMultiply(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBMultiply_Unaligned) {
|
||||
int max_diff = TestMultiply(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBMultiply_Invert) {
|
||||
int max_diff = TestMultiply(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBMultiply_Opt) {
|
||||
int max_diff = TestMultiply(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
static int TestAdd(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1450,7 +1450,7 @@ static int TestAdd(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kStride * height);
|
||||
memset(dst_argb_opt, 0, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBAdd(src_argb_a + off, kStride,
|
||||
src_argb_b + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
@ -1480,30 +1480,30 @@ static int TestAdd(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBAdd_Any) {
|
||||
int max_diff = TestAdd(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBAdd_Unaligned) {
|
||||
int max_diff = TestAdd(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBAdd_Invert) {
|
||||
int max_diff = TestAdd(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBAdd_Opt) {
|
||||
int max_diff = TestAdd(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
static int TestSubtract(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1521,7 +1521,7 @@ static int TestSubtract(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kStride * height);
|
||||
memset(dst_argb_opt, 0, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBSubtract(src_argb_a + off, kStride,
|
||||
src_argb_b + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
@ -1551,30 +1551,30 @@ static int TestSubtract(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBSubtract_Any) {
|
||||
int max_diff = TestSubtract(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSubtract_Unaligned) {
|
||||
int max_diff = TestSubtract(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSubtract_Invert) {
|
||||
int max_diff = TestSubtract(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSubtract_Opt) {
|
||||
int max_diff = TestSubtract(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
static int TestSobel(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1591,7 +1591,7 @@ static int TestSobel(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kStride * height);
|
||||
memset(dst_argb_opt, 0, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBSobel(src_argb_a + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
@ -1618,30 +1618,30 @@ static int TestSobel(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobel_Any) {
|
||||
int max_diff = TestSobel(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobel_Unaligned) {
|
||||
int max_diff = TestSobel(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobel_Invert) {
|
||||
int max_diff = TestSobel(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobel_Opt) {
|
||||
int max_diff = TestSobel(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
static int TestSobelToPlane(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1660,7 +1660,7 @@ static int TestSobelToPlane(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kDstStride * height);
|
||||
memset(dst_argb_opt, 0, kDstStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBSobelToPlane(src_argb_a + off, kSrcStride,
|
||||
dst_argb_c, kDstStride,
|
||||
width, invert * height);
|
||||
@ -1687,30 +1687,30 @@ static int TestSobelToPlane(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobelToPlane_Any) {
|
||||
int max_diff = TestSobelToPlane(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobelToPlane_Unaligned) {
|
||||
int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobelToPlane_Invert) {
|
||||
int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobelToPlane_Opt) {
|
||||
int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
static int TestSobelXY(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
int disable_cpu_flags, int invert, int off) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1727,7 +1727,7 @@ static int TestSobelXY(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kStride * height);
|
||||
memset(dst_argb_opt, 0, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBSobelXY(src_argb_a + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
width, invert * height);
|
||||
@ -1754,30 +1754,30 @@ static int TestSobelXY(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobelXY_Any) {
|
||||
int max_diff = TestSobelXY(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobelXY_Unaligned) {
|
||||
int max_diff = TestSobelXY(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobelXY_Invert) {
|
||||
int max_diff = TestSobelXY(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBSobelXY_Opt) {
|
||||
int max_diff = TestSobelXY(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
static int TestBlur(int width, int height, int benchmark_iterations,
|
||||
int invert, int off, int radius) {
|
||||
int disable_cpu_flags, int invert, int off, int radius) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -1795,7 +1795,7 @@ static int TestBlur(int width, int height, int benchmark_iterations,
|
||||
memset(dst_argb_c, 0, kStride * height);
|
||||
memset(dst_argb_opt, 0, kStride * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBBlur(src_argb_a + off, kStride,
|
||||
dst_argb_c, kStride,
|
||||
reinterpret_cast<int32*>(dst_cumsum), width * 4,
|
||||
@ -1826,50 +1826,50 @@ static int TestBlur(int width, int height, int benchmark_iterations,
|
||||
static const int kBlurSize = 55;
|
||||
TEST_F(libyuvTest, ARGBBlur_Any) {
|
||||
int max_diff = TestBlur(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, kBlurSize);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0, kBlurSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlur_Unaligned) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1, kBlurSize);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1, kBlurSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlur_Invert) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0, kBlurSize);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0, kBlurSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlur_Opt) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, kBlurSize);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0, kBlurSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
static const int kBlurSmallSize = 5;
|
||||
TEST_F(libyuvTest, ARGBBlurSmall_Any) {
|
||||
int max_diff = TestBlur(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, kBlurSmallSize);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0, kBlurSmallSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlurSmall_Unaligned) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1, kBlurSmallSize);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1, kBlurSmallSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlurSmall_Invert) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0, kBlurSmallSize);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0, kBlurSmallSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlurSmall_Opt) {
|
||||
int max_diff = TestBlur(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, kBlurSmallSize);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0, kBlurSmallSize);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
@ -1942,7 +1942,7 @@ TEST_F(libyuvTest, TestARGBPolynomial) {
|
||||
orig_pixels[i][3] = i;
|
||||
}
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
ARGBPolynomial(&orig_pixels[0][0], 0, &dst_pixels_c[0][0], 0,
|
||||
&kWarmifyPolynomial[0], 1280, 1);
|
||||
MaskCpuFlags(-1);
|
||||
@ -2019,7 +2019,7 @@ TEST_F(libyuvTest, TestARGBLumaColorTable) {
|
||||
orig_pixels[i][3] = i;
|
||||
}
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
ARGBLumaColorTable(&orig_pixels[0][0], 0, &dst_pixels_c[0][0], 0,
|
||||
lumacolortable, 1280, 1);
|
||||
MaskCpuFlags(-1);
|
||||
@ -2048,7 +2048,7 @@ TEST_F(libyuvTest, TestARGBCopyAlpha) {
|
||||
MemRandomize(dst_pixels_opt, kSize);
|
||||
memcpy(dst_pixels_c, dst_pixels_opt, kSize);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
ARGBCopyAlpha(orig_pixels, benchmark_width_ * 4,
|
||||
dst_pixels_c, benchmark_width_ * 4,
|
||||
benchmark_width_, benchmark_height_);
|
||||
@ -2078,7 +2078,7 @@ TEST_F(libyuvTest, TestARGBCopyYToAlpha) {
|
||||
MemRandomize(dst_pixels_opt, kPixels * 4);
|
||||
memcpy(dst_pixels_c, dst_pixels_opt, kPixels * 4);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
ARGBCopyYToAlpha(orig_pixels, benchmark_width_,
|
||||
dst_pixels_c, benchmark_width_ * 4,
|
||||
benchmark_width_, benchmark_height_);
|
||||
@ -2099,7 +2099,7 @@ TEST_F(libyuvTest, TestARGBCopyYToAlpha) {
|
||||
}
|
||||
|
||||
static int TestARGBRect(int width, int height, int benchmark_iterations,
|
||||
int invert, int off, int bpp) {
|
||||
int disable_cpu_flags, int invert, int off, int bpp) {
|
||||
if (width < 1) {
|
||||
width = 1;
|
||||
}
|
||||
@ -2113,7 +2113,7 @@ static int TestARGBRect(int width, int height, int benchmark_iterations,
|
||||
MemRandomize(dst_argb_c + off, kSize);
|
||||
memcpy(dst_argb_opt + off, dst_argb_c + off, kSize);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
if (bpp == 4) {
|
||||
ARGBRect(dst_argb_c + off, kStride, 0, 0, width, invert * height, v32);
|
||||
} else {
|
||||
@ -2144,49 +2144,49 @@ static int TestARGBRect(int width, int height, int benchmark_iterations,
|
||||
|
||||
TEST_F(libyuvTest, ARGBRect_Any) {
|
||||
int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, 4);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRect_Unaligned) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1, 4);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRect_Invert) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0, 4);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRect_Opt) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, 4);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, SetPlane_Any) {
|
||||
int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, SetPlane_Unaligned) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 1, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, SetPlane_Invert) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, -1, 0, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, SetPlane_Opt) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, 1);
|
||||
benchmark_iterations_, disable_cpu_flags_, +1, 0, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ namespace libyuv {
|
||||
void TestRotateBpp(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations,
|
||||
int benchmark_iterations, int disable_cpu_flags,
|
||||
const int kBpp) {
|
||||
if (src_width < 1) {
|
||||
src_width = 1;
|
||||
@ -49,7 +49,7 @@ void TestRotateBpp(int src_width, int src_height,
|
||||
memset(dst_argb_opt, 3, dst_argb_plane_size);
|
||||
|
||||
if (kBpp == 1) {
|
||||
MaskCpuFlags(0); // Disable all CPU optimization.
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
RotatePlane(src_argb, src_stride_argb,
|
||||
dst_argb_c, dst_stride_argb,
|
||||
src_width, src_height, mode);
|
||||
@ -61,7 +61,7 @@ void TestRotateBpp(int src_width, int src_height,
|
||||
src_width, src_height, mode);
|
||||
}
|
||||
} else if (kBpp == 4) {
|
||||
MaskCpuFlags(0); // Disable all CPU optimization.
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
ARGBRotate(src_argb, src_stride_argb,
|
||||
dst_argb_c, dst_stride_argb,
|
||||
src_width, src_height, mode);
|
||||
@ -87,115 +87,115 @@ 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 benchmark_iterations, int disable_cpu_flags) {
|
||||
TestRotateBpp(src_width, src_height,
|
||||
dst_width, dst_height,
|
||||
mode, benchmark_iterations, 4);
|
||||
mode, benchmark_iterations, disable_cpu_flags, 4);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRotate0) {
|
||||
ARGBTestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_);
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRotate90) {
|
||||
ARGBTestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_);
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRotate180) {
|
||||
ARGBTestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_);
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRotate270) {
|
||||
ARGBTestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_);
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRotate0_Odd) {
|
||||
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_);
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRotate90_Odd) {
|
||||
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_);
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRotate180_Odd) {
|
||||
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_);
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRotate270_Odd) {
|
||||
ARGBTestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_);
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
static void TestRotatePlane(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations) {
|
||||
int benchmark_iterations, int disable_cpu_flags) {
|
||||
TestRotateBpp(src_width, src_height,
|
||||
dst_width, dst_height,
|
||||
mode, benchmark_iterations, 1);
|
||||
mode, benchmark_iterations, disable_cpu_flags, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, RotatePlane0) {
|
||||
TestRotatePlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_);
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, RotatePlane90) {
|
||||
TestRotatePlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_);
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, RotatePlane180) {
|
||||
TestRotatePlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_);
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, RotatePlane270) {
|
||||
TestRotatePlane(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_);
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, RotatePlane0_Odd) {
|
||||
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_);
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, RotatePlane90_Odd) {
|
||||
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_);
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, RotatePlane180_Odd) {
|
||||
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_);
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, RotatePlane270_Odd) {
|
||||
TestRotatePlane(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_);
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
@ -20,7 +20,7 @@ namespace libyuv {
|
||||
static void I420TestRotate(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations) {
|
||||
int benchmark_iterations, int disable_cpu_flags) {
|
||||
if (src_width < 1) {
|
||||
src_width = 1;
|
||||
}
|
||||
@ -49,7 +49,7 @@ static void I420TestRotate(int src_width, int src_height,
|
||||
memset(dst_i420_c, 2, dst_i420_size);
|
||||
memset(dst_i420_opt, 3, dst_i420_size);
|
||||
|
||||
MaskCpuFlags(0); // Disable all CPU optimization.
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
I420Rotate(src_i420, src_width,
|
||||
src_i420 + src_i420_y_size, (src_width + 1) / 2,
|
||||
src_i420 + src_i420_y_size + src_i420_uv_size, (src_width + 1) / 2,
|
||||
@ -85,55 +85,55 @@ static void I420TestRotate(int src_width, int src_height,
|
||||
TEST_F(libyuvTest, I420Rotate0) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_);
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, I420Rotate90) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_);
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, I420Rotate180) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_);
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, I420Rotate270) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_);
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, I420Rotate0_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_);
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, I420Rotate90_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_);
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, I420Rotate180_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_);
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, I420Rotate270_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_);
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
static void NV12TestRotate(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations) {
|
||||
int benchmark_iterations, int disable_cpu_flags) {
|
||||
if (src_width < 1) {
|
||||
src_width = 1;
|
||||
}
|
||||
@ -162,7 +162,7 @@ static void NV12TestRotate(int src_width, int src_height,
|
||||
memset(dst_i420_c, 2, dst_i420_size);
|
||||
memset(dst_i420_opt, 3, dst_i420_size);
|
||||
|
||||
MaskCpuFlags(0); // Disable all CPU optimization.
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
NV12ToI420Rotate(src_nv12, src_width,
|
||||
src_nv12 + src_nv12_y_size, (src_width + 1) & ~1,
|
||||
dst_i420_c, dst_width,
|
||||
@ -195,49 +195,49 @@ static void NV12TestRotate(int src_width, int src_height,
|
||||
TEST_F(libyuvTest, NV12Rotate0) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_);
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, NV12Rotate90) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_);
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, NV12Rotate180) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_);
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, NV12Rotate270) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_);
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, NV12Rotate0_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_);
|
||||
kRotate0, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, NV12Rotate90_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_);
|
||||
kRotate90, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, NV12Rotate180_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_);
|
||||
kRotate180, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, NV12Rotate270_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_);
|
||||
kRotate270, benchmark_iterations_, disable_cpu_flags_);
|
||||
}
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
@ -21,7 +21,8 @@ namespace libyuv {
|
||||
// Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
|
||||
static int ARGBTestFilter(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
FilterMode f, int benchmark_iterations) {
|
||||
FilterMode f, int benchmark_iterations,
|
||||
int disable_cpu_flags) {
|
||||
int i, j;
|
||||
const int b = 0; // 128 to test for padding/stride.
|
||||
int src_argb_plane_size = (Abs(src_width) + b * 2) *
|
||||
@ -41,7 +42,7 @@ static int ARGBTestFilter(int src_width, int src_height,
|
||||
memset(dst_argb_opt, 3, dst_argb_plane_size);
|
||||
|
||||
// Warm up both versions for consistent benchmarks.
|
||||
MaskCpuFlags(0); // Disable all CPU optimization.
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
ARGBScale(src_argb + (src_stride_argb * b) + b * 4, src_stride_argb,
|
||||
src_width, src_height,
|
||||
dst_argb_c + (dst_stride_argb * b) + b * 4, dst_stride_argb,
|
||||
@ -52,7 +53,7 @@ static int ARGBTestFilter(int src_width, int src_height,
|
||||
dst_argb_opt + (dst_stride_argb * b) + b * 4, dst_stride_argb,
|
||||
dst_width, dst_height, f);
|
||||
|
||||
MaskCpuFlags(0); // Disable all CPU optimization.
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
double c_time = get_time();
|
||||
ARGBScale(src_argb + (src_stride_argb * b) + b * 4, src_stride_argb,
|
||||
src_width, src_height,
|
||||
@ -200,7 +201,8 @@ static int ARGBClipTestFilter(int src_width, int src_height,
|
||||
int diff = ARGBTestFilter(benchmark_width_, benchmark_height_, \
|
||||
Abs(benchmark_width_) * hfactor, \
|
||||
Abs(benchmark_height_) * vfactor, \
|
||||
kFilter##filter, benchmark_iterations_); \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(libyuvTest, ARGBScaleDownClipBy##name##_##filter) { \
|
||||
@ -231,13 +233,15 @@ TEST_FACTOR(3by8, 3 / 8, 3 / 8)
|
||||
TEST_F(libyuvTest, name##To##width##x##height##_##filter) { \
|
||||
int diff = ARGBTestFilter(benchmark_width_, benchmark_height_, \
|
||||
width, height, \
|
||||
kFilter##filter, benchmark_iterations_); \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(libyuvTest, name##From##width##x##height##_##filter) { \
|
||||
int diff = ARGBTestFilter(width, height, \
|
||||
Abs(benchmark_width_), Abs(benchmark_height_), \
|
||||
kFilter##filter, benchmark_iterations_); \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(libyuvTest, name##ClipTo##width##x##height##_##filter) { \
|
||||
|
||||
@ -20,7 +20,8 @@ namespace libyuv {
|
||||
// Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
|
||||
static int TestFilter(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
FilterMode f, int benchmark_iterations) {
|
||||
FilterMode f, int benchmark_iterations,
|
||||
int disable_cpu_flags) {
|
||||
int i, j;
|
||||
const int b = 0; // 128 to test for padding/stride.
|
||||
int src_width_uv = (Abs(src_width) + 1) >> 1;
|
||||
@ -56,8 +57,7 @@ static int TestFilter(int src_width, int src_height,
|
||||
align_buffer_page_end(dst_u_opt, dst_uv_plane_size)
|
||||
align_buffer_page_end(dst_v_opt, dst_uv_plane_size)
|
||||
|
||||
|
||||
MaskCpuFlags(0); // Disable all CPU optimization.
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
double c_time = get_time();
|
||||
I420Scale(src_y + (src_stride_y * b) + b, src_stride_y,
|
||||
src_u + (src_stride_uv * b) + b, src_stride_uv,
|
||||
@ -265,7 +265,8 @@ static int TestFilter_16(int src_width, int src_height,
|
||||
int diff = TestFilter(benchmark_width_, benchmark_height_, \
|
||||
Abs(benchmark_width_) * hfactor, \
|
||||
Abs(benchmark_height_) * vfactor, \
|
||||
kFilter##filter, benchmark_iterations_); \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(libyuvTest, ScaleDownBy##name##_##filter##_16) { \
|
||||
@ -296,13 +297,15 @@ TEST_FACTOR(3by8, 3 / 8, 3 / 8)
|
||||
TEST_F(libyuvTest, name##To##width##x##height##_##filter) { \
|
||||
int diff = TestFilter(benchmark_width_, benchmark_height_, \
|
||||
width, height, \
|
||||
kFilter##filter, benchmark_iterations_); \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(libyuvTest, name##From##width##x##height##_##filter) { \
|
||||
int diff = TestFilter(width, height, \
|
||||
Abs(benchmark_width_), Abs(benchmark_height_), \
|
||||
kFilter##filter, benchmark_iterations_); \
|
||||
kFilter##filter, benchmark_iterations_, \
|
||||
disable_cpu_flags_); \
|
||||
EXPECT_LE(diff, max_diff); \
|
||||
} \
|
||||
TEST_F(libyuvTest, name##To##width##x##height##_##filter##_16) { \
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128),
|
||||
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
|
||||
benchmark_height_(72) {
|
||||
benchmark_height_(72), disable_cpu_flags_(0) {
|
||||
const char* repeat = getenv("LIBYUV_REPEAT");
|
||||
if (repeat) {
|
||||
benchmark_iterations_ = atoi(repeat); // NOLINT
|
||||
@ -39,6 +39,10 @@ libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128),
|
||||
if (height) {
|
||||
benchmark_height_ = atoi(height); // NOLINT
|
||||
}
|
||||
const char* cpu_flags = getenv("LIBYUV_FLAGS");
|
||||
if (cpu_flags) {
|
||||
disable_cpu_flags_ = atoi(cpu_flags); // NOLINT
|
||||
}
|
||||
benchmark_pixels_div256_ = static_cast<int>((
|
||||
static_cast<double>(Abs(benchmark_width_)) *
|
||||
static_cast<double>(Abs(benchmark_height_)) *
|
||||
|
||||
@ -81,6 +81,7 @@ class libyuvTest : public ::testing::Test {
|
||||
int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
|
||||
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.
|
||||
};
|
||||
|
||||
#endif // UNIT_TEST_UNIT_TEST_H_ NOLINT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user