aboutsummaryrefslogtreecommitdiff
path: root/unit_test
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2022-04-07 11:53:03 -0700
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-07 21:06:44 +0000
commit2ad73733d93e0fc8932178e4211b3b4c36443ad1 (patch)
treee8ecd7b4bedb6cdd627a85f4dc52a53858814260 /unit_test
parenta77d615e1067fe5bb48444a073f7ee08fd273b8a (diff)
downloadlibyuv-2ad73733d93e0fc8932178e4211b3b4c36443ad1.tar.gz
I422Rotate update to remove name space for ios build warning
- Remove libyuv:: from within libyuv to resolve a build warning on IOS. - Check src_y parameter is not NULL if there is a dst_y parameter - Apply clang-format - Bump version Performance on Intel Skylake Xeon ARGBRotate90_Opt (795 ms) I420Rotate90_Opt (283 ms) I422Rotate90_Opt (867 ms) <-- scales and rotates I444Rotate90_Opt (565 ms) NV12Rotate90_Opt (289 ms) Performance on Pixel 4 (Cortex A76) ARGBRotate90_Opt (4208 ms) I420Rotate90_Opt (273 ms) I422Rotate90_Opt (1207 ms) I444Rotate90_Opt (718 ms) NV12Rotate90_Opt (282 ms) Bug: libyuv:926 Change-Id: I42e1b93a9595f6ed075918e91bed977dd3d23f6f Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3576778 Reviewed-by: Mirko Bonadei <mbonadei@chromium.org> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'unit_test')
-rw-r--r--unit_test/color_test.cc14
-rw-r--r--unit_test/scale_rgb_test.cc78
2 files changed, 46 insertions, 46 deletions
diff --git a/unit_test/color_test.cc b/unit_test/color_test.cc
index a3f23ac4..01267ff1 100644
--- a/unit_test/color_test.cc
+++ b/unit_test/color_test.cc
@@ -580,28 +580,28 @@ TEST_F(LibYUVColorTest, TestGreyYUV) {
static void PrintHistogram(int rh[256], int gh[256], int bh[256]) {
int i;
- printf("hist");
+ printf("hist ");
for (i = 0; i < 256; ++i) {
if (rh[i] || gh[i] || bh[i]) {
- printf("\t%8d", i - 128);
+ printf(" %8d", i - 128);
}
}
- printf("\nred");
+ printf("\nred ");
for (i = 0; i < 256; ++i) {
if (rh[i] || gh[i] || bh[i]) {
- printf("\t%8d", rh[i]);
+ printf(" %8d", rh[i]);
}
}
printf("\ngreen");
for (i = 0; i < 256; ++i) {
if (rh[i] || gh[i] || bh[i]) {
- printf("\t%8d", gh[i]);
+ printf(" %8d", gh[i]);
}
}
- printf("\nblue");
+ printf("\nblue ");
for (i = 0; i < 256; ++i) {
if (rh[i] || gh[i] || bh[i]) {
- printf("\t%8d", bh[i]);
+ printf(" %8d", bh[i]);
}
}
printf("\n");
diff --git a/unit_test/scale_rgb_test.cc b/unit_test/scale_rgb_test.cc
index ce41ee87..9c97a90f 100644
--- a/unit_test/scale_rgb_test.cc
+++ b/unit_test/scale_rgb_test.cc
@@ -28,13 +28,13 @@ namespace libyuv {
// Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
static int RGBTestFilter(int src_width,
- int src_height,
- int dst_width,
- int dst_height,
- FilterMode f,
- int benchmark_iterations,
- int disable_cpu_flags,
- int benchmark_cpu_info) {
+ int src_height,
+ int dst_width,
+ int dst_height,
+ FilterMode f,
+ int benchmark_iterations,
+ int disable_cpu_flags,
+ int benchmark_cpu_info) {
if (!SizeValid(src_width, src_height, dst_width, dst_height)) {
return 0;
}
@@ -67,18 +67,18 @@ static int RGBTestFilter(int src_width,
// Warm up both versions for consistent benchmarks.
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
RGBScale(src_rgb + (src_stride_rgb * b) + b * 3, src_stride_rgb, src_width,
- src_height, dst_rgb_c + (dst_stride_rgb * b) + b * 3, dst_stride_rgb,
- dst_width, dst_height, f);
+ src_height, dst_rgb_c + (dst_stride_rgb * b) + b * 3, dst_stride_rgb,
+ dst_width, dst_height, f);
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
RGBScale(src_rgb + (src_stride_rgb * b) + b * 3, src_stride_rgb, src_width,
- src_height, dst_rgb_opt + (dst_stride_rgb * b) + b * 3, dst_stride_rgb,
- dst_width, dst_height, f);
+ src_height, dst_rgb_opt + (dst_stride_rgb * b) + b * 3,
+ dst_stride_rgb, dst_width, dst_height, f);
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
double c_time = get_time();
RGBScale(src_rgb + (src_stride_rgb * b) + b * 3, src_stride_rgb, src_width,
- src_height, dst_rgb_c + (dst_stride_rgb * b) + b * 3, dst_stride_rgb,
- dst_width, dst_height, f);
+ src_height, dst_rgb_c + (dst_stride_rgb * b) + b * 3, dst_stride_rgb,
+ dst_width, dst_height, f);
c_time = (get_time() - c_time);
@@ -86,8 +86,8 @@ static int RGBTestFilter(int src_width,
double opt_time = get_time();
for (i = 0; i < benchmark_iterations; ++i) {
RGBScale(src_rgb + (src_stride_rgb * b) + b * 3, src_stride_rgb, src_width,
- src_height, dst_rgb_opt + (dst_stride_rgb * b) + b * 3, dst_stride_rgb,
- dst_width, dst_height, f);
+ src_height, dst_rgb_opt + (dst_stride_rgb * b) + b * 3,
+ dst_stride_rgb, dst_width, dst_height, f);
}
opt_time = (get_time() - opt_time) / benchmark_iterations;
@@ -122,8 +122,8 @@ static int RGBTestFilter(int src_width,
#define SX(x, nom, denom) static_cast<int>((x / nom) * denom)
#define TEST_FACTOR1(name, filter, nom, denom, max_diff) \
- TEST_F(LibYUVScaleTest, RGBScaleDownBy##name##_##filter) { \
- int diff = RGBTestFilter( \
+ TEST_F(LibYUVScaleTest, RGBScaleDownBy##name##_##filter) { \
+ int diff = RGBTestFilter( \
SX(benchmark_width_, nom, denom), SX(benchmark_height_, nom, denom), \
DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \
kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \
@@ -156,19 +156,19 @@ TEST_FACTOR(3, 1, 3)
#undef SX
#undef DX
-#define TEST_SCALETO1(name, width, height, filter, max_diff) \
- TEST_F(LibYUVScaleTest, name##To##width##x##height##_##filter) { \
+#define TEST_SCALETO1(name, width, height, filter, max_diff) \
+ TEST_F(LibYUVScaleTest, name##To##width##x##height##_##filter) { \
int diff = RGBTestFilter(benchmark_width_, benchmark_height_, width, \
- height, kFilter##filter, benchmark_iterations_, \
- disable_cpu_flags_, benchmark_cpu_info_); \
- EXPECT_LE(diff, max_diff); \
- } \
- TEST_F(LibYUVScaleTest, name##From##width##x##height##_##filter) { \
+ height, kFilter##filter, benchmark_iterations_, \
+ disable_cpu_flags_, benchmark_cpu_info_); \
+ EXPECT_LE(diff, max_diff); \
+ } \
+ TEST_F(LibYUVScaleTest, name##From##width##x##height##_##filter) { \
int diff = RGBTestFilter(width, height, Abs(benchmark_width_), \
- Abs(benchmark_height_), kFilter##filter, \
- benchmark_iterations_, disable_cpu_flags_, \
- benchmark_cpu_info_); \
- EXPECT_LE(diff, max_diff); \
+ Abs(benchmark_height_), kFilter##filter, \
+ benchmark_iterations_, disable_cpu_flags_, \
+ benchmark_cpu_info_); \
+ EXPECT_LE(diff, max_diff); \
}
#if defined(ENABLE_FULL_TESTS)
@@ -194,13 +194,13 @@ TEST_SCALETO(RGBScale, 1920, 1080)
#undef TEST_SCALETO1
#undef TEST_SCALETO
-#define TEST_SCALESWAPXY1(name, filter, max_diff) \
- TEST_F(LibYUVScaleTest, name##SwapXY_##filter) { \
- int diff = \
- RGBTestFilter(benchmark_width_, benchmark_height_, benchmark_height_, \
- benchmark_width_, kFilter##filter, benchmark_iterations_, \
- disable_cpu_flags_, benchmark_cpu_info_); \
- EXPECT_LE(diff, max_diff); \
+#define TEST_SCALESWAPXY1(name, filter, max_diff) \
+ TEST_F(LibYUVScaleTest, name##SwapXY_##filter) { \
+ int diff = RGBTestFilter(benchmark_width_, benchmark_height_, \
+ benchmark_height_, benchmark_width_, \
+ kFilter##filter, benchmark_iterations_, \
+ disable_cpu_flags_, benchmark_cpu_info_); \
+ EXPECT_LE(diff, max_diff); \
}
#if defined(ENABLE_FULL_TESTS)
@@ -228,14 +228,14 @@ TEST_F(LibYUVScaleTest, RGBTest3x) {
benchmark_iterations_;
for (int i = 0; i < iterations160; ++i) {
RGBScale(orig_pixels, kSrcStride, 480, 3, dest_pixels, kDstStride, 160, 1,
- kFilterBilinear);
+ kFilterBilinear);
}
EXPECT_EQ(225, dest_pixels[0]);
EXPECT_EQ(255 - 225, dest_pixels[1]);
RGBScale(orig_pixels, kSrcStride, 480, 3, dest_pixels, kDstStride, 160, 1,
- kFilterNone);
+ kFilterNone);
EXPECT_EQ(225, dest_pixels[0]);
EXPECT_EQ(255 - 225, dest_pixels[1]);
@@ -259,14 +259,14 @@ TEST_F(LibYUVScaleTest, RGBTest4x) {
benchmark_iterations_;
for (int i = 0; i < iterations160; ++i) {
RGBScale(orig_pixels, kSrcStride, 640, 4, dest_pixels, kDstStride, 160, 1,
- kFilterBilinear);
+ kFilterBilinear);
}
EXPECT_EQ(66, dest_pixels[0]);
EXPECT_EQ(190, dest_pixels[1]);
RGBScale(orig_pixels, kSrcStride, 64, 4, dest_pixels, kDstStride, 16, 1,
- kFilterNone);
+ kFilterNone);
EXPECT_EQ(2, dest_pixels[0]); // expect the 3rd pixel of the 3rd row
EXPECT_EQ(255 - 2, dest_pixels[1]);