From: Christian Weisgerber Subject: audio/opus: update to 1.5.1 To: ports@openbsd.org Date: Mon, 18 Mar 2024 09:33:31 +0100 audio/opus: update to 1.5.1 * Significant improvement to packet loss robustness using Deep Redundancy * Improved packet loss concealment through Deep PLC * Low-bitrate speech quality enhancement down to 6 kb/s wideband * Improved x86 (AVX2) and Arm (Neon) optimizations * Support for 4th and 5th order ambisonics This update enables the new machine learning features: https://opus-codec.org/demo/opus-1.5/ I decided to enable the ML features because they must be explicitly enabled by the caller, so apart from code size, having them doesn't incur any cost. I added the missing detection code for arm and arm64 instruction set extensions. This could use another pair of eyes. The PRESUME defines are set by testing whether certain intrinsics can be compiled with the default compiler options, so the idea is that those instructions are supported by all machines this code was compiled for. The MAY_HAVE defines are set by testing with additional -march compiler flags, so the idea is that only some machines will actually support those instructions, as determined by a runtime check. The port needs a compile test on armv7. An additional small fix was needed for FreeBSD/armv7, but I have trouble understanding it and I don't know if OpenBSD is affected, too. diff be988415f4d56f263d8683085eef00ba2324920c d65615b6802f8ddeb4536c340034d07be3df3483 commit - be988415f4d56f263d8683085eef00ba2324920c commit + d65615b6802f8ddeb4536c340034d07be3df3483 blob - 0c28150d8be0e27c51d8e512e8f3e7e88893310d blob + 347df1e7d4a575894c0f9c37ca92e7085b941f0b --- audio/opus/Makefile +++ audio/opus/Makefile @@ -1,8 +1,8 @@ COMMENT= IETF audio codec -VERSION= 1.4 +VERSION= 1.5.1 DISTNAME= opus-${VERSION} -SHARED_LIBS= opus 1.4 # 9.0 +SHARED_LIBS= opus 1.5 # 10.0 CATEGORIES= audio HOMEPAGE= https://opus-codec.org/ @@ -12,8 +12,7 @@ MAINTAINER= Christian Weisgerber # BSD PERMIT_PACKAGE= Yes -SITES= https://downloads.xiph.org/releases/opus/ \ - https://github.com/xiph/opus/releases/download/v${VERSION}/ +SITES= https://downloads.xiph.org/releases/opus/ WANTLIB= m @@ -21,5 +20,10 @@ USE_GMAKE= Yes SEPARATE_BUILD= Yes CONFIGURE_STYLE=gnu CONFIGURE_ARGS= --disable-doc # requires doxygen +# enable machine learning features +CONFIGURE_ARGS+=--enable-dred \ + --enable-osce +DEBUG_PACKAGES= ${BUILD_PACKAGES} + .include blob - 4a01917d51a99dbf17ef11f597907f3ab2f7e692 blob + f2e7261c08569c1ee1e5798d9d7aebe8c817521c --- audio/opus/distinfo +++ audio/opus/distinfo @@ -1,2 +1,2 @@ -SHA256 (opus-1.4.tar.gz) = ybMrQlO+WuY9H/Fu6ga5S18PKVG3oCrO71jjo85JxR8= -SIZE (opus-1.4.tar.gz) = 1063408 +SHA256 (opus-1.5.1.tar.gz) = uEYQlZuNQXthGqEqIlZeCjcyCXxjidGQmNhEVD40D4U= +SIZE (opus-1.5.1.tar.gz) = 7834540 blob - /dev/null blob + dadb4de8cd32c628ccfd9f9485f6c0af473bc2cc (mode 644) --- /dev/null +++ audio/opus/patches/patch-celt_arm_armcpu_c @@ -0,0 +1,42 @@ +Index: celt/arm/armcpu.c +--- celt/arm/armcpu.c.orig ++++ celt/arm/armcpu.c +@@ -191,6 +191,38 @@ opus_uint32 opus_cpu_capabilities(void) + return flags; + } + ++#elif defined(__OpenBSD__) ++#include ++#include ++#include ++#include ++ ++opus_uint32 opus_cpu_capabilities(void) ++{ ++ opus_uint32 flags = 0; ++ ++#if defined(OPUS_ARM_MAY_HAVE_DOTPROD) && defined(CPU_ID_AA64ISAR0) ++ const int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; ++ uint64_t isar0; ++ size_t len = sizeof(isar0); ++ ++ if (sysctl(isar0_mib, 2, &isar0, &len, NULL, 0) != -1) ++ { ++ if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL) ++ flags |= OPUS_CPU_ARM_DOTPROD_FLAG; ++ } ++#endif ++ ++#if defined(OPUS_ARM_PRESUME_NEON_INTR) \ ++ || defined(OPUS_ARM_PRESUME_AARCH64_NEON_INTR) ++ flags |= OPUS_CPU_ARM_EDSP_FLAG | OPUS_CPU_ARM_MEDIA_FLAG | OPUS_CPU_ARM_NEON_FLAG; ++# if defined(OPUS_ARM_PRESUME_DOTPROD) ++ flags |= OPUS_CPU_ARM_DOTPROD_FLAG; ++# endif ++#endif ++ return flags; ++} ++ + #else + /* The feature registers which can tell us what the processor supports are + * accessible in priveleged modes only, so we can't have a general user-space -- Christian "naddy" Weisgerber naddy@mips.inka.de