diff --git a/include/libyuv/row.h b/include/libyuv/row.h index eccad6582..6c5111a12 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -109,8 +109,6 @@ extern "C" { #define HAS_ARGBBLENDROW_SSSE3 #define HAS_ARGBCOLORMATRIXROW_SSSE3 #define HAS_ARGBGRAYROW_SSSE3 -#define HAS_INTERPOLATEROW_SSE2 -#define HAS_INTERPOLATEROW_SSSE3 #define HAS_ARGBMIRRORROW_SSSE3 #define HAS_ARGBMULTIPLYROW_SSE2 #define HAS_ARGBQUANTIZEROW_SSE2 @@ -120,6 +118,8 @@ extern "C" { #define HAS_ARGBUNATTENUATEROW_SSE2 #define HAS_COMPUTECUMULATIVESUMROW_SSE2 #define HAS_CUMULATIVESUMTOAVERAGEROW_SSE2 +#define HAS_INTERPOLATEROW_SSE2 +#define HAS_INTERPOLATEROW_SSSE3 #define HAS_SOBELROW_SSE2 #define HAS_SOBELXROW_SSSE3 #define HAS_SOBELXYROW_SSE2 diff --git a/source/row_posix.cc b/source/row_posix.cc index 760b9a984..b92a9f5c1 100644 --- a/source/row_posix.cc +++ b/source/row_posix.cc @@ -4896,6 +4896,7 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ); } +#ifdef HAS_INTERPOLATEROW_SSE2 // Bilinear filter 16x2 -> 16x1 void InterpolateRow_SSE2(uint8* dst_ptr, const uint8* src_ptr, ptrdiff_t src_stride, int dst_width, @@ -5006,6 +5007,7 @@ void InterpolateRow_SSE2(uint8* dst_ptr, const uint8* src_ptr, #endif ); } +#endif // HAS_INTERPOLATEROW_SSE2 // Bilinear filter 16x2 -> 16x1 void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr, @@ -5110,6 +5112,7 @@ void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ); } +#ifdef HAS_INTERPOLATEROW_SSE2 // Bilinear filter 16x2 -> 16x1 void InterpolateRow_Unaligned_SSE2(uint8* dst_ptr, const uint8* src_ptr, ptrdiff_t src_stride, int dst_width, @@ -5220,6 +5223,7 @@ void InterpolateRow_Unaligned_SSE2(uint8* dst_ptr, const uint8* src_ptr, #endif ); } +#endif // HAS_INTERPOLATEROW_SSE2 void HalfRow_SSE2(const uint8* src_uv, int src_uv_stride, uint8* dst_uv, int pix) { diff --git a/source/row_win.cc b/source/row_win.cc index 0ecd6cf49..6dc84c4ad 100644 --- a/source/row_win.cc +++ b/source/row_win.cc @@ -6028,6 +6028,7 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr, } } +#ifdef HAS_INTERPOLATEROW_SSE2 // Bilinear filter 16x2 -> 16x1 __declspec(naked) __declspec(align(16)) void InterpolateRow_SSE2(uint8* dst_ptr, const uint8* src_ptr, @@ -6138,6 +6139,7 @@ void InterpolateRow_SSE2(uint8* dst_ptr, const uint8* src_ptr, ret } } +#endif // HAS_INTERPOLATEROW_SSE2 // Bilinear filter 16x2 -> 16x1 __declspec(naked) __declspec(align(16)) @@ -6244,6 +6246,7 @@ void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr, } } +#ifdef HAS_INTERPOLATEROW_SSE2 // Bilinear filter 16x2 -> 16x1 __declspec(naked) __declspec(align(16)) void InterpolateRow_Unaligned_SSE2(uint8* dst_ptr, const uint8* src_ptr, @@ -6354,6 +6357,7 @@ void InterpolateRow_Unaligned_SSE2(uint8* dst_ptr, const uint8* src_ptr, ret } } +#endif // HAS_INTERPOLATEROW_SSE2 __declspec(naked) __declspec(align(16)) void HalfRow_SSE2(const uint8* src_uv, int src_uv_stride, diff --git a/unit_test/scale_test.cc b/unit_test/scale_test.cc index 5facf7d51..2f198bfe7 100644 --- a/unit_test/scale_test.cc +++ b/unit_test/scale_test.cc @@ -165,6 +165,45 @@ static int TestFilter(int src_width, int src_height, return max_diff; } +TEST_F(libyuvTest, ScaleDownBy1_None) { + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; + const int dst_width = Abs(src_width) / 1; + const int dst_height = Abs(src_height) / 1; + + int max_diff = TestFilter(src_width, src_height, + dst_width, dst_height, + kFilterNone, + benchmark_iterations_); + EXPECT_EQ(0, max_diff); +} + +TEST_F(libyuvTest, ScaleDownBy1_Bilinear) { + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; + const int dst_width = Abs(src_width) / 1; + const int dst_height = Abs(src_height) / 1; + + int max_diff = TestFilter(src_width, src_height, + dst_width, dst_height, + kFilterBilinear, + benchmark_iterations_); + EXPECT_LE(max_diff, 1); +} + +TEST_F(libyuvTest, ScaleDownBy1_Box) { + const int src_width = benchmark_width_; + const int src_height = benchmark_height_; + const int dst_width = Abs(src_width) / 1; + const int dst_height = Abs(src_height) / 1; + + int max_diff = TestFilter(src_width, src_height, + dst_width, dst_height, + kFilterBox, + benchmark_iterations_); + EXPECT_LE(max_diff, 1); +} + TEST_F(libyuvTest, ScaleDownBy2_None) { const int src_width = benchmark_width_; const int src_height = benchmark_height_;