Skip to contentSkip to conversation

package/x265: New package

PATCH New Bernd Kuhls 3 participants 4 messages Nov 18, 2014 – Jan 2, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/x265: New package

Depends on http://patchwork.ozlabs.org/patch/411789/

--
v2: Removed package-specific handling of CMAKE_SYSTEM_PROCESSOR

---
 package/Config.in           |    1 +
 package/x265/0001-arm.patch |   71 +++++++++++++++++++++++++++++++++++++++++++
 package/x265/Config.in      |   23 ++++++++++++++
 package/x265/x265.mk        |   34 +++++++++++++++++++++
 4 files changed, 129 insertions(+)
 create mode 100644 package/x265/0001-arm.patch
 create mode 100644 package/x265/Config.in
 create mode 100644 package/x265/x265.mk
package/Config.in +1 -0
index 9a73995..0084f9b 100644
@@ -773,6 +773,7 @@ menu "Multimedia"
 	source "package/live555/Config.in"
 	source "package/mediastreamer/Config.in"
 	source "package/x264/Config.in"
+	source "package/x265/Config.in"
 endmenu
 
 menu "Networking"
package/x265/0001-arm.patch new file +71 -0

71 lines not on this page · raw message

package/x265/Config.in new file +23 -0
new file mode 100644
index 0000000..bf8bd12
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_X265
+	bool "x265"
+	depends on BR2_i386 || BR2_x86_64 || BR2_arm
+	depends on !BR2_ARM_CPU_ARMV4
+	depends on BR2_INSTALL_LIBSTDCPP
+	help
+	  x265 is an open-source project and free application library for encoding
+	  video streams into the H.265/High Efficiency Video Coding (HEVC) format.
+
+	  http://x265.org
+
+if BR2_PACKAGE_X265
+
+config BR2_PACKAGE_X265_CLI
+	bool "CLI"
+	help
+	  Build standalone CLI application
+endif
+
+comment "x265 needs a toolchain w/ C++"
+	depends on BR2_i386 || BR2_x86_64 || BR2_arm
+	depends on !BR2_ARM_CPU_ARMV4
+	depends on !BR2_INSTALL_LIBSTDCPP
package/x265/x265.mk new file +34 -0
new file mode 100644
index 0000000..026fd26
@@ -0,0 +1,34 @@
+################################################################################
+#
+# x265
+#
+################################################################################
+
+X265_VERSION = 1.4
+X265_SOURCE = $(X265_VERSION).tar.bz2
+X265_SITE = https://bitbucket.org/multicoreware/x265/get
+X265_INSTALL_STAGING = YES
+X265_LICENSE = GPLv2
+X265_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_i386)$(BR2_x86_64),y)
+X265_DEPENDENCIES += host-yasm
+else
+X265_CONF_OPTS += --disable-asm
+endif
+
+# CMakeLists.txt is stored in $(@D)/source/, not in $(@D)/
+define X265_CONFIGURE_CMDS
+	(cd $(@D); \
+		$(HOST_DIR)/usr/bin/cmake -G "Unix Makefiles" source/ \
+			-DCMAKE_TOOLCHAIN_FILE="$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
+			-DCMAKE_BUILD_TYPE=$(if $(BR2_ENABLE_DEBUG),Debug,Release) \
+			-DCMAKE_INSTALL_PREFIX="/usr" \
+			-DCMAKE_COLOR_MAKEFILE=OFF \
+		-DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \
+		-DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
+		-DENABLE_CLI=$(if $(BR2_PACKAGE_X265_CLI),ON,OFF) \
+	)
+endef
+
+$(eval $(cmake-package))
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 2/2 package/ffmpeg: Add support for x265 encoding

---
 package/ffmpeg/ffmpeg.mk |    7 +++++++
 1 file changed, 7 insertions(+)
package/ffmpeg/ffmpeg.mk +7 -0
index 1a68fa0..8d84e5b 100644
@@ -236,6 +236,13 @@ else
 FFMPEG_CONF_OPTS += --disable-libx264
 endif
 
+ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy)
+FFMPEG_CONF_OPTS += --enable-libx265
+FFMPEG_DEPENDENCIES += x265
+else
+FFMPEG_CONF_OPTS += --disable-libx265
+endif
+
 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
 FFMPEG_CONF_OPTS += --enable-yasm
 FFMPEG_DEPENDENCIES += host-yasm
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 1/2 package/x265: New package

In reply to Bernd Kuhls

Hi Bernd,

Quoted 47 lines · Bernd Kuhls

Depends on http://patchwork.ozlabs.org/patch/411789/

--
v2: Removed package-specific handling of CMAKE_SYSTEM_PROCESSOR

---
 package/Config.in           |    1 +
 package/x265/0001-arm.patch |   71 +++++++++++++++++++++++++++++++++++++++++++
 package/x265/Config.in      |   23 ++++++++++++++
 package/x265/x265.mk        |   34 +++++++++++++++++++++
 4 files changed, 129 insertions(+)
 create mode 100644 package/x265/0001-arm.patch
 create mode 100644 package/x265/Config.in
 create mode 100644 package/x265/x265.mk
package/Config.in +1 -0
index 9a73995..0084f9b 100644
@@ -773,6 +773,7 @@ menu "Multimedia"
        source "package/live555/Config.in"
        source "package/mediastreamer/Config.in"
        source "package/x264/Config.in"
+       source "package/x265/Config.in"
 endmenu
 
 menu "Networking"
package/x265/0001-arm.patch new file +12 -0
new file mode 100644
index 0000000..69ae458
@@ -0,0 +1,71 @@
+Fix ARM build
+
+Fetched from https://github.com/archlinuxarm/PKGBUILDs/blob/master/extra/x265/arm.patch
+and adjusted paths so patch applies with -p1.
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+
+--- a/source/CMakeLists.txt.orig       2014-10-04 17:02:08.482815493 +0200
++++ b/source/CMakeLists.txt    2014-10-04 17:11:52.536865262 +0200
+@@ -46,10 +46,18 @@
+         set(X64 1)
+         add_definitions(-DX86_64=1)

package/x265/0001-arm.patch line 22

Quoted 10 lines
package/x265/0001-arm.patch new file +10 -0
+     endif()
+-elseif(${SYSPROC} STREQUAL "armv6l")
+-    message(STATUS "Detected ARM target processor")
+-    set(ARM 1)
+-    add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
++elseif(${SYSPROC} MATCHES "armv5.*")
++    message(STATUS "Detected ARMV5 system processor")
++    set(ARMV5 1)
++    add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=0 -DHAVE_NEON=0)
++elseif(${SYSPROC} STREQUAL "armv6l")

Is there any specific reason to not support big-endian?

package/x265/0001-arm.patch line 26

Quoted 4 lines
package/x265/0001-arm.patch new file +4 -0
++    message(STATUS "Detected ARMV6 system processor")
++    set(ARMV6 1)
++    add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1 -DHAVE_NEON=0)
++elseif(${SYSPROC} STREQUAL "armv7l")

ditto

Quoted 4 lines
package/x265/0001-arm.patch new file +4 -0
++    message(STATUS "Detected ARMV7 system processor")
++    set(ARMV7 1)
++    add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1 -DHAVE_NEON=0)
+ else()

package/x265/0001-arm.patch line 40

Quoted 10 lines
package/x265/0001-arm.patch new file +10 -0
+     message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
+     message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
+@@ -127,8 +135,8 @@
+     if(X86 AND NOT X64)
+         add_definitions(-march=i686)
+     endif()
+-    if(ARM)
+-        add_definitions(-march=armv6 -mfloat-abi=hard -mfpu=vfp)
++    if(ARMV7)
++        add_definitions(-fPIC)

Is this nested in a if(BUILD_SHARED_LIBS) block?
Does this mean x265 is not available for static build? If so, update the "depends on" statements in the Config.in.

Quoted 66 lines
package/x265/0001-arm.patch new file +31 -0
+     endif()
+     check_cxx_compiler_flag(-Wno-narrowing CC_HAS_NO_NARROWING)
+     check_cxx_compiler_flag(-ffast-math CC_HAS_FAST_MATH)
+--- a/source/common/cpu.cpp.orig       2014-10-04 17:13:58.507875996 +0200
++++ b/source/common/cpu.cpp    2014-10-04 17:21:11.170912864 +0200
+@@ -37,7 +37,7 @@
+ #include <machine/cpu.h>
+ #endif
+
+-#if X265_ARCH_ARM && !defined(HAVE_NEON)
++#if X265_ARCH_ARM && (!defined(HAVE_NEON) || HAVE_NEON==0)
+ #include <signal.h>
+ #include <setjmp.h>
+ static sigjmp_buf jmpbuf;
+@@ -340,7 +340,6 @@
+     }
+
+     canjump = 1;
+-    x265_cpu_neon_test();
+     canjump = 0;
+     signal(SIGILL, oldsig);
+ #endif // if !HAVE_NEON
+@@ -356,7 +355,7 @@
+     // which may result in incorrect detection and the counters stuck enabled.
+     // right now Apple does not seem to support performance counters for this test
+ #ifndef __MACH__
+-    flags |= x265_cpu_fast_neon_mrc_test() ? X265_CPU_FAST_NEON_MRC : 0;
++    //flags |= x265_cpu_fast_neon_mrc_test() ? X265_CPU_FAST_NEON_MRC : 0;
+ #endif
+     // TODO: write dual issue test? currently it's A8 (dual issue) vs. A9 (fast mrc)
+ #endif // if HAVE_ARMV6
package/x265/Config.in new file +23 -0
new file mode 100644
index 0000000..bf8bd12
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_X265
+       bool "x265"
+       depends on BR2_i386 || BR2_x86_64 || BR2_arm
+       depends on !BR2_ARM_CPU_ARMV4
+       depends on BR2_INSTALL_LIBSTDCPP
+       help
+         x265 is an open-source project and free application library for encoding
+         video streams into the H.265/High Efficiency Video Coding (HEVC) format.
+
+         http://x265.org
+
+if BR2_PACKAGE_X265
+
+config BR2_PACKAGE_X265_CLI
+       bool "CLI"
+       help
+         Build standalone CLI application
+endif
+
+comment "x265 needs a toolchain w/ C++"
+       depends on BR2_i386 || BR2_x86_64 || BR2_arm
+       depends on !BR2_ARM_CPU_ARMV4
+       depends on !BR2_INSTALL_LIBSTDCPP
package/x265/x265.mk new file +0 -0
new file mode 100644
index 0000000..026fd26

package/x265/x265.mk line 8

Quoted 8 lines
package/x265/x265.mk new file +8 -0
@@ -0,0 +1,34 @@
+################################################################################
+#
+# x265
+#
+################################################################################
+
+X265_VERSION = 1.4
+X265_SOURCE = $(X265_VERSION).tar.bz2

hmm... not a very good name for a source tarball!
We need to find a good solution to properly support this... Yann is working on it!

package/x265/x265.mk line 20

Quoted 12 lines
package/x265/x265.mk new file +12 -0
+X265_SITE = https://bitbucket.org/multicoreware/x265/get
+X265_INSTALL_STAGING = YES
+X265_LICENSE = GPLv2
+X265_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_i386)$(BR2_x86_64),y)
+X265_DEPENDENCIES += host-yasm
+else
+X265_CONF_OPTS += --disable-asm
+endif
+
+# CMakeLists.txt is stored in $(@D)/source/, not in $(@D)/

You could also use X265_SUBDIR = source

package/x265/x265.mk line 25

Quoted 5 lines
package/x265/x265.mk new file +5 -0
+define X265_CONFIGURE_CMDS
+       (cd $(@D); \
+               $(HOST_DIR)/usr/bin/cmake -G "Unix Makefiles" source/ \
+                       -DCMAKE_TOOLCHAIN_FILE="$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
+                       -DCMAKE_BUILD_TYPE=$(if $(BR2_ENABLE_DEBUG),Debug,Release) \

Already handled by the cmake infra [1]

package/x265/x265.mk line 26

Quoted 1 line
package/x265/x265.mk new file +1 -0
+                       -DCMAKE_INSTALL_PREFIX="/usr" \

ditto

package/x265/x265.mk line 27

Quoted 1 line
package/x265/x265.mk new file +1 -0
+                       -DCMAKE_COLOR_MAKEFILE=OFF \

ditto

package/x265/x265.mk line 28

Quoted 1 line
package/x265/x265.mk new file +1 -0
+               -DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \

ditto

package/x265/x265.mk line 29

Quoted 1 line
package/x265/x265.mk new file +1 -0
+               -DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \

ditto

Quoted 8 lines
package/x265/x265.mk new file +5 -1
+               -DENABLE_CLI=$(if $(BR2_PACKAGE_X265_CLI),ON,OFF) \
+       )
+endef
+
+$(eval $(cmake-package))
--

1.7.10.4

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

[1] http://nightly.buildroot.org/#cmake-package-reference

Regards,

Signature · 1 line
Samuel
#3 lore raw

PATCH v2 1/2 package/x265: New package

In reply to Bernd Kuhls

Dear Bernd Kuhls,

Quoted 3 lines · Bernd Kuhls

Depends on http://patchwork.ozlabs.org/patch/411789/

You had some review on this patch on the day you sent it, but you never resent a new version of the patches. Therefore, I'll mark this patch, and the following one touching ffmpeg as "Changes Requested" in patchwork. Can you resubmit updated versions that take into account the comments that were made?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com