From 23c6a83561d324fc1cec47f7ab14b583a812d236 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Mon, 11 Jan 2016 16:33:36 -0800 Subject: [PATCH] Fix ifdef mismatch for mirroruv Macro define and macro ifdef didnt match, leading to C code being used. Make macro match function name. TBR=harryjin@google.com BUG=libyuv:543 Review URL: https://codereview.chromium.org/1579023002 . --- include/libyuv/row.h | 2 +- source/rotate.cc | 12 ++--- source/row_gcc.cc | 4 +- source/row_win.cc | 4 +- unit_test/planar_test.cc | 105 --------------------------------------- 5 files changed, 11 insertions(+), 116 deletions(-) diff --git a/include/libyuv/row.h b/include/libyuv/row.h index f7620eea1..045160c1d 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -129,7 +129,7 @@ extern "C" { #define HAS_J422TOARGBROW_SSSE3 #define HAS_MERGEUVROW_SSE2 #define HAS_MIRRORROW_SSSE3 -#define HAS_MIRRORROW_UV_SSSE3 +#define HAS_MIRRORUVROW_SSSE3 #define HAS_MIRRORUVROW_SSSE3 #define HAS_NV12TOARGBROW_SSSE3 #define HAS_NV12TORGB565ROW_SSSE3 diff --git a/source/rotate.cc b/source/rotate.cc index 31e04af9c..21fa480e1 100644 --- a/source/rotate.cc +++ b/source/rotate.cc @@ -267,22 +267,22 @@ void RotateUV180(const uint8* src, int src_stride, uint8* dst_b, int dst_stride_b, int width, int height) { int i; - void (*MirrorRowUV)(const uint8* src, uint8* dst_u, uint8* dst_v, int width) = + void (*MirrorUVRow)(const uint8* src, uint8* dst_u, uint8* dst_v, int width) = MirrorUVRow_C; #if defined(HAS_MIRRORUVROW_NEON) if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { - MirrorRowUV = MirrorUVRow_NEON; + MirrorUVRow = MirrorUVRow_NEON; } #endif -#if defined(HAS_MIRRORROW_UV_SSSE3) +#if defined(HAS_MIRRORUVROW_SSSE3) if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 16)) { - MirrorRowUV = MirrorUVRow_SSSE3; + MirrorUVRow = MirrorUVRow_SSSE3; } #endif #if defined(HAS_MIRRORUVROW_MIPS_DSPR2) if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(src, 4) && IS_ALIGNED(src_stride, 4)) { - MirrorRowUV = MirrorUVRow_MIPS_DSPR2; + MirrorUVRow = MirrorUVRow_MIPS_DSPR2; } #endif @@ -290,7 +290,7 @@ void RotateUV180(const uint8* src, int src_stride, dst_b += dst_stride_b * (height - 1); for (i = 0; i < height; ++i) { - MirrorRowUV(src, dst_a, dst_b, width); + MirrorUVRow(src, dst_a, dst_b, width); src += src_stride; dst_a -= dst_stride_a; dst_b -= dst_stride_b; diff --git a/source/row_gcc.cc b/source/row_gcc.cc index 80b2a95aa..8ac5084b6 100644 --- a/source/row_gcc.cc +++ b/source/row_gcc.cc @@ -2521,7 +2521,7 @@ void MirrorRow_AVX2(const uint8* src, uint8* dst, int width) { } #endif // HAS_MIRRORROW_AVX2 -#ifdef HAS_MIRRORROW_UV_SSSE3 +#ifdef HAS_MIRRORUVROW_SSSE3 // Shuffle table for reversing the bytes of UV channels. static uvec8 kShuffleMirrorUV = { 14u, 12u, 10u, 8u, 6u, 4u, 2u, 0u, 15u, 13u, 11u, 9u, 7u, 5u, 3u, 1u @@ -2552,7 +2552,7 @@ void MirrorUVRow_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v, "xmm0", "xmm1" ); } -#endif // HAS_MIRRORROW_UV_SSSE3 +#endif // HAS_MIRRORUVROW_SSSE3 #ifdef HAS_ARGBMIRRORROW_SSE2 diff --git a/source/row_win.cc b/source/row_win.cc index 5cb5d1e4f..f9c477f2a 100644 --- a/source/row_win.cc +++ b/source/row_win.cc @@ -3154,7 +3154,7 @@ void MirrorRow_AVX2(const uint8* src, uint8* dst, int width) { } #endif // HAS_MIRRORROW_AVX2 -#ifdef HAS_MIRRORROW_UV_SSSE3 +#ifdef HAS_MIRRORUVROW_SSSE3 // Shuffle table for reversing the bytes of UV channels. static const uvec8 kShuffleMirrorUV = { 14u, 12u, 10u, 8u, 6u, 4u, 2u, 0u, 15u, 13u, 11u, 9u, 7u, 5u, 3u, 1u @@ -3187,7 +3187,7 @@ void MirrorUVRow_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v, ret } } -#endif // HAS_MIRRORROW_UV_SSSE3 +#endif // HAS_MIRRORUVROW_SSSE3 #ifdef HAS_ARGBMIRRORROW_SSE2 __declspec(naked) diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index 3740c0783..a816f4fdd 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -1149,111 +1149,6 @@ TEST_F(LibYUVPlanarTest, ARGBBlend_Opt) { EXPECT_LE(max_diff, 1); } -#ifdef HAS_BLENDPLANEROW_AVX2 -static void TestBlendPlaneRow(int width, int height, int benchmark_iterations, - int invert, int off) { - int has_ssse3 = TestCpuFlag(kCpuHasSSSE3); - int has_avx2 = TestCpuFlag(kCpuHasAVX2); - width = width * height; - height = 1; - if (width < 256) { - width = 256; - } - const int kBpp = 1; - const int kStride = width * kBpp; - align_buffer_64(src_argb_a, kStride * height + off); - align_buffer_64(src_argb_b, kStride * height + off); - align_buffer_64(src_argb_alpha, kStride * height + off); - align_buffer_64(dst_argb_c, kStride * height + off); - align_buffer_64(dst_argb_opt, kStride * height + off); - memset(dst_argb_c, 255, kStride * height + off); - memset(dst_argb_opt, 255, kStride * height + off); - - if (has_ssse3) { - // Test source is maintained exactly if alpha is 255. - for (int i = 0; i < 256; ++i) { - src_argb_a[i + off] = i; - src_argb_b[i + off] = 255 - i; - src_argb_alpha[i + off] = 255; - } - BlendPlaneRow_SSSE3(src_argb_a + off, - src_argb_b + off, - src_argb_alpha + off, - dst_argb_opt + off, - 256); - for (int i = 0; i < 256; ++i) { - EXPECT_EQ(src_argb_a[i + off], dst_argb_opt[i + off]); - } - // Test destination is maintained exactly if alpha is 0. - for (int i = 0; i < 256; ++i) { - src_argb_a[i + off] = i; - src_argb_b[i + off] = 255 - i; - src_argb_alpha[i + off] = 0; - } - BlendPlaneRow_SSSE3(src_argb_a + off, - src_argb_b + off, - src_argb_alpha + off, - dst_argb_opt + off, - 256); - for (int i = 0; i < 256; ++i) { - EXPECT_EQ(src_argb_b[i + off], dst_argb_opt[i + off]); - } - } - for (int i = 0; i < kStride * height; ++i) { - src_argb_a[i + off] = (fastrand() & 0xff); - src_argb_b[i + off] = (fastrand() & 0xff); - src_argb_alpha[i + off] = (fastrand() & 0xff); - } - - BlendPlaneRow_C(src_argb_a + off, - src_argb_b + off, - src_argb_alpha + off, - dst_argb_c + off, - width * height); - for (int i = 0; i < benchmark_iterations; ++i) { - if (has_avx2) { - BlendPlaneRow_AVX2(src_argb_a + off, - src_argb_b + off, - src_argb_alpha + off, - dst_argb_opt + off, - width * height); - } else { - if (has_ssse3) { - BlendPlaneRow_SSSE3(src_argb_a + off, - src_argb_b + off, - src_argb_alpha + off, - dst_argb_opt + off, - width * height); - } else { - BlendPlaneRow_C(src_argb_a + off, - src_argb_b + off, - src_argb_alpha + off, - dst_argb_opt + off, - width * height); - } - } - } - for (int i = 0; i < kStride * height; ++i) { - EXPECT_EQ(dst_argb_c[i + off], dst_argb_opt[i + off]); - } - free_aligned_buffer_64(src_argb_a); - free_aligned_buffer_64(src_argb_b); - free_aligned_buffer_64(src_argb_alpha); - free_aligned_buffer_64(dst_argb_c); - free_aligned_buffer_64(dst_argb_opt); - return; -} - -TEST_F(LibYUVPlanarTest, BlendPlaneRow_Opt) { - TestBlendPlaneRow(benchmark_width_, benchmark_height_, benchmark_iterations_, - +1, 0); -} -TEST_F(LibYUVPlanarTest, BlendPlaneRow_Unaligned) { - TestBlendPlaneRow(benchmark_width_, benchmark_height_, benchmark_iterations_, - +1, 1); -} -#endif - static void TestBlendPlane(int width, int height, int benchmark_iterations, int disable_cpu_flags, int benchmark_cpu_info, int invert, int off) {