<div dir="ltr">Pushed to master.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 11, 2021 at 2:08 PM Kalaiyarasi Saravanan <<a href="mailto:kalaiyarasi@multicorewareinc.com">kalaiyarasi@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">From 47f2a32447172d033b7ebf9d7641ddbff47b758c Mon Sep 17 00:00:00 2001<br>From: lwWang <<a href="mailto:liwei@multicorewareinc.com" target="_blank">liwei@multicorewareinc.com</a>><br>Date: Wed, 11 Aug 2021 10:50:43 +0800<br>Subject: [PATCH] fix the compiling errors on MAC<br><br>---<br> source/CMakeLists.txt              |  7 +++-<br> source/cmake/FindNeon.cmake        | 17 ++++++--<br> source/common/aarch64/asm.S        | 28 ++++++++++++-<br> source/common/aarch64/ipfilter8.S  | 66 ++++++++++++++++--------------<br> source/common/aarch64/mc-a.S       |  4 ++<br> source/common/aarch64/pixel-util.S |  4 ++<br> source/common/aarch64/sad-a.S      | 20 +++++----<br> source/test/testharness.h          |  2 +-<br> 8 files changed, 100 insertions(+), 48 deletions(-)<br><br>diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>index b4e57b592..f2fd51137 100755<br>--- a/source/CMakeLists.txt<br>+++ b/source/CMakeLists.txt<br>@@ -40,7 +40,7 @@ SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")<br> # System architecture detection<br> string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)<br> set(X86_ALIASES x86 i386 i686 x86_64 amd64)<br>-set(ARM_ALIASES armv6l armv7l aarch64)<br>+set(ARM_ALIASES armv6l armv7l aarch64 arm64)<br> list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)<br> list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)<br> set(POWER_ALIASES ppc64 ppc64le)<br>@@ -248,7 +248,10 @@ if(GCC)<br>     elseif(ARM)<br>         if(ARM64)<br>             set(ARM_ARGS -fPIC)<br>-            add_definitions(-DHAVE_NEON)<br>+            find_package(Neon)<br>+            if(CPU_HAS_NEON)<br>+                add_definitions(-DHAVE_NEON)<br>+            endif()<br>         else()<br>             find_package(Neon)<br>             if(CPU_HAS_NEON)<br>diff --git a/source/cmake/FindNeon.cmake b/source/cmake/FindNeon.cmake<br>index 0062449c3..2b8751248 100644<br>--- a/source/cmake/FindNeon.cmake<br>+++ b/source/cmake/FindNeon.cmake<br>@@ -1,10 +1,19 @@<br> include(FindPackageHandleStandardArgs)<br> <br> # Check the version of neon supported by the ARM CPU<br>-execute_process(COMMAND cat /proc/cpuinfo | grep Features | grep neon<br>-                OUTPUT_VARIABLE neon_version<br>-                ERROR_QUIET<br>-                OUTPUT_STRIP_TRAILING_WHITESPACE)<br>+if(APPLE)<br>+    execute_process(COMMAND sysctl -a<br>+                    COMMAND grep "hw.optional.neon: 1"<br>+                    OUTPUT_VARIABLE neon_version<br>+                    ERROR_QUIET<br>+                    OUTPUT_STRIP_TRAILING_WHITESPACE)<br>+else()<br>+    execute_process(COMMAND cat /proc/cpuinfo | grep Features | grep neon<br>+                    OUTPUT_VARIABLE neon_version<br>+                    ERROR_QUIET<br>+                    OUTPUT_STRIP_TRAILING_WHITESPACE)<br>+endif()<br>+<br> if(neon_version)<br>     set(CPU_HAS_NEON 1)<br> endif()<br>diff --git a/source/common/aarch64/asm.S b/source/common/aarch64/asm.S<br>index 5f020a11a..527f819ed 100644<br>--- a/source/common/aarch64/asm.S<br>+++ b/source/common/aarch64/asm.S<br>@@ -23,32 +23,56 @@<br> <br> .arch           armv8-a<br> <br>+#ifdef __APPLE__<br>+#define PREFIX 1<br>+#endif<br>+<br> #ifdef PREFIX<br> #define EXTERN_ASM _<br>+#define HAVE_AS_FUNC 0<br> #else<br> #define EXTERN_ASM<br>+#define HAVE_AS_FUNC 1<br> #endif<br> <br> #ifdef __ELF__<br> #define ELF<br> #else<br>+#ifdef PREFIX<br>+#define ELF #<br>+#else<br> #define ELF @<br> #endif<br>-<br>-#define HAVE_AS_FUNC 1<br>+#endif<br> <br> #if HAVE_AS_FUNC<br> #define FUNC<br> #else<br>+#ifdef PREFIX<br>+#define FUNC #<br>+#else<br> #define FUNC @<br> #endif<br>+#endif<br>+<br>+#ifdef __APPLE__<br>+.macro endfunc<br>+ELF .size \name, . - \name<br>+FUNC .endfunc<br>+.endm<br>+#endif<br> <br> .macro function name, export=1<br>+#ifdef __APPLE__<br>+    .global \name<br>+    endfunc<br>+#else<br>     .macro endfunc<br> ELF     .size   \name, . - \name<br> FUNC    .endfunc<br>         .purgem endfunc<br>     .endm<br>+#endif<br>         .align  2<br> .if \export == 1<br>         .global EXTERN_ASM\name<br>diff --git a/source/common/aarch64/ipfilter8.S b/source/common/aarch64/ipfilter8.S<br>index 908c7db46..685f839b8 100644<br>--- a/source/common/aarch64/ipfilter8.S<br>+++ b/source/common/aarch64/ipfilter8.S<br>@@ -23,7 +23,11 @@<br> <br> #include "asm.S"<br> <br>+#ifdef __APPLE__<br>+.section __RODATA, __rodata<br>+#else<br> .section .rodata<br>+#endif<br> <br> .align 4<br> <br>@@ -197,10 +201,10 @@<br>     b.eq            15f<br>     b               7f<br> 14:<br>-    HPS_FILTER_4 \a \b \filterhps<br>+    HPS_FILTER_4 \a, \b, \filterhps<br>     b               10f<br> 15:<br>-    HPS_FILTER_12 \a \b \filterhps<br>+    HPS_FILTER_12 \a, \b, \filterhps<br>     b               10f<br> 7:<br>     cmp             w5, #0<br>@@ -371,44 +375,44 @@ function x265_interp_8tap_horiz_ps_\w\()x\h\()_neon<br>     cmp             w4, #3<br>     b.eq            3f<br> 0:<br>-    HPS_FILTER  \w \h qpel_filter_0_32b<br>+    HPS_FILTER  \w, \h, qpel_filter_0_32b<br>     b               5f<br> 1:<br>-    HPS_FILTER  \w \h qpel_filter_1_32b<br>+    HPS_FILTER  \w, \h, qpel_filter_1_32b<br>     b               5f<br> 2:<br>-    HPS_FILTER  \w \h qpel_filter_2_32b<br>+    HPS_FILTER  \w, \h, qpel_filter_2_32b<br>     b               5f<br> 3:<br>-    HPS_FILTER  \w \h qpel_filter_3_32b<br>+    HPS_FILTER  \w, \h, qpel_filter_3_32b<br>     b               5f<br> 5:<br>     ret<br> endfunc<br> .endm<br> <br>-LUMA_HPS    4 4<br>-LUMA_HPS    4 8<br>-LUMA_HPS    4 16<br>-LUMA_HPS    8 4<br>-LUMA_HPS    8 8<br>-LUMA_HPS    8 16<br>-LUMA_HPS    8 32<br>-LUMA_HPS    12 16<br>-LUMA_HPS    16 4<br>-LUMA_HPS    16 8<br>-LUMA_HPS    16 12<br>-LUMA_HPS    16 16<br>-LUMA_HPS    16 32<br>-LUMA_HPS    16 64<br>-LUMA_HPS    24 32<br>-LUMA_HPS    32 8<br>-LUMA_HPS    32 16<br>-LUMA_HPS    32 24<br>-LUMA_HPS    32 32<br>-LUMA_HPS    32 64<br>-LUMA_HPS    48 64<br>-LUMA_HPS    64 16<br>-LUMA_HPS    64 32<br>-LUMA_HPS    64 48<br>-LUMA_HPS    64 64<br>+LUMA_HPS    4,4<br>+LUMA_HPS    4,8<br>+LUMA_HPS    4,16<br>+LUMA_HPS    8,4<br>+LUMA_HPS    8,8<br>+LUMA_HPS    8,16<br>+LUMA_HPS    8,32<br>+LUMA_HPS    12,16<br>+LUMA_HPS    16,4<br>+LUMA_HPS    16,8<br>+LUMA_HPS    16,12<br>+LUMA_HPS    16,16<br>+LUMA_HPS    16,32<br>+LUMA_HPS    16,64<br>+LUMA_HPS    24,32<br>+LUMA_HPS    32,8<br>+LUMA_HPS    32,16<br>+LUMA_HPS    32,24<br>+LUMA_HPS    32,32<br>+LUMA_HPS    32,64<br>+LUMA_HPS    48,64<br>+LUMA_HPS    64,16<br>+LUMA_HPS    64,32<br>+LUMA_HPS    64,48<br>+LUMA_HPS    64,64<br>diff --git a/source/common/aarch64/mc-a.S b/source/common/aarch64/mc-a.S<br>index cbaf9b501..339b53ae4 100644<br>--- a/source/common/aarch64/mc-a.S<br>+++ b/source/common/aarch64/mc-a.S<br>@@ -23,7 +23,11 @@<br> <br> #include "asm.S"<br> <br>+#ifdef __APPLE__<br>+.section __RODATA,__rodata<br>+#else<br> .section .rodata<br>+#endif<br> <br> .align 4<br> <br>diff --git a/source/common/aarch64/pixel-util.S b/source/common/aarch64/pixel-util.S<br>index a085ebdfa..13c85ad8f 100644<br>--- a/source/common/aarch64/pixel-util.S<br>+++ b/source/common/aarch64/pixel-util.S<br>@@ -24,7 +24,11 @@<br> <br> #include "asm.S"<br> <br>+#ifdef __APPLE__<br>+.section __RODATA,__rodata<br>+#else<br> .section .rodata<br>+#endif<br> <br> .align 4<br> <br>diff --git a/source/common/aarch64/sad-a.S b/source/common/aarch64/sad-a.S<br>index c27cce5ce..04269d381 100644<br>--- a/source/common/aarch64/sad-a.S<br>+++ b/source/common/aarch64/sad-a.S<br>@@ -23,7 +23,11 @@<br> <br> #include "asm.S"<br> <br>+#ifdef __APPLE__<br>+.section __RODATA,__rodata<br>+#else<br> .section .rodata<br>+#endif<br> <br> .align 4<br> <br>@@ -94,12 +98,12 @@ function x265_sad_x\x\()_8x\h\()_neon<br> endfunc<br> .endm<br> <br>-SAD_X_8xN 3 4<br>-SAD_X_8xN 3 8<br>-SAD_X_8xN 3 16<br>-SAD_X_8xN 3 32<br>+SAD_X_8xN 3,4<br>+SAD_X_8xN 3,8<br>+SAD_X_8xN 3,16<br>+SAD_X_8xN 3,32<br> <br>-SAD_X_8xN 4 4<br>-SAD_X_8xN 4 8<br>-SAD_X_8xN 4 16<br>-SAD_X_8xN 4 32<br>+SAD_X_8xN 4,4<br>+SAD_X_8xN 4,8<br>+SAD_X_8xN 4,16<br>+SAD_X_8xN 4,32<br>diff --git a/source/test/testharness.h b/source/test/testharness.h<br>index 6e680953f..088343b51 100644<br>--- a/source/test/testharness.h<br>+++ b/source/test/testharness.h<br>@@ -73,7 +73,7 @@ protected:<br> #include <x86intrin.h><br> #elif ( !defined(__APPLE__) && defined (__GNUC__) && defined(__ARM_NEON__))<br> #include <arm_neon.h><br>-#elif defined(__GNUC__) && (!defined(__clang__) || __clang_major__ < 4)<br>+#else<br> /* fallback for older GCC/MinGW */<br> static inline uint32_t __rdtsc(void)<br> {<br>-- <br>2.22.0.windows.1<br><br></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="georgia, serif">Regards,</font><div><b><font face="georgia, serif">Aruna Matheswaran,</font></b></div><div><font face="georgia, serif">Video Codec Engineer,</font></div><div><font face="georgia, serif">Media & AI analytics BU,</font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" width="96" height="36" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><font face="georgia, serif"><br></font></div></div></div></div></div></div></div></div></div>