From: Brad Smith Subject: Re: UPDATE: x265 4.2 To: ports@openbsd.org Date: Wed, 27 May 2026 17:14:06 -0400 ping. On 2026-05-10 4:54 p.m., Brad Smith wrote: > Here is an update to x265 4.2. > > > Version 4.2 > =========== > > New feature > ----------- > 1. Threaded Motion Estimation (Experimental feature)-It uses a dedicated thread > pool to precompute Motion Estimation in parallel. Improves encoding speed up > to 1.5x for 1080p & lower resolution on multi core machines with low frequency > setting. On high frequency systems or on machines with low number of cores, > the overhead of additional Motion estimation work may outweigh parallelism > > Enhancements to existing features > ------------- > > 1.Add new Levels 6.3 to 7.2 specified in ITU-T H.265 (V9) (09/2023) and above > 2.Improve Slices feature with check zeroMv > 3.Enable frame parallelism with MCSTF feature > 4.Updated support to signal AOM FGM params > 5.Improve quality with SBRC feature > 6.Updated DolbyVision P5 VUI defaults > > API changes > ----------- > 1. API Support to enable Threaded Motion Estimation(--threaded-me) > > Optimizations > ------------- > 1. RISC V optimizations including SAD, SATD, DCT, IDCT, block copy, pixel utilities, > SAO, loopfilter, transpose kernels resulting in 2x encoding speed. > 2. ARM SIMD optimizations including the use of NEON and SVE instruction set > extensions. The following algorithms now have optimized SIMD implementations: > DST, IDCT, SSE, SSD ,intra_pred_planar, pelFilterLumaStrong, interpolation, > planecopy, dequant_normal, blockcopy, pixel variance resulting in 8% faster > encoding speed compared to v4.1 > > Bug fixes > --------- > 1. Fix memory leaks (no command line option, SEI buffer, analysis save/load) > 2. Fix chroma qp offset for non yuv444 inputs > 3. Fix max supported input resolution > 4. Fix bugs with ARM SIMD optimizations > 5. Fix Alpha and Multiview feature flag support in x265_config > 6. Fix test harness issues, CMake errors > 7. Fix inconsistent output with aq-motion > 8. Fix crash with hist-scenecut on high bit-depth builds > 9. Fix lookahead concurrency bug > 10. Fix shared link issue (R_X86_64_PC32), yuv recon output issue, rd-refine and > dynamic-refine issue, inputs for Windows named pipe, weighted prediction > delta_chroma_offset, crf and vbv issue in abr-ladder, psnr and ssim reported > with MCSTF feature, internally overflowed VBV variables > > Known issues > ------------ > 1. Output mismatch between analysis save & load with cutree with reuse level < 10 > 2. Inconsistent hash mismatch with abr-ladder feature > 3. Performance regression observed with threaded-me feature on high frequency > systems and for higher resolutions (4k) > > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/multimedia/x265/Makefile,v > retrieving revision 1.62 > diff -u -p -u -p -r1.62 Makefile > --- Makefile 13 Feb 2026 12:02:17 -0000 1.62 > +++ Makefile 10 May 2026 11:47:00 -0000 > @@ -1,13 +1,12 @@ > COMMENT= free H.265/HEVC encoder > > -VER= 4.1 > +VER= 4.2 > DISTNAME= x265_${VER} > PKGNAME= x265-${VER} > -REVISION= 0 > CATEGORIES= multimedia > -SITES= https://bitbucket.org/multicoreware/x265_git/downloads/ > +SITES= https://github.com/Multicorewareinc/x265/releases/download/${VER}/ > > -SHARED_LIBS= x265 25.0 > +SHARED_LIBS= x265 26.0 > > HOMEPAGE= https://x265.org/ > > @@ -33,8 +32,6 @@ CONFIGURE_ARGS+=-DCMAKE_ASM_YASM_FLAGS_D > -DENABLE_PIC=On \ > -DENABLE_TESTS=On \ > -DGIT_ARCHETYPE=1 > - > -MODCMAKE_POLICY_VERSION_OVERRIDE = Yes > > .if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "i386" > CONFIGURE_ARGS+=-DENABLE_ASSEMBLY=Off > Index: distinfo > =================================================================== > RCS file: /cvs/ports/multimedia/x265/distinfo,v > retrieving revision 1.28 > diff -u -p -u -p -r1.28 distinfo > --- distinfo 2 Dec 2024 10:40:47 -0000 1.28 > +++ distinfo 10 May 2026 11:47:00 -0000 > @@ -1,2 +1,2 @@ > -SHA256 (x265_4.1.tar.gz) = oxaZxqiYBrdLAVHl5qffZd5LSQUEgv5ev4pDedevjyk= > -SIZE (x265_4.1.tar.gz) = 1725279 > +SHA256 (x265_4.2.tar.gz) = QLHqBFPgMJ8OupNODd9TP49ilZZmeeiJTo8cHI1eEhA= > +SIZE (x265_4.2.tar.gz) = 1833442 > Index: patches/patch-source_CMakeLists_txt > =================================================================== > RCS file: /cvs/ports/multimedia/x265/patches/patch-source_CMakeLists_txt,v > retrieving revision 1.10 > diff -u -p -u -p -r1.10 patch-source_CMakeLists_txt > --- patches/patch-source_CMakeLists_txt 13 Feb 2026 12:02:17 -0000 1.10 > +++ patches/patch-source_CMakeLists_txt 10 May 2026 11:47:00 -0000 > @@ -1,25 +1,10 @@ > - Add run-time CPU feature detection for FreeBSD / OpenBSD > +- Fix building AltiVec code on powerpc64 > > Index: source/CMakeLists.txt > --- source/CMakeLists.txt.orig > +++ source/CMakeLists.txt > -@@ -7,13 +7,13 @@ if(NOT CMAKE_BUILD_TYPE) > - endif() > - message(STATUS "cmake version ${CMAKE_VERSION}") > - if(POLICY CMP0025) > -- cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang > -+ cmake_policy(SET CMP0025 NEW) # report Apple's Clang as just Clang > - endif() > - if(POLICY CMP0042) > - cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH > - endif() > - if(POLICY CMP0054) > -- cmake_policy(SET CMP0054 OLD) # Only interpret if() arguments as variables or keywords when unquoted > -+ cmake_policy(SET CMP0054 NEW) # Only interpret if() arguments as variables or keywords when unquoted > - endif() > - > - project (x265) > -@@ -88,7 +88,7 @@ elseif(ARM64MATCH GREATER "-1") > +@@ -91,7 +91,7 @@ elseif(ARM64MATCH GREATER "-1") > option(AARCH64_WARNINGS_AS_ERRORS "Build with -Werror for AArch64 Intrinsics files" OFF) > > option(AARCH64_RUNTIME_CPU_DETECT "Enable AArch64 run-time CPU feature detection" ON) > @@ -28,12 +13,21 @@ Index: source/CMakeLists.txt > set(AARCH64_RUNTIME_CPU_DETECT OFF CACHE BOOL "" FORCE) > message(STATUS "Run-time CPU feature detection unsupported on this platform") > endif() > -@@ -522,6 +522,16 @@ endif() > +@@ -120,6 +120,10 @@ elseif(RISCV64MATCH GREATER "-1") > + set(RISCV64 1) > + > + option(RISCV64_RUNTIME_CPU_DETECT "Enable RISCV64 run-time CPU feature detection" ON) > ++ if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|OpenBSD") > ++ set(RISCV64_RUNTIME_CPU_DETECT OFF CACHE BOOL "" FORCE) > ++ message(STATUS "Run-time CPU feature detection unsupported on this platform") > ++ endif() > > - if(ENABLE_ASSEMBLY) > + option(ENABLE_RVV "Enable RVV" ON) > + > +@@ -664,6 +668,16 @@ if(ENABLE_ASSEMBLY) > add_definitions(-DENABLE_ASSEMBLY) > -+endif() > -+ > + endif() > + > +check_symbol_exists(getauxval sys/auxv.h HAVE_GETAUXVAL) > +if(HAVE_GETAUXVAL) > + add_definitions(-DHAVE_GETAUXVAL=1) > @@ -42,6 +36,21 @@ Index: source/CMakeLists.txt > +check_symbol_exists(elf_aux_info sys/auxv.h HAVE_ELF_AUX_INFO) > +if(HAVE_ELF_AUX_INFO) > + add_definitions(-DHAVE_ELF_AUX_INFO=1) > - endif() > - > ++endif() > ++ > option(CHECKED_BUILD "Enable run-time sanity checks (debugging)" OFF) > + if(CHECKED_BUILD) > + add_definitions(-DCHECKED_BUILD=1) > +@@ -785,7 +799,11 @@ if(POWER) > + # IBM Power8 > + option(ENABLE_ALTIVEC "Enable ALTIVEC profiling instrumentation" ON) > + if(ENABLE_ALTIVEC) > +- add_definitions(-DHAVE_ALTIVEC=1 -maltivec -mabi=altivec) > ++ add_definitions(-DHAVE_ALTIVEC=1 -maltivec) > ++ check_cxx_compiler_flag(-mabi=altivec CC_HAS_MABI_ALTIVEC) > ++ if(CC_HAS_MABI_ALTIVEC) > ++ add_definitions(-mabi=altivec) > ++ endif() > + add_definitions(-flax-vector-conversions -fpermissive) > + else() > + add_definitions(-DHAVE_ALTIVEC=0) > Index: patches/patch-source_common_aarch64_cpu_h > =================================================================== > RCS file: /cvs/ports/multimedia/x265/patches/patch-source_common_aarch64_cpu_h,v > retrieving revision 1.1 > diff -u -p -u -p -r1.1 patch-source_common_aarch64_cpu_h > --- patches/patch-source_common_aarch64_cpu_h 2 Dec 2024 10:40:47 -0000 1.1 > +++ patches/patch-source_common_aarch64_cpu_h 10 May 2026 11:47:00 -0000 > @@ -3,7 +3,7 @@ > Index: source/common/aarch64/cpu.h > --- source/common/aarch64/cpu.h.orig > +++ source/common/aarch64/cpu.h > -@@ -119,7 +119,7 @@ static inline int aarch64_get_cpu_flags() > +@@ -127,7 +127,7 @@ static inline int aarch64_get_cpu_flags() > return flags; > } > > @@ -12,14 +12,14 @@ Index: source/common/aarch64/cpu.h > > #include > > -@@ -133,10 +133,10 @@ static inline int aarch64_get_cpu_flags() > +@@ -142,10 +142,10 @@ static inline int aarch64_get_cpu_flags() > int flags = 0; > > #if HAVE_NEON_DOTPROD || HAVE_SVE > - unsigned long hwcap = getauxval(AT_HWCAP); > + unsigned long hwcap = x265_getauxval(AT_HWCAP); > #endif > - #if HAVE_NEON_I8MM || HAVE_SVE2 > + #if HAVE_NEON_I8MM || HAVE_SVE2 || HAVE_SVE2_BITPERM > - unsigned long hwcap2 = getauxval(AT_HWCAP2); > + unsigned long hwcap2 = x265_getauxval(AT_HWCAP2); > #endif > Index: patches/patch-source_common_cpu_cpp > =================================================================== > RCS file: /cvs/ports/multimedia/x265/patches/patch-source_common_cpu_cpp,v > retrieving revision 1.4 > diff -u -p -u -p -r1.4 patch-source_common_cpu_cpp > --- patches/patch-source_common_cpu_cpp 9 Dec 2024 22:37:26 -0000 1.4 > +++ patches/patch-source_common_cpu_cpp 10 May 2026 11:47:00 -0000 > @@ -23,7 +23,7 @@ Index: source/common/cpu.cpp > #include > #include > static sigjmp_buf jmpbuf; > -@@ -128,6 +132,22 @@ const cpu_name_t cpu_names[] = > +@@ -137,6 +141,22 @@ const cpu_name_t cpu_names[] = > { "", 0 }, > }; > > @@ -46,7 +46,7 @@ Index: source/common/cpu.cpp > #if X265_ARCH_X86 > > extern "C" { > -@@ -348,6 +368,8 @@ void PFX(cpu_neon_test)(void); > +@@ -357,6 +377,8 @@ void PFX(cpu_neon_test)(void); > int PFX(cpu_fast_neon_mrc_test)(void); > } > > @@ -55,8 +55,8 @@ Index: source/common/cpu.cpp > uint32_t cpu_detect(bool benableavx512) > { > int flags = 0; > -@@ -355,6 +377,11 @@ uint32_t cpu_detect(bool benableavx512) > - #if HAVE_ARMV6 > +@@ -364,6 +386,11 @@ uint32_t cpu_detect(bool benableavx512) > + #if HAVE_ARMV6 && ENABLE_ASSEMBLY > flags |= X265_CPU_ARMV6; > > +#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO > @@ -67,7 +67,7 @@ Index: source/common/cpu.cpp > // don't do this hack if compiled with -mfpu=neon > #if !HAVE_NEON > static void (* oldsig)(int); > -@@ -372,6 +399,7 @@ uint32_t cpu_detect(bool benableavx512) > +@@ -381,6 +408,7 @@ uint32_t cpu_detect(bool benableavx512) > #endif // if !HAVE_NEON > > flags |= X265_CPU_NEON; > Index: patches/patch-source_common_riscv64_cpu_h > =================================================================== > RCS file: patches/patch-source_common_riscv64_cpu_h > diff -N patches/patch-source_common_riscv64_cpu_h > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-source_common_riscv64_cpu_h 10 May 2026 11:47:00 -0000 > @@ -0,0 +1,59 @@ > +- Add run-time CPU feature detection for FreeBSD / OpenBSD > + > +Index: source/common/riscv64/cpu.h > +--- source/common/riscv64/cpu.h.orig > ++++ source/common/riscv64/cpu.h > +@@ -28,12 +28,13 @@ > + > + #if RISCV64_RUNTIME_CPU_DETECT > + > +-#if defined(__linux__) > ++#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO > + > + #include > + > + #define HWCAP_RISCV64_RVV (1 << ('V' - 'A')) > + > ++#ifdef __linux__ > + static int parse_proc_cpuinfo(const char *flag) { > + FILE *file = fopen("/proc/cpuinfo", "r"); > + if (file == NULL) > +@@ -52,31 +53,34 @@ static int parse_proc_cpuinfo(const char *flag) { > + fclose(file); > + return found; > + } > ++#endif > + > + static inline uint32_t riscv64_cpu_detect() > + { > + uint32_t flags = 0; > + > +- unsigned long hwcap = getauxval(AT_HWCAP); > ++ unsigned long hwcap = x265_getauxval(AT_HWCAP); > + > + if (hwcap & HWCAP_RISCV64_RVV) { > + flags |= X265_CPU_RVV; > + > ++#ifdef __linux__ > + if (parse_proc_cpuinfo("zbb")) > + flags |= X265_CPU_ZBB; > ++#endif > + } > + > + return flags; > + } > + > +-#else // defined(__linux__) > ++#else // HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO > + #error \ > + "Run-time CPU feature detection selected, but no detection method" \ > + "available for your platform. Rerun cmake configure with" \ > + "-DRISCV64_RUNTIME_CPU_DETECT=OFF." > +-#endif // defined(__linux__) > ++#endif // HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO > + > +-#else // if AARCH64_RUNTIME_CPU_DETECT > ++#else // if RISCV64_RUNTIME_CPU_DETECT > + > + static inline uint32_t riscv64_cpu_detect() > + { > Index: patches/patch-source_common_x86_x86inc_asm > =================================================================== > RCS file: /cvs/ports/multimedia/x265/patches/patch-source_common_x86_x86inc_asm,v > retrieving revision 1.2 > diff -u -p -u -p -r1.2 patch-source_common_x86_x86inc_asm > --- patches/patch-source_common_x86_x86inc_asm 7 May 2024 15:01:27 -0000 1.2 > +++ patches/patch-source_common_x86_x86inc_asm 10 May 2026 11:47:00 -0000 > @@ -1,7 +1,7 @@ > Index: source/common/x86/x86inc.asm > --- source/common/x86/x86inc.asm.orig > +++ source/common/x86/x86inc.asm > -@@ -731,6 +731,9 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, > +@@ -757,6 +757,9 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, > %endif > align function_align > %2: >