[x265] [PATCH] Fix cpu capability issue

Ponsanthini Arunachalam ponsanthini.arunachalam at multicorewareinc.com
Mon Sep 30 07:43:40 UTC 2024


>From d76788127f6a142ff41a8df19a0f9e74290689a8 Mon Sep 17 00:00:00 2001
From: Ponsanthini <ponsanthini.arunachalam at muticorewareinc.com>
Date: Mon, 30 Sep 2024 07:29:25 +0000
Subject: [PATCH] Fix cpu capability issue

---
 source/CMakeLists.txt |  4 ++++
 source/common/cpu.cpp | 30 ++++++++++++++++--------------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index d1fe38559..3ec82c810 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -479,6 +479,10 @@ else()
     option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF)
 endif()

+if(ENABLE_ASSEMBLY)
+    add_definitions(-DENABLE_ASSEMBLY)
+endif()
+
 option(CHECKED_BUILD "Enable run-time sanity checks (debugging)" OFF)
 if(CHECKED_BUILD)
     add_definitions(-DCHECKED_BUILD=1)
diff --git a/source/common/cpu.cpp b/source/common/cpu.cpp
index 4f4376184..e31647293 100644
--- a/source/common/cpu.cpp
+++ b/source/common/cpu.cpp
@@ -455,20 +455,22 @@ uint32_t cpu_detect(bool benableavx512)

     int flags = 0;

-    #if HAVE_NEON
-         flags |= X265_CPU_NEON;    // All of ARM64 has NEON
-    #endif
-    #if HAVE_NEON_DOTPROD
-         flags |= (hwcaps & HWCAP_ASIMDDP ? X265_CPU_NEON_DOTPROD : 0);
-    #endif
-    #if HAVE_NEON_I8MM
-         flags |= (hwcaps2 & HWCAP2_I8MM ? X265_CPU_NEON_I8MM : 0);
-    #endif
-    #if HAVE_SVE
-         flags |= (hwcaps & HWCAP_SVE ? X265_CPU_SVE : 0);
-    #endif
-    #if HAVE_SVE2
-         flags |= (hwcaps2 & HWCAP2_SVE2 ? X265_CPU_SVE2 : 0);
+    #ifdef ENABLE_ASSEMBLY
+        #if HAVE_NEON
+             flags |= X265_CPU_NEON;
+        #endif
+        #if HAVE_NEON_DOTPROD
+             flags |= X265_CPU_NEON_DOTPROD;
+        #endif
+        #if HAVE_NEON_I8MM
+             flags |= X265_CPU_NEON_I8MM;
+        #endif
+        #if HAVE_SVE
+             flags |= X265_CPU_SVE;
+        #endif
+        #if HAVE_SVE2
+             flags |= X265_CPU_SVE2;
+        #endif
     #endif

     return flags;
-- 
2.34.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240930/1e22764f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0013-Fix-cpu-capability-issue.patch
Type: application/octet-stream
Size: 2030 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240930/1e22764f/attachment.obj>


More information about the x265-devel mailing list