Skip to content

Commit

Permalink
multimedia/x265: upgrade to 3.5. Finally...
Browse files Browse the repository at this point in the history
PR:	274526
Submitted by:	takefu
Release Notes:
	https://x265.readthedocs.io/en/master/releasenotes.html#version-3-5
  • Loading branch information
Mikhail Teterin authored and Mikhail Teterin committed Dec 15, 2023
1 parent f14b1c8 commit 645419c
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 40 deletions.
16 changes: 9 additions & 7 deletions multimedia/x265/Makefile
@@ -1,9 +1,11 @@
PORTNAME= x265
PORTVERSION= 3.4
PORTREVISION= 3
PORTVERSION= 3.5
CATEGORIES= multimedia
MASTER_SITES= https://bitbucket.org/multicoreware/x265_git/get/${BB_TAG}.tar.gz?meow=/

PATCH_SITES= https://bitbucket.org/multicoreware/x265_git/commits/8f18e3ad32684eee95e885e718655f93951128c3/raw/
PATCHFILES+= x265-asm-warnings.patch:-p1

MAINTAINER= mi@aldan.algebra.com
COMMENT= H.265/High Efficiency Video Coding (HEVC) format
WWW= https://www.x265.org/
Expand All @@ -13,9 +15,9 @@ LICENSE_FILE= ${WRKSRC:H}/COPYING

USES= cmake compiler:c++14-lang cpe pathfix dos2unix

CPE_VENDOR= multicorewareinc
CPE_VENDOR= multicorewareinc

BB_TAG= 25b2c07035ff # Top of the Release_3.4 branch at this time
BB_TAG= Release_${DISTVERSION}

OPTIONS_DEFINE= DEBUG OPTIMIZED_FLAGS VMAF
OPTIONS_DEFAULT= OPTIMIZED_FLAGS HI8P HI10P HI12P
Expand All @@ -30,7 +32,7 @@ OPTIONS_DEFAULT_powerpc64le= ASM
OPTIONS_MULTI= PixelWidth
OPTIONS_MULTI_PixelWidth=HI8P HI10P HI12P

DOS2UNIX_FILES= abrEncApp.cpp
DOS2UNIX_FILES= common/scaler.cpp
DEBUG_PREVENTS= OPTIMIZED_FLAGS
DEBUG_PREVENTS_MSG= Optimizations are incompatible with debugging code
DEBUG_CMAKE_ON= -DCMAKE_ASM_NASM_FLAGS:STRING="-g -O0"
Expand All @@ -41,7 +43,7 @@ SVTHEVC_CMAKE_ON= -DSVT_HEVC_INCLUDE_DIR:PATH="${LOCALBASE}/include/svt-hevc"
VMAF_LIB_DEPENDS= libvmaf.so:multimedia/vmaf
VMAF_USES= localbase:ldflags
VMAF_CMAKE_BOOL= ENABLE_LIBVMAF
VMAF_CMAKE_ON= -DVMAF_INCLUDE_DIR:PATH="${LOCALBASE}/include/libvmaf"
VMAF_CMAKE_ON= -DVMAF_INCLUDE_DIR:PATH="${LOCALBASE}/include/libvmaf"

DEBUG_DESC= Enable debugging
HI8P_DESC= Enable 8-bit pixel-width (you, probably, want this)
Expand All @@ -54,7 +56,7 @@ VMAF_DESC= Per frame and aggregate VMAF score
USE_LDCONFIG= yes
CMAKE_ARGS= -DENABLE_TESTS=on -DENABLE_HDR10_PLUS:BOOL=true
LDFLAGS_i386= -Wl,-znotext
EXTRACT_AFTER_ARGS+= --exclude compat --strip-components=1
EXTRACT_AFTER_ARGS+= --exclude compat --exclude md5\.* --strip-components=1
PATCH_WRKSRC= ${WRKSRC:H}
WRKSRC= ${WRKDIR}/source

Expand Down
8 changes: 5 additions & 3 deletions multimedia/x265/distinfo
@@ -1,3 +1,5 @@
TIMESTAMP = 1600662771
SHA256 (x265-3.4.tar.gz) = 01f17d94689ef79807fa2b4bd7f5f58bb18416e72a135c7f56c30162a980cfb8
SIZE (x265-3.4.tar.gz) = 1532396
TIMESTAMP = 1698027802
SHA256 (x265-3.5.tar.gz) = 8a5fcfddb3e2db520b637e475a507fb00117d554bdb3204c5828626d888c306a
SIZE (x265-3.5.tar.gz) = 1538610
SHA256 (x265-asm-warnings.patch) = 0faa3278887a47ed8c968c994e4cc71a2921aac38f5d560dae898124f806871d
SIZE (x265-asm-warnings.patch) = 4526
51 changes: 51 additions & 0 deletions multimedia/x265/files/patch-md5
@@ -0,0 +1,51 @@
--- source/common/picyuv.h 2023-06-27 10:11:49.000000000 -0400
+++ source/common/picyuv.h 2023-10-22 21:14:09.423270000 -0400
@@ -26,5 +26,5 @@

#include "common.h"
-#include "md5.h"
+#include <md5.h>
#include "x265.h"
struct x265_picyuv {};
--- source/encoder/frameencoder.h 2023-06-27 10:11:49.000000000 -0400
+++ source/encoder/frameencoder.h 2023-10-22 21:14:52.414503000 -0400
@@ -31,5 +31,4 @@
#include "frame.h"
#include "picyuv.h"
-#include "md5.h"

#include "analysis.h"
--- source/encoder/sei.h 2023-06-27 10:11:49.000000000 -0400
+++ source/encoder/sei.h 2023-10-22 21:15:50.862452000 -0400
@@ -29,5 +29,5 @@
#include "slice.h"
#include "nal.h"
-#include "md5.h"
+#include <md5.h>

namespace X265_NS {
--- source/encoder/frameencoder.cpp 2023-06-27 10:11:49.000000000 -0400
+++ source/encoder/frameencoder.cpp 2023-10-22 21:27:55.363979000 -0400
@@ -426,5 +426,5 @@
m_seiReconPictureDigest.m_method = SEIDecodedPictureHash::MD5;
for (int i = 0; i < planes; i++)
- MD5Final(&m_seiReconPictureDigest.m_state[i], m_seiReconPictureDigest.m_digest[i]);
+ MD5Final(m_seiReconPictureDigest.m_digest[i], &m_seiReconPictureDigest.m_state[i]);
payloadSize = 1 + 16 * planes;
}
--- source/CMakeLists.txt 2023-06-27 10:11:49.000000000 -0400
+++ source/CMakeLists.txt 2023-10-22 21:54:36.900303000 -0400
@@ -96,4 +96,5 @@
if(UNIX)
list(APPEND PLATFORM_LIBS pthread)
+ list(APPEND PLATFORM_LIBS md)
find_library(LIBRT rt)
if(LIBRT)
--- source/common/CMakeLists.txt 2023-06-27 10:11:49.000000000 -0400
+++ source/common/CMakeLists.txt 2023-10-22 21:21:56.177834000 -0400
@@ -156,5 +156,4 @@
threadpool.cpp threadpool.h
wavefront.h wavefront.cpp
- md5.cpp md5.h
bitstream.h bitstream.cpp
yuv.cpp yuv.h
12 changes: 6 additions & 6 deletions multimedia/x265/files/patch-source_CMakeLists.txt
@@ -1,6 +1,6 @@
--- source/CMakeLists.txt.orig 2021-10-31 01:46:10 UTC
+++ source/CMakeLists.txt
@@ -43,7 +43,7 @@ set(X86_ALIASES x86 i386 i686 x86_64 amd64)
--- source/CMakeLists.txt 2023-10-22 22:08:10.704150000 -0400
+++ source/CMakeLists.txt 2023-10-22 22:10:02.947579000 -0400
@@ -43,7 +43,7 @@
set(ARM_ALIASES armv6l armv7l aarch64)
list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
Expand All @@ -9,15 +9,15 @@
list(FIND POWER_ALIASES "${SYSPROC}" POWERMATCH)
if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
set(X86 1)
@@ -121,6 +121,7 @@ if(UNIX)
@@ -122,6 +122,7 @@
option(ENABLE_LIBVMAF "Enable VMAF" OFF)
if(ENABLE_LIBVMAF)
add_definitions(-DENABLE_LIBVMAF)
+ include_directories(${VMAF_INCLUDE_DIR})
endif()
endif(UNIX)

@@ -592,12 +593,6 @@ if(ENABLE_HDR10_PLUS)
@@ -593,12 +594,6 @@
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
endif()

Expand All @@ -30,7 +30,7 @@
install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))
if(MSVC_IDE)
@@ -649,7 +644,10 @@ if(ENABLE_SHARED)
@@ -650,7 +645,10 @@
if(EXTRA_LIB)
target_link_libraries(x265-shared ${EXTRA_LIB})
endif()
Expand Down
8 changes: 5 additions & 3 deletions multimedia/x265/files/patch-source_cmake_Findsvthevc.cmake
@@ -1,6 +1,7 @@
--- source/cmake/Findsvthevc.cmake 2020-05-29 17:39:35.000000000 +0000
+++ source/cmake/Findsvthevc.cmake 2020-08-07 02:26:55.307048000 +0000
@@ -39,9 +39,5 @@
--- source/cmake/Findsvthevc.cmake.orig 2023-05-08 09:43:31 UTC
+++ source/cmake/Findsvthevc.cmake
@@ -38,11 +38,7 @@ if(SVT_HEVC_INCLUDE_DIR)
string(REGEX MATCH "SVT_VERSION_PATCHLEVEL \\(([0-9]*)\\)" _ ${version})
set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})

- if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL "4" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "1")
Expand All @@ -11,3 +12,4 @@
+ message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")
else()
message (SEND_ERROR "-- Required version of SVT-HEVC Lib: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure ")
endif()
11 changes: 1 addition & 10 deletions multimedia/x265/files/patch-source_common_version.cpp
@@ -1,4 +1,4 @@
--- source/common/version.cpp.orig 2020-05-29 17:39:35 UTC
--- source/common/version.cpp.orig 2023-06-27 14:11:49 UTC
+++ source/common/version.cpp
@@ -63,6 +63,8 @@
#define ONOS "[Linux]"
Expand All @@ -9,12 +9,3 @@
#elif __CYGWIN__
#define ONOS "[Cygwin]"
#elif __APPLE__
@@ -71,7 +73,7 @@
#define ONOS "[Unk-OS]"
#endif

-#if X86_64
+#if defined(X86_64) || X265_ARCH_ARM64
#define BITS "[64 bit]"
#else
#define BITS "[32 bit]"
19 changes: 13 additions & 6 deletions multimedia/x265/files/patch-source_encoder_api.cpp
Expand Up @@ -8,37 +8,44 @@ See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248479

-mi

--- source/encoder/api.cpp 2020-05-29 13:39:35.000000000 -0400
+++ source/encoder/api.cpp 2020-08-06 22:51:30.227635000 -0400
@@ -451,5 +451,7 @@
--- source/encoder/api.cpp.orig 2023-06-27 14:11:49 UTC
+++ source/encoder/api.cpp
@@ -449,14 +449,18 @@ int x265_encoder_encode(x265_encoder *enc, x265_nal **

if (pic_in->rpu.payloadSize)
{
+#if ! SVT_CHECK_VERSION(1, 5, 0)
inputData->dolbyVisionRpu.payload = X265_MALLOC(uint8_t, 1024);
+#endif
memcpy(inputData->dolbyVisionRpu.payload, pic_in->rpu.payload, pic_in->rpu.payloadSize);
inputData->dolbyVisionRpu.payloadSize = pic_in->rpu.payloadSize;
@@ -458,5 +460,7 @@
inputData->dolbyVisionRpu.payloadType = NAL_UNIT_UNSPECIFIED;
}
else
{
+#if ! SVT_CHECK_VERSION(1, 5, 0)
inputData->dolbyVisionRpu.payload = NULL;
+#endif
inputData->dolbyVisionRpu.payloadSize = 0;
}
@@ -696,5 +700,7 @@

@@ -702,7 +706,9 @@ void x265_encoder_close(x265_encoder *enc)

svt_print_summary(enc);
EB_H265_ENC_INPUT *inputData = (EB_H265_ENC_INPUT*)encoder->m_svtAppData->inputPictureBuffer->pBuffer;
+#if ! SVT_CHECK_VERSION(1, 5, 0)
if (inputData->dolbyVisionRpu.payload) X265_FREE(inputData->dolbyVisionRpu.payload);
+#endif

X265_FREE(inputData);
@@ -2052,5 +2058,7 @@
X265_FREE(encoder->m_svtAppData->inputPictureBuffer);
@@ -2063,7 +2069,9 @@ int svt_initialise_input_buffer(x265_encoder *enc)
inputPtr->pBuffer = (unsigned char*)x265_malloc(sizeof(EB_H265_ENC_INPUT));

EB_H265_ENC_INPUT *inputData = (EB_H265_ENC_INPUT*)inputPtr->pBuffer;
+#if ! SVT_CHECK_VERSION(1, 5, 0)
inputData->dolbyVisionRpu.payload = NULL;
+#endif
inputData->dolbyVisionRpu.payloadSize = 0;


8 changes: 4 additions & 4 deletions multimedia/x265/files/patch-source_x265.h
@@ -1,13 +1,13 @@
https://github.com/Netflix/vmaf/commit/122089fa3d23

--- source/x265.h.orig 2020-09-16 15:52:49 UTC
--- source/x265.h.orig 2023-06-27 14:11:49 UTC
+++ source/x265.h
@@ -733,7 +733,7 @@ typedef struct x265_vmaf_commondata
@@ -753,7 +753,7 @@ typedef struct x265_vmaf_commondata
int enable_conf_interval;
}x265_vmaf_commondata;

-static const x265_vmaf_commondata vcd[] = { { NULL, (char *)"/usr/local/share/model/vmaf_v0.6.1.pkl", NULL, NULL, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 1, 0 } };
+static const x265_vmaf_commondata vcd[] = { { NULL, (char *)"/usr/local/share/model/vmaf_v0.6.1.json", NULL, NULL, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 1, 0 } };

/* x265 input parameters
*
typedef struct x265_temporal_layer {
int poc_offset; /* POC offset */

0 comments on commit 645419c

Please sign in to comment.