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

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Tue Apr 25 15:28:32 UTC 2023



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
70de1313 by Maxime Chapelet at 2023-04-24T16:56:02+02: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.

(cherry picked from commit 2837692900e62812f0f6f16bc7c1b5147b11d08e)

- - - - -


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
=====================================
@@ -20,6 +20,7 @@ soxr: soxr-$(SOXR_VERSION)-Source.tar.xz .sum-soxr
 	$(APPLY) $(SRC)/soxr/0003-add-aarch64-support.patch
 	$(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/aarch64.patch
 	$(call pkg_static,"src/soxr.pc.in")
 	$(MOVE)
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/70de1313be8e1d4bc90aeea6ea67a57db1924b05

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/70de1313be8e1d4bc90aeea6ea67a57db1924b05
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