From 83a63e65a6bcbf59f7dc617d0c7275d50625884c Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Wed, 27 Feb 2013 00:20:29 +0000 Subject: [PATCH] Change YUV_DISABLE_ASM to LIBYUV_DISABLE_NEON, LIBYUV_DISABLE_MIPS, LIBYUV_DISABLE_X86 BUG=189 TESTED=try Review URL: https://webrtc-codereview.appspot.com/1113006 git-svn-id: http://libyuv.googlecode.com/svn/trunk@582 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/planar_functions.h | 6 +++--- include/libyuv/row.h | 14 +++++++------- include/libyuv/version.h | 2 +- libyuv.gyp | 3 +++ libyuv_test.gyp | 3 +++ source/compare.cc | 9 +++++---- source/compare_neon.cc | 2 +- source/compare_posix.cc | 4 ++-- source/compare_win.cc | 4 ++-- source/convert.cc | 5 +++-- source/rotate.cc | 21 ++++++++++----------- source/rotate_argb.cc | 5 +++-- source/rotate_mips.cc | 3 ++- source/rotate_neon.cc | 3 +-- source/row_common.cc | 7 ++++--- source/row_mips.cc | 3 ++- source/row_neon.cc | 2 +- source/row_posix.cc | 2 +- source/row_win.cc | 2 +- source/scale.cc | 14 +++++++------- source/scale_argb.cc | 9 ++++----- source/scale_argb_neon.cc | 3 +-- source/scale_mips.cc | 3 ++- source/scale_neon.cc | 10 +++------- unit_test/planar_test.cc | 14 ++------------ 26 files changed, 75 insertions(+), 80 deletions(-) diff --git a/README.chromium b/README.chromium index 8d3d46413..99005b5c6 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 581 +Version: 582 License: BSD License File: LICENSE diff --git a/include/libyuv/planar_functions.h b/include/libyuv/planar_functions.h index 23c893d4d..f74bf0813 100644 --- a/include/libyuv/planar_functions.h +++ b/include/libyuv/planar_functions.h @@ -324,7 +324,7 @@ int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0, #if defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ defined(TARGET_IPHONE_SIMULATOR) -#define YUV_DISABLE_ASM +#define LIBYUV_DISABLE_X86 #endif // Row functions for copying a pixels from a source with a slope to a row // of destination. Useful for scaling, rotation, mirror, texture mapping. @@ -332,13 +332,13 @@ LIBYUV_API void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride, uint8* dst_argb, const float* uv_dudv, int width); // The following are available on all x86 platforms: -#if !defined(YUV_DISABLE_ASM) && \ +#if !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) LIBYUV_API void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride, uint8* dst_argb, const float* uv_dudv, int width); #define HAS_ARGBAFFINEROW_SSE2 -#endif +#endif // LIBYUV_DISABLE_X86 #ifdef __cplusplus } // extern "C" diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 85cf923d2..c0fed6db6 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -24,7 +24,7 @@ extern "C" { #if defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ defined(TARGET_IPHONE_SIMULATOR) -#define YUV_DISABLE_ASM +#define LIBYUV_DISABLE_X86 #endif // True if compiling for SSSE3 as a requirement. #if defined(__SSSE3__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 3)) @@ -32,7 +32,7 @@ extern "C" { #endif // The following are available on all x86 platforms: -#if !defined(YUV_DISABLE_ASM) && \ +#if !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) // Conversions. #define HAS_ABGRTOARGBROW_SSSE3 @@ -121,7 +121,7 @@ extern "C" { // The following are Windows only. // TODO(fbarchard): Port to gcc. -#if !defined(YUV_DISABLE_ASM) && defined(_M_IX86) +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) #define HAS_ARGBCOLORTABLEROW_X86 #define HAS_COPYROW_AVX2 // Visual C 2012 required for AVX2. @@ -146,7 +146,7 @@ extern "C" { // The following are Yasm x86 only. // TODO(fbarchard): Port AVX2 to inline. -#if !defined(YUV_DISABLE_ASM) && defined(HAVE_YASM) +#if !defined(LIBYUV_DISABLE_X86) && defined(HAVE_YASM) (defined(_M_IX86) || defined(_M_X64) || \ defined(__x86_64__) || defined(__i386__)) #define HAS_SPLITUVROW_AVX2 @@ -160,7 +160,7 @@ extern "C" { #endif // The following are disabled when SSSE3 is available: -#if !defined(YUV_DISABLE_ASM) && \ +#if !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) && \ !defined(LIBYUV_SSSE3_ONLY) #define HAS_ARGBATTENUATEROW_SSE2 @@ -169,7 +169,7 @@ extern "C" { #endif // The following are available on Neon platforms -#if !defined(YUV_DISABLE_ASM) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) +#if !defined(LIBYUV_DISABLE_NEON) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) #define HAS_ABGRTOARGBROW_NEON #define HAS_ABGRTOUVROW_NEON #define HAS_ABGRTOYROW_NEON @@ -257,7 +257,7 @@ extern "C" { #endif // The following are available on Mips platforms -#if !defined(YUV_DISABLE_ASM) && defined(__mips__) +#if !defined(LIBYUV_DISABLE_MIPS) && defined(__mips__) #define HAS_COPYROW_MIPS #if defined(__mips_dsp) && (__mips_dsp_rev >= 2) #define HAS_SPLITUVROW_MIPS_DSPR2 diff --git a/include/libyuv/version.h b/include/libyuv/version.h index e8b58732b..fd8e4f3d3 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 581 +#define LIBYUV_VERSION 582 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/libyuv.gyp b/libyuv.gyp index eccf829f7..2daa28092 100644 --- a/libyuv.gyp +++ b/libyuv.gyp @@ -30,6 +30,9 @@ ], 'defines': [ 'HAVE_JPEG', + # 'LIBYUV_DISABLE_X86', + # 'LIBYUV_DISABLE_NEON', + # 'LIBYUV_DISABLE_MIPS', # 'LIBYUV_BUILDING_SHARED_LIBRARY', ], 'include_dirs': [ diff --git a/libyuv_test.gyp b/libyuv_test.gyp index e26151d06..15e5aaa3b 100644 --- a/libyuv_test.gyp +++ b/libyuv_test.gyp @@ -19,6 +19,9 @@ ], 'defines': [ 'LIBYUV_SVNREVISION="= 1700 +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && _MSC_VER >= 1700 #define HAS_SUMSQUAREERROR_AVX2 uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count); #endif diff --git a/source/compare_neon.cc b/source/compare_neon.cc index c2cc8d021..1f80b5244 100644 --- a/source/compare_neon.cc +++ b/source/compare_neon.cc @@ -15,7 +15,7 @@ namespace libyuv { extern "C" { #endif -#if !defined(YUV_DISABLE_ASM) && defined(__ARM_NEON__) +#if !defined(LIBYUV_DISABLE_NEON) && defined(__ARM_NEON__) uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) { volatile uint32 sse; diff --git a/source/compare_posix.cc b/source/compare_posix.cc index 229a08912..6aae023b7 100644 --- a/source/compare_posix.cc +++ b/source/compare_posix.cc @@ -16,7 +16,7 @@ namespace libyuv { extern "C" { #endif -#if !defined(YUV_DISABLE_ASM) && (defined(__x86_64__) || defined(__i386__)) +#if !defined(LIBYUV_DISABLE_X86) && (defined(__x86_64__) || defined(__i386__)) uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count) { uint32 sse; @@ -64,7 +64,7 @@ uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count) { #endif // defined(__x86_64__) || defined(__i386__) -#if !defined(YUV_DISABLE_ASM) && \ +#if !defined(LIBYUV_DISABLE_X86) && \ (defined(__x86_64__) || (defined(__i386__) && !defined(__pic__))) // GCC 4.2 on OSX has link error when passing static or const to inline. // TODO(fbarchard): Use static const when gcc 4.2 support is dropped. diff --git a/source/compare_win.cc b/source/compare_win.cc index 720152fd4..b8e74648c 100644 --- a/source/compare_win.cc +++ b/source/compare_win.cc @@ -16,7 +16,7 @@ namespace libyuv { extern "C" { #endif -#if !defined(YUV_DISABLE_ASM) && defined(_M_IX86) +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) __declspec(naked) __declspec(align(16)) uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count) { @@ -183,7 +183,7 @@ uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed) { ret } } -#endif // !defined(YUV_DISABLE_ASM) && defined(_M_IX86) +#endif // !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) #ifdef __cplusplus } // extern "C" diff --git a/source/convert.cc b/source/convert.cc index 2c80dc5f1..e3b024929 100644 --- a/source/convert.cc +++ b/source/convert.cc @@ -133,11 +133,12 @@ int I422ToI420(const uint8* src_y, int src_stride_y, // Blends 32x2 pixels to 16x1 // source in scale.cc -#if !defined(YUV_DISABLE_ASM) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) #define HAS_SCALEROWDOWN2_NEON void ScaleRowDown2Int_NEON(const uint8* src_ptr, ptrdiff_t src_stride, uint8* dst, int dst_width); -#elif !defined(YUV_DISABLE_ASM) && \ +#elif !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) void ScaleRowDown2Int_SSE2(const uint8* src_ptr, ptrdiff_t src_stride, diff --git a/source/rotate.cc b/source/rotate.cc index 4d0ac9d3b..b8235f29a 100644 --- a/source/rotate.cc +++ b/source/rotate.cc @@ -20,7 +20,7 @@ namespace libyuv { extern "C" { #endif -#if !defined(YUV_DISABLE_ASM) && \ +#if !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) #if defined(__APPLE__) && defined(__i386__) #define DECLARE_FUNCTION(name) \ @@ -41,7 +41,8 @@ extern "C" { #endif #endif -#if !defined(YUV_DISABLE_ASM) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) #define HAS_MIRRORROW_NEON void MirrorRow_NEON(const uint8* src, uint8* dst, int width); #define HAS_MIRRORROW_UV_NEON @@ -56,8 +57,8 @@ void TransposeUVWx8_NEON(const uint8* src, int src_stride, int width); #endif // defined(__ARM_NEON__) -#if !defined(YUV_DISABLE_ASM) && defined(__mips__) -#if defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#if !defined(LIBYUV_DISABLE_MIPS) && defined(__mips__) && \ + defined(__mips_dsp) && (__mips_dsp_rev >= 2) #define HAS_TRANSPOSE_WX8_MIPS_DSPR2 void TransposeWx8_MIPS_DSPR2(const uint8* src, int src_stride, uint8* dst, int dst_stride, int width); @@ -69,11 +70,9 @@ void TransposeUVWx8_MIPS_DSPR2(const uint8* src, int src_stride, uint8* dst_a, int dst_stride_a, uint8* dst_b, int dst_stride_b, int width); -#endif -#endif +#endif // defined(__mips__) - -#if !defined(YUV_DISABLE_ASM) && defined(_M_IX86) +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) #define HAS_TRANSPOSE_WX8_SSSE3 __declspec(naked) __declspec(align(16)) static void TransposeWx8_SSSE3(const uint8* src, int src_stride, @@ -295,7 +294,7 @@ static void TransposeUVWx8_SSE2(const uint8* src, int src_stride, ret } } -#elif !defined(YUV_DISABLE_ASM) && (defined(__i386__) || defined(__x86_64__)) +#elif !defined(LIBYUV_DISABLE_X86) && (defined(__i386__) || defined(__x86_64__)) #define HAS_TRANSPOSE_WX8_SSSE3 static void TransposeWx8_SSSE3(const uint8* src, int src_stride, uint8* dst, int dst_stride, int width) { @@ -384,7 +383,7 @@ static void TransposeWx8_SSSE3(const uint8* src, int src_stride, ); } -#if !defined(YUV_DISABLE_ASM) && defined (__i386__) +#if !defined(LIBYUV_DISABLE_X86) && defined (__i386__) #define HAS_TRANSPOSE_UVWX8_SSE2 extern "C" void TransposeUVWx8_SSE2(const uint8* src, int src_stride, uint8* dst_a, int dst_stride_a, @@ -506,7 +505,7 @@ extern "C" void TransposeUVWx8_SSE2(const uint8* src, int src_stride, "pop %ebx \n" "ret \n" ); -#elif !defined(YUV_DISABLE_ASM) && defined(__x86_64__) +#elif !defined(LIBYUV_DISABLE_X86) && defined(__x86_64__) // 64 bit version has enough registers to do 16x8 to 8x16 at a time. #define HAS_TRANSPOSE_WX8_FAST_SSSE3 static void TransposeWx8_FAST_SSSE3(const uint8* src, int src_stride, diff --git a/source/rotate_argb.cc b/source/rotate_argb.cc index 02f928ecd..4a3eb1c4e 100644 --- a/source/rotate_argb.cc +++ b/source/rotate_argb.cc @@ -22,14 +22,15 @@ extern "C" { // ARGBScale has a function to copy pixels to a row, striding each source // pixel by a constant. -#if !defined(YUV_DISABLE_ASM) && (defined(_M_IX86) || \ +#if !defined(LIBYUV_DISABLE_X86) && (defined(_M_IX86) || \ defined(__x86_64__) || defined(__i386__)) #define HAS_SCALEARGBROWDOWNEVEN_SSE2 void ScaleARGBRowDownEven_SSE2(const uint8* src_ptr, int src_stride, int src_stepx, uint8* dst_ptr, int dst_width); #endif -#if !defined(YUV_DISABLE_ASM) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) #define HAS_SCALEARGBROWDOWNEVEN_NEON void ScaleARGBRowDownEven_NEON(const uint8* src_ptr, int src_stride, int src_stepx, diff --git a/source/rotate_mips.cc b/source/rotate_mips.cc index b4543f694..04d5a663f 100644 --- a/source/rotate_mips.cc +++ b/source/rotate_mips.cc @@ -17,7 +17,8 @@ namespace libyuv { extern "C" { #endif -#if !defined(YUV_DISABLE_ASM) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#if !defined(LIBYUV_DISABLE_MIPS) && \ + defined(__mips_dsp) && (__mips_dsp_rev >= 2) void TransposeWx8_MIPS_DSPR2(const uint8* src, int src_stride, uint8* dst, int dst_stride, diff --git a/source/rotate_neon.cc b/source/rotate_neon.cc index 31ec63e1d..ab07c1697 100644 --- a/source/rotate_neon.cc +++ b/source/rotate_neon.cc @@ -17,8 +17,7 @@ namespace libyuv { extern "C" { #endif -#if !defined(YUV_DISABLE_ASM) && defined(__ARM_NEON__) - +#if !defined(LIBYUV_DISABLE_NEON) && defined(__ARM_NEON__) static const uvec8 kVTbl4x4Transpose = { 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15 }; diff --git a/source/row_common.cc b/source/row_common.cc index 145f471f5..61bf5e269 100644 --- a/source/row_common.cc +++ b/source/row_common.cc @@ -832,7 +832,8 @@ static __inline void YuvPixel2(uint8 y, uint8 u, uint8 v, *r = Clip(static_cast((u * UR + v * VR) - (BR) + y1) >> 6); } -#if !defined(YUV_DISABLE_ASM) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) // C mimic assembly. // TODO(fbarchard): Remove subsampling from Neon. void I444ToARGBRow_C(const uint8* src_y, @@ -1734,7 +1735,7 @@ void I422ToUYVYRow_C(const uint8* src_y, } } -#if !defined(YUV_DISABLE_ASM) +#if !defined(LIBYUV_DISABLE_X86) // row_win.cc has asm version, but GCC uses 2 step wrapper. 5% slower. // TODO(fbarchard): Handle width > kMaxStride here instead of calling code. #if defined(__x86_64__) || defined(__i386__) @@ -1833,7 +1834,7 @@ void UYVYToARGBRow_Unaligned_SSSE3(const uint8* src_uyvy, } #endif // defined(_M_IX86) || defined(__x86_64__) || defined(__i386__) -#endif // !defined(YUV_DISABLE_ASM) +#endif // !defined(LIBYUV_DISABLE_X86) #ifdef __cplusplus } // extern "C" diff --git a/source/row_mips.cc b/source/row_mips.cc index ed3f117fa..c4f1e773b 100644 --- a/source/row_mips.cc +++ b/source/row_mips.cc @@ -372,7 +372,8 @@ void CopyRow_MIPS(const uint8* src, uint8* dst, int count) { #endif // HAS_COPYROW_MIPS // MIPS DSPR2 functions -#if !defined(YUV_DISABLE_ASM) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#if !defined(LIBYUV_DISABLE_MIPS) && defined(__mips_dsp) && \ + (__mips_dsp_rev >= 2) void SplitUVRow_MIPS_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) { __asm__ __volatile__ ( diff --git a/source/row_neon.cc b/source/row_neon.cc index 26068f4e7..faed8102a 100644 --- a/source/row_neon.cc +++ b/source/row_neon.cc @@ -16,7 +16,7 @@ extern "C" { #endif // This module is for GCC Neon -#if !defined(YUV_DISABLE_ASM) && defined(__ARM_NEON__) +#if !defined(LIBYUV_DISABLE_NEON) && defined(__ARM_NEON__) // Read 8 Y, 4 U and 4 V from 422 #define READYUV422 \ diff --git a/source/row_posix.cc b/source/row_posix.cc index b78654706..f35e85204 100644 --- a/source/row_posix.cc +++ b/source/row_posix.cc @@ -18,7 +18,7 @@ extern "C" { #endif // This module is for GCC x86 and x64 -#if !defined(YUV_DISABLE_ASM) && (defined(__x86_64__) || defined(__i386__)) +#if !defined(LIBYUV_DISABLE_X86) && (defined(__x86_64__) || defined(__i386__)) // GCC 4.2 on OSX has link error when passing static or const to inline. // TODO(fbarchard): Use static const when gcc 4.2 support is dropped. diff --git a/source/row_win.cc b/source/row_win.cc index 01f4b092f..bb070d06d 100644 --- a/source/row_win.cc +++ b/source/row_win.cc @@ -16,7 +16,7 @@ extern "C" { #endif // This module is for Visual C x86. -#if !defined(YUV_DISABLE_ASM) && defined(_M_IX86) +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) #ifdef HAS_ARGBTOYROW_SSSE3 diff --git a/source/scale.cc b/source/scale.cc index 92358a34b..50425ccd5 100644 --- a/source/scale.cc +++ b/source/scale.cc @@ -44,7 +44,8 @@ void SetUseReferenceImpl(bool use) { // ScaleRowDown2Int also used by planar functions // NEON downscalers with interpolation. -#if !defined(YUV_DISABLE_ASM) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) #define HAS_SCALEROWDOWN2_NEON // Note - not static due to reuse in convert for 444 to 420. void ScaleRowDown2_NEON(const uint8* src_ptr, ptrdiff_t /* src_stride */, @@ -94,9 +95,8 @@ void ScaleFilterRows_NEON(uint8* dst_ptr, // SSE2 downscalers with interpolation. // Constants for SSSE3 code -#elif !defined(YUV_DISABLE_ASM) && \ +#elif !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__i386__) || defined(__x86_64__)) - // GCC 4.2 on OSX has link error when passing static or const to inline. // TODO(fbarchard): Use static const when gcc 4.2 support is dropped. #ifdef __APPLE__ @@ -180,8 +180,7 @@ CONST uvec16 kScaleAb2 = { 65536 / 3, 65536 / 3, 65536 / 2, 65536 / 3, 65536 / 3, 65536 / 2, 0, 0 }; #endif -#if !defined(YUV_DISABLE_ASM) && defined(_M_IX86) - +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) #define HAS_SCALEROWDOWN2_SSE2 // Reads 32 pixels, throws half away and writes 16 pixels. // Alignment requirement: src_ptr 16 byte aligned, dst_ptr 16 byte aligned. @@ -1258,7 +1257,7 @@ static void ScaleFilterRows_Unaligned_SSSE3(uint8* dst_ptr, ret } } -#elif !defined(YUV_DISABLE_ASM) && (defined(__x86_64__) || defined(__i386__)) +#elif !defined(LIBYUV_DISABLE_X86) && (defined(__x86_64__) || defined(__i386__)) // GCC versions of row functions are verbatim conversions from Visual C. // Generated using gcc disassembly on Visual C object file: // objdump -D yuvscaler.obj >yuvscaler.txt @@ -2243,7 +2242,8 @@ static void ScaleFilterRows_Unaligned_SSSE3(uint8* dst_ptr, } #endif // defined(__x86_64__) || defined(__i386__) -#if !defined(YUV_DISABLE_ASM) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#if !defined(LIBYUV_DISABLE_MIPS) && \ + defined(__mips_dsp) && (__mips_dsp_rev >= 2) #define HAS_SCALEROWDOWN2_MIPS_DSPR2 void ScaleRowDown2_MIPS_DSPR2(const uint8* src_ptr, ptrdiff_t /* src_stride */, uint8* dst, int dst_width); diff --git a/source/scale_argb.cc b/source/scale_argb.cc index 81d0a33ca..d593a54b8 100644 --- a/source/scale_argb.cc +++ b/source/scale_argb.cc @@ -25,7 +25,8 @@ extern "C" { // ARGB scaling uses bilinear or point, but not box filter. -#if !defined(YUV_DISABLE_ASM) && (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON)) #define HAS_SCALEARGBROWDOWNEVEN_NEON #define HAS_SCALEARGBROWDOWN2_NEON #define HAS_SCALEARGBFILTERROWS_NEON @@ -44,8 +45,7 @@ void ScaleARGBFilterRows_NEON(uint8* dst_ptr, int dst_width, int source_y_fraction); #endif -#if !defined(YUV_DISABLE_ASM) && defined(_M_IX86) - +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) #define HAS_SCALEARGBROWDOWN2_SSE2 // Reads 8 pixels, throws half away and writes 4 even pixels (0, 2, 4, 6) // Alignment requirement: src_argb 16 byte aligned, dst_argb 16 byte aligned. @@ -396,8 +396,7 @@ void ScaleARGBFilterRows_SSSE3(uint8* dst_argb, const uint8* src_argb, } } -#elif !defined(YUV_DISABLE_ASM) && (defined(__x86_64__) || defined(__i386__)) - +#elif !defined(LIBYUV_DISABLE_X86) && (defined(__x86_64__) || defined(__i386__)) // GCC versions of row functions are verbatim conversions from Visual C. // Generated using gcc disassembly on Visual C object file: // objdump -D yuvscaler.obj >yuvscaler.txt diff --git a/source/scale_argb_neon.cc b/source/scale_argb_neon.cc index 9a704839b..8f438628c 100644 --- a/source/scale_argb_neon.cc +++ b/source/scale_argb_neon.cc @@ -17,8 +17,7 @@ extern "C" { #endif // This module is for GCC Neon -#if !defined(YUV_DISABLE_ASM) && defined(__ARM_NEON__) - +#if !defined(LIBYUV_DISABLE_NEON) && defined(__ARM_NEON__) void ScaleARGBRowDown2_NEON(const uint8* src_ptr, ptrdiff_t /* src_stride */, uint8* dst, int dst_width) { diff --git a/source/scale_mips.cc b/source/scale_mips.cc index 397749869..ba8e8b516 100644 --- a/source/scale_mips.cc +++ b/source/scale_mips.cc @@ -17,7 +17,8 @@ extern "C" { #endif // This module is for GCC MIPS DSPR2 -#if !defined(YUV_DISABLE_ASM) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#if !defined(LIBYUV_DISABLE_MIPS) && \ + defined(__mips_dsp) && (__mips_dsp_rev >= 2) void ScaleRowDown2_MIPS_DSPR2(const uint8* src_ptr, ptrdiff_t /* src_stride */, uint8* dst, int dst_width) { diff --git a/source/scale_neon.cc b/source/scale_neon.cc index 64997e39c..c1cf7f11b 100644 --- a/source/scale_neon.cc +++ b/source/scale_neon.cc @@ -17,14 +17,10 @@ extern "C" { #endif // This module is for GCC Neon -#if !defined(YUV_DISABLE_ASM) && defined(__ARM_NEON__) +#if !defined(LIBYUV_DISABLE_NEON) && defined(__ARM_NEON__) -/** - * NEON downscalers with interpolation. - * - * Provided by Fritz Koenig - * - */ +// NEON downscalers with interpolation. +// Provided by Fritz Koenig void ScaleRowDown2_NEON(const uint8* src_ptr, ptrdiff_t /* src_stride */, uint8* dst, int dst_width) { diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index e3bbacccc..feedcd46e 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -859,9 +859,6 @@ TEST_F(libyuvTest, ARGBBlend_Opt) { TEST_F(libyuvTest, TestAffine) { SIMD_ALIGNED(uint8 orig_pixels_0[256][4]); SIMD_ALIGNED(uint8 interpolate_pixels_C[256][4]); -#if defined(HAS_ARGBAFFINEROW_SSE2) - SIMD_ALIGNED(uint8 interpolate_pixels_Opt[256][4]); -#endif for (int i = 0; i < 256; ++i) { for (int j = 0; j < 4; ++j) { @@ -878,25 +875,17 @@ TEST_F(libyuvTest, TestAffine) { EXPECT_EQ(191u, interpolate_pixels_C[255][3]); #if defined(HAS_ARGBAFFINEROW_SSE2) + SIMD_ALIGNED(uint8 interpolate_pixels_Opt[256][4]); ARGBAffineRow_SSE2(&orig_pixels_0[0][0], 0, &interpolate_pixels_Opt[0][0], uv_step, 256); EXPECT_EQ(0, memcmp(interpolate_pixels_Opt, interpolate_pixels_C, 256 * 4)); -#endif -#if defined(HAS_ARGBAFFINEROW_SSE2) int has_sse2 = TestCpuFlag(kCpuHasSSE2); if (has_sse2) { for (int i = 0; i < benchmark_pixels_div256_; ++i) { ARGBAffineRow_SSE2(&orig_pixels_0[0][0], 0, &interpolate_pixels_Opt[0][0], uv_step, 256); } - } else { -#endif - for (int i = 0; i < benchmark_pixels_div256_; ++i) { - ARGBAffineRow_C(&orig_pixels_0[0][0], 0, &interpolate_pixels_C[0][0], - uv_step, 256); - } -#if defined(HAS_ARGBAFFINEROW_SSE2) } #endif } @@ -1172,3 +1161,4 @@ TEST_F(libyuvTest, ARGBSubtract_Opt) { } } // namespace libyuv +