1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-30 05:40:06 +00:00

multimedia/aom: add new port

AOMedia Video 1 (AV1), is an open, royalty-free video coding format
designed for video transmissions over the Internet. It is being
developed by the Alliance for Open Media (AOMedia), a consortium of
firms from the semiconductor industry, video on demand providers, and
web browser developers, founded in 2015.

https://aomedia.org/
This commit is contained in:
Jan Beich 2018-09-02 16:32:21 +00:00
parent 8a5da497b6
commit 907448d092
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=478807
11 changed files with 346 additions and 6 deletions

View File

@ -10,6 +10,7 @@
SUBDIR += abby
SUBDIR += acidrip
SUBDIR += aegisub
SUBDIR += aom
SUBDIR += aravis
SUBDIR += asdcplib
SUBDIR += assimp

32
multimedia/aom/Makefile Normal file
View File

@ -0,0 +1,32 @@
# $FreeBSD$
PORTNAME= aom
DISTVERSIONPREFIX= v
DISTVERSION= 1.0.0
CATEGORIES= multimedia
MASTER_SITES= LOCAL/jbeich # GitHub mirror is still importing...
MAINTAINER= jbeich@FreeBSD.org
COMMENT= AV1 Codec Library
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= ${BUILD_DEPENDS_${ARCH}}
BUILD_DEPENDS_amd64= nasm:devel/nasm
BUILD_DEPENDS_i386= nasm:devel/nasm
USES= cmake:outsource compiler:c++11-lib perl5
USE_GITHUB= yes
USE_PERL5= build
USE_LDCONFIG= yes
GH_ACCOUNT= jbeich # mirror
CMAKE_ON= BUILD_SHARED_LIBS
CMAKE_OFF= ENABLE_DOCS ENABLE_TESTS
post-patch:
# Extract (snapshot) version from GH_TAGNAME instead of CHANGELOG
@${REINPLACE_CMD} 's,$${AOM_ROOT}/CHANGELOG,${GH_TAGNAME:S/^v//},' \
${WRKSRC}/build/cmake/version.cmake
.include <bsd.port.mk>

3
multimedia/aom/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1535885385
SHA256 (jbeich-aom-v1.0.0_GH0.tar.gz) = c6506418aaaa7cb787d5fd8a67ca3dd749139a6cceab72c6bc76c5f48247635b
SIZE (jbeich-aom-v1.0.0_GH0.tar.gz) = 2776803

View File

@ -0,0 +1,77 @@
- Assume NEON is enabled on aarch64
- Implement NEON runtime detection on FreeBSD
--- aom_ports/arm_cpudetect.c.orig 2018-06-25 14:54:59 UTC
+++ aom_ports/arm_cpudetect.c
@@ -38,7 +38,7 @@ static int arm_cpu_env_mask(void) {
return env && *env ? (int)strtol(env, NULL, 0) : ~0;
}
-#if !CONFIG_RUNTIME_CPU_DETECT
+#if !CONFIG_RUNTIME_CPU_DETECT || defined(__ARM_NEON)
int arm_cpu_caps(void) {
/* This function should actually be a no-op. There is no way to adjust any of
@@ -143,7 +143,61 @@ int arm_cpu_caps(void) {
}
return flags & mask;
}
-#else /* end __linux__ */
+#elif defined(__FreeBSD__)
+
+#if 0 // __has_include(<sys/auxv.h>)
+#include <sys/auxv.h>
+#else
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <elf.h>
+#include <errno.h>
+#include <unistd.h>
+
+static unsigned long getauxval(unsigned long type) {
+ Elf_Auxinfo auxv[AT_COUNT];
+ size_t len = sizeof(auxv);
+ int mib[] = {
+ CTL_KERN,
+ KERN_PROC,
+ KERN_PROC_AUXV,
+ getpid(),
+ };
+
+ if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) != -1) {
+ for (size_t i = 0; i < nitems(auxv); i++)
+ if ((unsigned long)auxv[i].a_type == type)
+ return auxv[i].a_un.a_val;
+
+ errno = ENOENT;
+ }
+ return 0;
+}
+#endif
+
+#ifndef AT_HWCAP
+#define AT_HWCAP 25 /* 16 on Linux */
+#endif
+
+#ifndef HWCAP_NEON
+#define HWCAP_NEON (1 << 12)
+#endif
+
+int arm_cpu_caps(void) {
+ int flags;
+ int mask;
+ unsigned long hwcaps;
+ if (!arm_cpu_env_flags(&flags)) {
+ return flags;
+ }
+ mask = arm_cpu_env_mask();
+ hwcaps = getauxval(AT_HWCAP);
+#if HAVE_NEON
+ if (hwcaps & HWCAP_NEON) flags |= HAS_NEON;
+#endif
+ return flags & mask;
+}
+#else /* end __FreeBSD__ */
#error \
"--enable-runtime-cpu-detect selected, but no CPU detection method " \
"available for your platform. Reconfigure with --disable-runtime-cpu-detect."

View File

@ -0,0 +1,68 @@
- Implement VSX detection on FreeBSD
--- aom_ports/ppc_cpudetect.c.orig 2018-06-25 14:54:59 UTC
+++ aom_ports/ppc_cpudetect.c
@@ -9,12 +9,6 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <asm/cputable.h>
-#include <linux/auxvec.h>
-
#include "config/aom_config.h"
#include "aom_ports/ppc.h"
@@ -37,6 +31,13 @@ static int cpu_env_mask(void) {
return env && *env ? (int)strtol(env, NULL, 0) : ~0;
}
+#if defined(__linux__)
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <asm/cputable.h>
+#include <linux/auxvec.h>
+
int ppc_simd_caps(void) {
int flags;
int mask;
@@ -75,6 +76,36 @@ out_close:
close(fd);
return flags & mask;
}
+#elif defined(__FreeBSD__)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <machine/cpu.h>
+
+int ppc_simd_caps(void) {
+ int flags;
+ int mask;
+ u_long cpu_features = 0;
+ size_t sz = sizeof(cpu_features);
+
+ // If AOM_SIMD_CAPS is set then allow only those capabilities.
+ if (!cpu_env_flags(&flags)) {
+ return flags;
+ }
+
+ mask = cpu_env_mask();
+
+ sysctlbyname("hw.cpu_features", &cpu_features, &sz, NULL, 0);
+#if HAVE_VSX
+ if (cpu_features & PPC_FEATURE_HAS_VSX) flags |= HAS_VSX;
+#endif
+
+ return flags & mask;
+}
+#else
+#error \
+ "--enable-runtime-cpu-detect selected, but no CPU detection method " \
+"available for your platform. Reconfigure with --disable-runtime-cpu-detect."
+#endif /* end __FreeBSD__ */
#else
// If there is no RTCD the function pointers are not used and can not be
// changed.

View File

@ -0,0 +1,31 @@
<stdint.h> isn't bootlegged via gtest.h on FreeBSD 10.* leading to
In file included from test/horz_superres_test.cc:14:
In file included from av1/encoder/encoder.h:36:
av1/encoder/rd.h:304:26: error: use of undeclared identifier 'INT64_MAX'
rd_stats->ref_rdcost = INT64_MAX;
^
av1/encoder/rd.h:325:20: error: use of undeclared identifier 'INT64_MAX'
rd_stats->dist = INT64_MAX;
^
av1/encoder/rd.h:326:22: error: use of undeclared identifier 'INT64_MAX'
rd_stats->rdcost = INT64_MAX;
^
av1/encoder/rd.h:327:19: error: use of undeclared identifier 'INT64_MAX'
rd_stats->sse = INT64_MAX;
^
av1/encoder/rd.h:331:26: error: use of undeclared identifier 'INT64_MAX'
rd_stats->ref_rdcost = INT64_MAX;
^
5 errors generated.
--- av1/encoder/rd.h.orig 2018-06-25 14:54:59 UTC
+++ av1/encoder/rd.h
@@ -13,6 +13,7 @@
#define AV1_ENCODER_RD_H_
#include <limits.h>
+#include <stdint.h>
#include "av1/common/blockd.h"

View File

@ -0,0 +1,52 @@
- uname -p returns amd64 on FreeBSD/OpenBSD but x86_64 on DragonFly/NetBSD
- Automatically fall back to generic without forcing downstream to maintain whitelist
- More ELF platforms can use GNU assembler on non-x86
--- build/cmake/aom_configure.cmake.orig 2018-06-25 14:54:59 UTC
+++ build/cmake/aom_configure.cmake
@@ -51,6 +51,7 @@ endforeach()
# Detect target CPU.
if(NOT AOM_TARGET_CPU)
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR
+ "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64" OR
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
set(AOM_TARGET_CPU "x86")
@@ -122,10 +123,8 @@ else()
endif()
if(NOT "${AOM_SUPPORTED_CPU_TARGETS}" MATCHES "${AOM_TARGET_CPU}")
- message(FATAL_ERROR
- "No RTCD support for ${AOM_TARGET_CPU}. Create it, or "
- "add -DAOM_TARGET_CPU=generic to your cmake command line for a "
- "generic build of libaom and tools.")
+ message(WARNING "No RTCD support for ${AOM_TARGET_CPU}. Assuming generic.")
+ set(AOM_TARGET_CPU generic)
endif()
if("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64")
@@ -151,20 +150,15 @@ elseif("${AOM_TARGET_CPU}" MATCHES "arm")
if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
set(AS_EXECUTABLE as)
set(AOM_AS_FLAGS -arch ${AOM_TARGET_CPU} -isysroot ${CMAKE_OSX_SYSROOT})
- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
- if(NOT AS_EXECUTABLE)
- set(AS_EXECUTABLE as)
- endif()
elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Windows")
if(NOT AS_EXECUTABLE)
set(AS_EXECUTABLE ${CMAKE_C_COMPILER} -c -mimplicit-it=always)
endif()
+ else()
+ if(NOT AS_EXECUTABLE)
+ set(AS_EXECUTABLE as)
+ endif()
endif()
- if(NOT AS_EXECUTABLE)
- message(FATAL_ERROR
- "Unknown assembler for: ${AOM_TARGET_CPU}-${AOM_TARGET_SYSTEM}")
- endif()
-
string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS)
endif()

View File

@ -0,0 +1,61 @@
ELF is also used on Solaris, BSDs, Haiku, Fuchsia, etc.
--- build/cmake/aom_optimization.cmake.orig 2018-06-25 14:54:59 UTC
+++ build/cmake/aom_optimization.cmake
@@ -83,24 +83,20 @@ function(get_asm_obj_format out_format)
if("${AOM_TARGET_CPU}" STREQUAL "x86_64")
if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
set(objformat "macho64")
- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
- set(objformat "elf64")
elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}"
STREQUAL "Windows")
set(objformat "win64")
else()
- message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}")
+ set(objformat "elf64")
endif()
elseif("${AOM_TARGET_CPU}" STREQUAL "x86")
if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
set(objformat "macho32")
- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
- set(objformat "elf32")
elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}"
STREQUAL "Windows")
set(objformat "win32")
else()
- message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}")
+ set(objformat "elf32")
endif()
else()
message(FATAL_ERROR
@@ -171,7 +167,13 @@ function(test_nasm)
message(FATAL_ERROR
"Unsupported nasm: macho32 object format not supported.")
endif()
- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
+ elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}"
+ STREQUAL "Windows")
+ if(NOT "${nasm_helptext}" MATCHES "win32")
+ message(FATAL_ERROR
+ "Unsupported nasm: win32 object format not supported.")
+ endif()
+ else()
if(NOT "${nasm_helptext}" MATCHES "elf32")
message(FATAL_ERROR
"Unsupported nasm: elf32 object format not supported.")
@@ -183,7 +185,13 @@ function(test_nasm)
message(FATAL_ERROR
"Unsupported nasm: macho64 object format not supported.")
endif()
- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
+ elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}"
+ STREQUAL "Windows")
+ if(NOT "${nasm_helptext}" MATCHES "win64")
+ message(FATAL_ERROR
+ "Unsupported nasm: win64 object format not supported.")
+ endif()
+ else()
if(NOT "${nasm_helptext}" MATCHES "elf64")
message(FATAL_ERROR
"Unsupported nasm: elf64 object format not supported.")

7
multimedia/aom/pkg-descr Normal file
View File

@ -0,0 +1,7 @@
AOMedia Video 1 (AV1), is an open, royalty-free video coding format
designed for video transmissions over the Internet. It is being
developed by the Alliance for Open Media (AOMedia), a consortium of
firms from the semiconductor industry, video on demand providers, and
web browser developers, founded in 2015.
WWW: https://aomedia.org/

14
multimedia/aom/pkg-plist Normal file
View File

@ -0,0 +1,14 @@
bin/aomdec
bin/aomenc
include/aom/aom.h
include/aom/aom_codec.h
include/aom/aom_decoder.h
include/aom/aom_encoder.h
include/aom/aom_frame_buffer.h
include/aom/aom_image.h
include/aom/aom_integer.h
include/aom/aomcx.h
include/aom/aomdx.h
lib/libaom.so
lib/libaom.so.0
libdata/pkgconfig/aom.pc

View File

@ -41,12 +41,6 @@ OPTIONS_DEFAULT= FONTCONFIG FREETYPE FREI0R GMP GNUTLS ICONV \
OPENCV OPTIMIZED_CFLAGS OPUS RTCPU THEORA V4L VAAPI VDPAU \
VORBIS VPX X264 X265 XVID
.if !exists(${.CURDIR:H:H}/multimedia/aom)
# https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/c438899a7064
# https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/43778a501f1b
OPTIONS_EXCLUDE+= AOM
.endif
.if !exists(${.CURDIR:H:H}/net/srt)
# https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/a2fc8dbae853
OPTIONS_EXCLUDE+= SRT