Skip to content

Commit

Permalink
Revert "Bump x265 to 4.1"
Browse files Browse the repository at this point in the history
This reverts commit 767c280.
  • Loading branch information
WyattBlue committed Jan 19, 2025
1 parent 767c280 commit e08727b
Show file tree
Hide file tree
Showing 3 changed files with 270 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Currently FFmpeg 7.1 is built with the following packages enabled for all platfo
- png 1.6.37
- webp 1.5.0
- x264 master
- x265 4.1
- x265 3.5

The following additional packages are also enabled on Linux:

Expand Down
268 changes: 268 additions & 0 deletions patches/x265.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
diff -urN x265_3.5.orig/source/CMakeLists.txt x265_3.5/source/CMakeLists.txt
--- x265_3.5.orig/source/CMakeLists.txt 2021-03-16 13:53:00.000000000 +0100
+++ x265_3.5/source/CMakeLists.txt 2022-02-22 10:13:55.615384363 +0100
@@ -40,7 +40,7 @@
# System architecture detection
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
set(X86_ALIASES x86 i386 i686 x86_64 amd64)
-set(ARM_ALIASES armv6l armv7l aarch64)
+set(ARM_ALIASES armv6l armv7l aarch64 arm64)
list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
set(POWER_ALIASES ppc64 ppc64le)
@@ -247,7 +247,11 @@
message(STATUS "cross compile arm")
elseif(ARM)
if(ARM64)
- set(ARM_ARGS -fPIC)
+ if(APPLE)
+ set(ARM_ARGS -arch arm64 -fPIC)
+ else()
+ set(ARM_ARGS -fPIC)
+ endif()
add_definitions(-DHAVE_NEON)
else()
find_package(Neon)
diff -urN x265_3.5.orig/source/common/aarch64/asm.S x265_3.5/source/common/aarch64/asm.S
--- x265_3.5.orig/source/common/aarch64/asm.S 2021-03-16 13:53:00.000000000 +0100
+++ x265_3.5/source/common/aarch64/asm.S 2022-02-22 10:13:49.991449401 +0100
@@ -23,32 +23,56 @@

.arch armv8-a

+#ifdef __APPLE__
+#define PREFIX 1
+#endif
+
#ifdef PREFIX
#define EXTERN_ASM _
+#define HAVE_AS_FUNC 0
#else
#define EXTERN_ASM
+#define HAVE_AS_FUNC 1
#endif

#ifdef __ELF__
#define ELF
#else
+#ifdef PREFIX
+#define ELF #
+#else
#define ELF @
#endif
-
-#define HAVE_AS_FUNC 1
+#endif

#if HAVE_AS_FUNC
#define FUNC
#else
+#ifdef PREFIX
+#define FUNC #
+#else
#define FUNC @
#endif
+#endif
+
+#ifdef __APPLE__
+.macro endfunc
+ELF .size \name, . - \name
+FUNC .endfunc
+.endm
+#endif

.macro function name, export=1
+#ifdef __APPLE__
+ .global \name
+ endfunc
+#else
.macro endfunc
ELF .size \name, . - \name
FUNC .endfunc
.purgem endfunc
.endm
+#endif
.align 2
.if \export == 1
.global EXTERN_ASM\name
diff -urN x265_3.5.orig/source/common/aarch64/ipfilter8.S x265_3.5/source/common/aarch64/ipfilter8.S
--- x265_3.5.orig/source/common/aarch64/ipfilter8.S 2021-03-16 13:53:00.000000000 +0100
+++ x265_3.5/source/common/aarch64/ipfilter8.S 2022-02-22 10:13:49.991449401 +0100
@@ -23,7 +23,11 @@

#include "asm.S"

+#ifdef __APPLE__
+.section __RODATA, __rodata
+#else
.section .rodata
+#endif

.align 4

@@ -197,10 +201,10 @@
b.eq 15f
b 7f
14:
- HPS_FILTER_4 \a \b \filterhps
+ HPS_FILTER_4 \a, \b, \filterhps
b 10f
15:
- HPS_FILTER_12 \a \b \filterhps
+ HPS_FILTER_12 \a, \b, \filterhps
b 10f
7:
cmp w5, #0
@@ -371,44 +375,44 @@
cmp w4, #3
b.eq 3f
0:
- HPS_FILTER \w \h qpel_filter_0_32b
+ HPS_FILTER \w, \h, qpel_filter_0_32b
b 5f
1:
- HPS_FILTER \w \h qpel_filter_1_32b
+ HPS_FILTER \w, \h, qpel_filter_1_32b
b 5f
2:
- HPS_FILTER \w \h qpel_filter_2_32b
+ HPS_FILTER \w, \h, qpel_filter_2_32b
b 5f
3:
- HPS_FILTER \w \h qpel_filter_3_32b
+ HPS_FILTER \w, \h, qpel_filter_3_32b
b 5f
5:
ret
endfunc
.endm

-LUMA_HPS 4 4
-LUMA_HPS 4 8
-LUMA_HPS 4 16
-LUMA_HPS 8 4
-LUMA_HPS 8 8
-LUMA_HPS 8 16
-LUMA_HPS 8 32
-LUMA_HPS 12 16
-LUMA_HPS 16 4
-LUMA_HPS 16 8
-LUMA_HPS 16 12
-LUMA_HPS 16 16
-LUMA_HPS 16 32
-LUMA_HPS 16 64
-LUMA_HPS 24 32
-LUMA_HPS 32 8
-LUMA_HPS 32 16
-LUMA_HPS 32 24
-LUMA_HPS 32 32
-LUMA_HPS 32 64
-LUMA_HPS 48 64
-LUMA_HPS 64 16
-LUMA_HPS 64 32
-LUMA_HPS 64 48
-LUMA_HPS 64 64
+LUMA_HPS 4,4
+LUMA_HPS 4,8
+LUMA_HPS 4,16
+LUMA_HPS 8,4
+LUMA_HPS 8,8
+LUMA_HPS 8,16
+LUMA_HPS 8,32
+LUMA_HPS 12,16
+LUMA_HPS 16,4
+LUMA_HPS 16,8
+LUMA_HPS 16,12
+LUMA_HPS 16,16
+LUMA_HPS 16,32
+LUMA_HPS 16,64
+LUMA_HPS 24,32
+LUMA_HPS 32,8
+LUMA_HPS 32,16
+LUMA_HPS 32,24
+LUMA_HPS 32,32
+LUMA_HPS 32,64
+LUMA_HPS 48,64
+LUMA_HPS 64,16
+LUMA_HPS 64,32
+LUMA_HPS 64,48
+LUMA_HPS 64,64
diff -urN x265_3.5.orig/source/common/aarch64/mc-a.S x265_3.5/source/common/aarch64/mc-a.S
--- x265_3.5.orig/source/common/aarch64/mc-a.S 2021-03-16 13:53:00.000000000 +0100
+++ x265_3.5/source/common/aarch64/mc-a.S 2022-02-22 10:13:49.991449401 +0100
@@ -23,7 +23,11 @@

#include "asm.S"

+#ifdef __APPLE__
+.section __RODATA,__rodata
+#else
.section .rodata
+#endif

.align 4

diff -urN x265_3.5.orig/source/common/aarch64/pixel-util.S x265_3.5/source/common/aarch64/pixel-util.S
--- x265_3.5.orig/source/common/aarch64/pixel-util.S 2021-03-16 13:53:00.000000000 +0100
+++ x265_3.5/source/common/aarch64/pixel-util.S 2022-02-22 10:13:49.991449401 +0100
@@ -24,7 +24,11 @@

#include "asm.S"

+#ifdef __APPLE__
+.section __RODATA,__rodata
+#else
.section .rodata
+#endif

.align 4

diff -urN x265_3.5.orig/source/common/aarch64/sad-a.S x265_3.5/source/common/aarch64/sad-a.S
--- x265_3.5.orig/source/common/aarch64/sad-a.S 2021-03-16 13:53:00.000000000 +0100
+++ x265_3.5/source/common/aarch64/sad-a.S 2022-02-22 10:13:49.991449401 +0100
@@ -23,7 +23,11 @@

#include "asm.S"

+#ifdef __APPLE__
+.section __RODATA,__rodata
+#else
.section .rodata
+#endif

.align 4

@@ -94,12 +98,12 @@
endfunc
.endm

-SAD_X_8xN 3 4
-SAD_X_8xN 3 8
-SAD_X_8xN 3 16
-SAD_X_8xN 3 32
-
-SAD_X_8xN 4 4
-SAD_X_8xN 4 8
-SAD_X_8xN 4 16
-SAD_X_8xN 4 32
+SAD_X_8xN 3,4
+SAD_X_8xN 3,8
+SAD_X_8xN 3,16
+SAD_X_8xN 3,32
+
+SAD_X_8xN 4,4
+SAD_X_8xN 4,8
+SAD_X_8xN 4,16
+SAD_X_8xN 4,32
diff -urN x265_3.5.orig/source/test/testharness.h x265_3.5/source/test/testharness.h
--- x265_3.5.orig/source/test/testharness.h 2021-03-16 13:53:00.000000000 +0100
+++ x265_3.5/source/test/testharness.h 2022-02-22 10:13:49.991449401 +0100
@@ -73,7 +73,7 @@
#include <x86intrin.h>
#elif ( !defined(__APPLE__) && defined (__GNUC__) && defined(__ARM_NEON__))
#include <arm_neon.h>
-#elif defined(__GNUC__) && (!defined(__clang__) || __clang_major__ < 4)
+#else
/* fallback for older GCC/MinGW */
static inline uint32_t __rdtsc(void)
{
2 changes: 1 addition & 1 deletion scripts/build-ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
Package(
name="x265",
requires=["cmake"],
source_url="https://bitbucket.org/multicoreware/x265_git/downloads/x265_4.1.tar.gz",
source_url="https://bitbucket.org/multicoreware/x265_git/downloads/x265_3.5.tar.gz",
build_system="cmake",
source_dir="source",
gpl=True,
Expand Down

0 comments on commit e08727b

Please sign in to comment.