[x265] [PATCH] Fix cpu capability issue

Ponsanthini Arunachalam ponsanthini.arunachalam at multicorewareinc.com
Thu Oct 3 09:43:06 UTC 2024


Please find the below updated patch :

>From 98bc7a5a7d33ad4b23a70ff4b093db473222e1b8 Mon Sep 17 00:00:00 2001
From: Ponsanthini <ponsanthini.arunachalam at muticorewareinc.com>
Date: Thu, 3 Oct 2024 07:39:47 +0000
Subject: [PATCH] Fix cpu capability issue

---
 source/CMakeLists.txt | 4 ++++
 source/common/cpu.cpp | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index d1fe38559..cd19050c3 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 745e9dc41..f5f30c917 100644
--- a/source/common/cpu.cpp
+++ b/source/common/cpu.cpp
@@ -396,6 +396,7 @@ uint32_t cpu_detect(bool /*benableavx512*/)
 {
     int flags = 0;

+#ifdef ENABLE_ASSEMBLY
     #if HAVE_NEON
          flags |= X265_CPU_NEON;
     #endif
@@ -411,6 +412,7 @@ uint32_t cpu_detect(bool /*benableavx512*/)
     #if HAVE_SVE2
          flags |= X265_CPU_SVE2;
     #endif
+#endif

     return flags;
 }
@@ -442,6 +444,7 @@ uint32_t cpu_detect(bool /*benableavx512*/)

     int flags = 0;

+#ifdef ENABLE_ASSEMBLY
     #if HAVE_NEON
          flags |= X265_CPU_NEON;    // All of ARM64 has NEON
     #endif
@@ -457,6 +460,7 @@ uint32_t cpu_detect(bool /*benableavx512*/)
     #if HAVE_SVE2 && defined(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE)
          flags |=
IsProcessorFeaturePresent(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE) ?
X265_CPU_SVE2 : 0;
     #endif
+#endif

     return flags;
 }
@@ -473,6 +477,7 @@ uint32_t cpu_detect(bool /*benableavx5128*/)

     int flags = 0;

+#ifdef ENABLE_ASSEMBLY
     #if HAVE_NEON
          flags |= X265_CPU_NEON;    // All of ARM64 has NEON
     #endif
@@ -488,6 +493,7 @@ uint32_t cpu_detect(bool /*benableavx5128*/)
     #if HAVE_SVE2
          flags |= (hwcaps2 & HWCAP2_SVE2 ? X265_CPU_SVE2 : 0);
     #endif
+#endif

     return flags;
 }
-- 
2.34.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241003/65109b58/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-cpu-capability-issue_updated.patch
Type: application/octet-stream
Size: 2164 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241003/65109b58/attachment.obj>


More information about the x265-devel mailing list