File arm.patch of Package x265 (Revision 41)

Currently displaying revision 41 , Show latest

109
 
1
Index: x265_3.4/source/CMakeLists.txt
2
===================================================================
3
--- x265_3.4.orig/source/CMakeLists.txt
4
+++ x265_3.4/source/CMakeLists.txt
5
@@ -64,26 +64,26 @@ elseif(POWERMATCH GREATER "-1")
6
         add_definitions(-DPPC64=1)
7
         message(STATUS "Detected POWER PPC64 target processor")
8
     endif()
9
-elseif(ARMMATCH GREATER "-1")
10
-    if(CROSS_COMPILE_ARM)
11
-        message(STATUS "Cross compiling for ARM arch")
12
-    else()
13
-        set(CROSS_COMPILE_ARM 0)
14
-    endif()
15
-    set(ARM 1)
16
-    if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
17
-        message(STATUS "Detected ARM64 target processor")
18
-        set(ARM64 1)
19
-        add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=1 -DHAVE_ARMV6=0)
20
-    else()
21
-        message(STATUS "Detected ARM target processor")
22
-        add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=0 -DHAVE_ARMV6=1)
23
-    endif()
24
+elseif(${SYSPROC} MATCHES "armv5.*")
25
+    message(STATUS "Detected ARMV5 system processor")
26
+    set(ARMV5 1)
27
+    add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=0 -DHAVE_ARMV6=0 -DHAVE_NEON=0)
28
+elseif(${SYSPROC} STREQUAL "armv6l")
29
+    message(STATUS "Detected ARMV6 system processor")
30
+    set(ARMV6 1)
31
+    add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=0 -DHAVE_ARMV6=1 -DHAVE_NEON=0)
32
+elseif(${SYSPROC} STREQUAL "armv7l")
33
+    message(STATUS "Detected ARMV7 system processor")
34
+    set(ARMV7 1)
35
+    add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=0 -DHAVE_ARMV6=1 -DHAVE_NEON=0)
36
+elseif(${SYSPROC} STREQUAL "aarch64")
37
+    message(STATUS "Detected AArch64 system processor")
38
+    set(ARMV7 1)
39
+    add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=1 -DHAVE_ARMV6=0 -DHAVE_NEON=0)
40
 else()
41
     message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
42
     message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
43
 endif()
44
-
45
 if(UNIX)
46
     list(APPEND PLATFORM_LIBS pthread)
47
     find_library(LIBRT rt)
48
@@ -238,28 +238,9 @@ if(GCC)
49
             endif()
50
         endif()
51
     endif()
52
-    if(ARM AND CROSS_COMPILE_ARM)
53
-        if(ARM64)
54
-            set(ARM_ARGS -fPIC)
55
-        else()
56
-            set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
57
-        endif()
58
-        message(STATUS "cross compile arm")
59
-    elseif(ARM)
60
-        if(ARM64)
61
-            set(ARM_ARGS -fPIC)
62
-            add_definitions(-DHAVE_NEON)
63
-        else()
64
-            find_package(Neon)
65
-            if(CPU_HAS_NEON)
66
-                set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
67
-                add_definitions(-DHAVE_NEON)
68
-            else()
69
-                set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
70
-            endif()
71
-        endif()
72
+    if(ARMV7)
73
+        add_definitions(-fPIC)
74
     endif()
75
-    add_definitions(${ARM_ARGS})
76
     if(FPROFILE_GENERATE)
77
         if(INTEL_CXX)
78
             add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}")
79
Index: x265_3.4/source/common/cpu.cpp
80
===================================================================
81
--- x265_3.4.orig/source/common/cpu.cpp
82
+++ x265_3.4/source/common/cpu.cpp
83
@@ -39,7 +39,7 @@
84
 #include <machine/cpu.h>
85
 #endif
86
 
87
-#if X265_ARCH_ARM && !defined(HAVE_NEON)
88
+#if X265_ARCH_ARM && (!defined(HAVE_NEON) || HAVE_NEON==0)
89
 #include <signal.h>
90
 #include <setjmp.h>
91
 static sigjmp_buf jmpbuf;
92
@@ -350,7 +350,6 @@ uint32_t cpu_detect(bool benableavx512)
93
     }
94
 
95
     canjump = 1;
96
-    PFX(cpu_neon_test)();
97
     canjump = 0;
98
     signal(SIGILL, oldsig);
99
 #endif // if !HAVE_NEON
100
@@ -366,7 +365,7 @@ uint32_t cpu_detect(bool benableavx512)
101
     // which may result in incorrect detection and the counters stuck enabled.
102
     // right now Apple does not seem to support performance counters for this test
103
 #ifndef __MACH__
104
-    flags |= PFX(cpu_fast_neon_mrc_test)() ? X265_CPU_FAST_NEON_MRC : 0;
105
+    //flags |= PFX(cpu_fast_neon_mrc_test)() ? X265_CPU_FAST_NEON_MRC : 0;
106
 #endif
107
     // TODO: write dual issue test? currently it's A8 (dual issue) vs. A9 (fast mrc)
108
 #elif X265_ARCH_ARM64
109