[vlc-commits] [Git][videolan/vlc][master] contrib: soxr: fix neon detection for aarch64 hosts

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Apr 13 03:12:57 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
28376929 by Maxime Chapelet at 2023-04-13T00:35:06+00:00
contrib: soxr: fix neon detection for aarch64 hosts

What we have :
Given the cmake simd detection module check `CMAKE_SYSTEM_PROCESSOR` to match "arm" prefixed hosts
When `DETECT_SIMD32_C_FLAGS` test is performed by cmake for aarch64 Darwin hosts
The test fails and `WITH_CR32S` is defined to 0 in `soxr-config.h`

What is expected :
Given the cmake simd detection module check `CMAKE_SYSTEM_PROCESSOR` to match "aarch64" hosts
When `DETECT_SIMD32_C_FLAGS` test is performed by cmake for aarch64 Darwin hosts
The test succeeds and `WITH_CR32S` is defined to 1 in `soxr-config.h`

When soxr is used on Darwin arm64 platforms (iOS, macOS on Apple Silicon), the expected resampler engine to be used is cr32s.
Without this patch, cr32 is used instead, because in `soxr-config.h`, `WITH_CR32S` is defined to 0.
Considering we use "aarch64" for Darwin arm64 hosts in contribs, these changes are an attempt to fix this.

- - - - -


2 changed files:

- + contrib/src/soxr/aarch64.patch
- contrib/src/soxr/rules.mak


Changes:

=====================================
contrib/src/soxr/aarch64.patch
=====================================
@@ -0,0 +1,21 @@
+diff --git a/cmake/Modules/FindSIMD32.cmake b/cmake/Modules/FindSIMD32.cmake
+index 9e4237358f..580e9ca87b 100644
+--- a/cmake/Modules/FindSIMD32.cmake	
++++ b/cmake/Modules/FindSIMD32.cmake	
+@@ -24,6 +24,16 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+       return !vgetq_lane_u32(vceqq_f32(a,b),0);
+     }
+   ")
++elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
++  set (TRIAL_C_FLAGS
++    " ")
++  set (TEST_C_SOURCE "
++    #include <arm_neon.h>
++    int main(int c, char * * v) {
++      float32x4_t a = vdupq_n_f32((float)c), b = vdupq_n_f32((float)!!v);
++      return !vgetq_lane_u32(vceqq_f32(a,b),0);
++    }
++  ")
+ else ()
+   if (WIN32) # Safety for when mixed lib/app compilers (but performance hit)
+     set (GCC_WIN32_SIMD32_OPTS "-mincoming-stack-boundary=2")


=====================================
contrib/src/soxr/rules.mak
=====================================
@@ -22,6 +22,7 @@ soxr: soxr-$(SOXR_VERSION)-Source.tar.xz .sum-soxr
 	$(APPLY) $(SRC)/soxr/0004-arm-fix-SIGILL-when-doing-divisions-on-some-old-arch.patch
 	$(APPLY) $(SRC)/soxr/find_ff_pkgconfig.patch
 	$(APPLY) $(SRC)/soxr/soxr-check-function.patch
+	$(APPLY) $(SRC)/soxr/aarch64.patch
 	$(call pkg_static,"src/soxr.pc.in")
 	$(MOVE)
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2837692900e62812f0f6f16bc7c1b5147b11d08e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2837692900e62812f0f6f16bc7c1b5147b11d08e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list