diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /media/libdav1d | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'media/libdav1d')
-rw-r--r-- | media/libdav1d/README_MOZILLA | 40 | ||||
-rwxr-xr-x | media/libdav1d/asm/autovendored_sources.mozbuild | 11 | ||||
-rw-r--r-- | media/libdav1d/asm/moz.build | 205 | ||||
-rw-r--r-- | media/libdav1d/asm/x86_32/config.asm | 11 | ||||
-rw-r--r-- | media/libdav1d/asm/x86_32/win/config.asm | 13 | ||||
-rw-r--r-- | media/libdav1d/asm/x86_64/config.asm | 9 | ||||
-rw-r--r-- | media/libdav1d/asm/x86_64/linux/config.asm | 11 | ||||
-rw-r--r-- | media/libdav1d/asm/x86_64/osx/config.asm | 13 | ||||
-rw-r--r-- | media/libdav1d/asm/x86_64/win/config.asm | 11 | ||||
-rwxr-xr-x | media/libdav1d/autovendored_sources.mozbuild | 23 | ||||
-rw-r--r-- | media/libdav1d/config.h | 68 | ||||
-rw-r--r-- | media/libdav1d/generate_source.py | 11 | ||||
-rw-r--r-- | media/libdav1d/moz.build | 191 | ||||
-rw-r--r-- | media/libdav1d/moz.yaml | 58 | ||||
-rwxr-xr-x | media/libdav1d/test/fuzztest/autovendored_sources.mozbuild | 4 | ||||
-rw-r--r-- | media/libdav1d/test/fuzztest/dav1d_fuzz_adapter.cpp | 9 | ||||
-rw-r--r-- | media/libdav1d/test/fuzztest/moz.build | 32 | ||||
-rw-r--r-- | media/libdav1d/vcs_version.h | 2 | ||||
-rw-r--r-- | media/libdav1d/version.h | 34 |
19 files changed, 756 insertions, 0 deletions
diff --git a/media/libdav1d/README_MOZILLA b/media/libdav1d/README_MOZILLA new file mode 100644 index 0000000000..212e629418 --- /dev/null +++ b/media/libdav1d/README_MOZILLA @@ -0,0 +1,40 @@ +This directory contains build files for dav1d. The actual library +source is in $TOPSRCDIR/third_party/dav1d/ + +Any patches or additional configuration to be applied to the +upstream source should be kept here in the media/libdav1d +directory. + +To update the library source and build config files, execute + + ./mach vendor media/libdav1d/moz.yaml + +To update to a specific upstream git tag or commit, use + + ./mach vendor media/libdav1d/moz.yaml -r <commit> + +The upstream git repository is https://code.videolan.org/videolan/dav1d + +To update to a fork, use + + ./mach vendor media/libdav1d/moz.yaml --repo <repository url> [-r <commit>] + + +The rough steps are: +- Execute ./mach vendor media/libdav1d/moz.yaml -r {tag-name} # ex: ./mach vendor media/libdav1d/moz.yaml -r 0.6.0 +- Update ./moz.build and ./asm/moz.build to add new files and remove deleted ones using + third_party/dav1d/src/meson.build as a guide (confirm with the diff) (note the + empty .asm file in x86_64) +- Clone the tag from the dav1d repo and build a stand-alone libdav1d following the steps here: + https://code.videolan.org/videolan/dav1d#compile +- Copy vcs_version.h from the local build/include/vcs_version.h + to media/libdav1d/vcs_version.h +- Copy version.h from local build/include/dav1d/version.h to + media/libdav1d/version.h +- Add new options, if any, in moz.build or config.h + +Tips: +- If you see build failures in build-linux64-base-toolchains (or + similar jobs) dav1d may now require a higher minimum nasm version + than our base toolchains currently support. A bug updating the + minimum nasm version will probably be necessary. diff --git a/media/libdav1d/asm/autovendored_sources.mozbuild b/media/libdav1d/asm/autovendored_sources.mozbuild new file mode 100755 index 0000000000..6ccc0acda6 --- /dev/null +++ b/media/libdav1d/asm/autovendored_sources.mozbuild @@ -0,0 +1,11 @@ +sources = [ +'../../../third_party/dav1d/src/x86/cdef_sse.asm', +'../../../third_party/dav1d/src/x86/cpuid.asm', +'../../../third_party/dav1d/src/x86/film_grain_ssse3.asm', +'../../../third_party/dav1d/src/x86/ipred_ssse3.asm', +'../../../third_party/dav1d/src/x86/itx_ssse3.asm', +'../../../third_party/dav1d/src/x86/loopfilter_ssse3.asm', +'../../../third_party/dav1d/src/x86/looprestoration_ssse3.asm', +'../../../third_party/dav1d/src/x86/mc_sse.asm', +'../../../third_party/dav1d/src/x86/msac.asm', +] diff --git a/media/libdav1d/asm/moz.build b/media/libdav1d/asm/moz.build new file mode 100644 index 0000000000..d742233b27 --- /dev/null +++ b/media/libdav1d/asm/moz.build @@ -0,0 +1,205 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 4 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# ASM enabled + +ASFLAGS += [ + '-I%s/third_party/dav1d/src/' % TOPSRCDIR, + '-DHAVE_AVX512ICL=1', +] + +LOCAL_INCLUDES += [ + '/third_party/dav1d/', + '/third_party/dav1d/include/', + '/third_party/dav1d/src/', +] + +# Don't export DAV1D_API symbols from libxul +# see: third_party/dav1d/include/dav1d/common.h +DEFINES['DAV1D_API'] = '' + +CFLAGS += [ + # find the config.h file. + '-I%s/dist/include/dav1d/' % TOPOBJDIR, +] + +# Store the stack alignment that will be used. +stack_alignment = 0 + +# Attaching config.asm file +if CONFIG['CPU_ARCH'] == 'x86': + # Default stack alignment can be 4 bytes. + if CONFIG['OS_TARGET'] == 'WINNT': + stack_alignment = 4 + ASFLAGS += ['-I%s/media/libdav1d/asm/x86_32/win/' % TOPSRCDIR] + else: + ASFLAGS += ['-I%s/media/libdav1d/asm/x86_32/' % TOPSRCDIR] + stack_alignment = 16 + # Change stack alignment to 16 bytes. + if CONFIG['CC_TYPE'] == 'clang': + CFLAGS += ['-mstack-alignment=16'] + elif CONFIG['CC_TYPE'] == 'gcc': + CFLAGS += ['-mpreferred-stack-boundary=4'] +elif CONFIG['CPU_ARCH'] == 'x86_64': + # Default stack aligment is 16 bytes. + stack_alignment = 16 + if CONFIG['OS_TARGET'] == 'Darwin': + ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/osx/' % TOPSRCDIR] + elif CONFIG['OS_TARGET'] == 'WINNT': + ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/win/' % TOPSRCDIR] + else: + # The rest of the platforms are all Linux-like: plain Linux + # Android, OpenBSD, NetBSD, FreeBSD, DragonFly, SunOS + ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/linux/' % TOPSRCDIR] +elif CONFIG['CPU_ARCH'] == 'aarch64': + stack_alignment = 16 + ASFLAGS += ['-I%s/dist/include/dav1d/' % TOPOBJDIR] +else: + error('Cpu arch %s is not expected' % CONFIG['CPU_ARCH']) + +# Set the macro here instead of config.h +if stack_alignment == 0: + error('Stack alignment cannot be zero.') +DEFINES['STACK_ALIGNMENT'] = stack_alignment + +if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'): + ASFLAGS += ['-Dprivate_prefix=dav1d'] + + SOURCES += [ + '../../../third_party/dav1d/src/x86/cpu.c', + '../../../third_party/dav1d/src/x86/msac_init.c', + ] + + EXPORTS.dav1d += [ + '../../../third_party/dav1d/src/x86/cpu.h', + '../../../third_party/dav1d/src/x86/msac.h', + ] + + # ASM source files + if CONFIG['CPU_ARCH'] == 'x86_64': + # Empty file on all other archs. Nasm produces + # an error when it compiles empty files. + SOURCES += [ + '../../../third_party/dav1d/src/x86/cdef_avx2.asm', + '../../../third_party/dav1d/src/x86/cdef_avx512.asm', + '../../../third_party/dav1d/src/x86/film_grain.asm', + '../../../third_party/dav1d/src/x86/ipred.asm', + '../../../third_party/dav1d/src/x86/itx.asm', + '../../../third_party/dav1d/src/x86/loopfilter.asm', + '../../../third_party/dav1d/src/x86/looprestoration.asm', + '../../../third_party/dav1d/src/x86/mc_avx2.asm', + '../../../third_party/dav1d/src/x86/mc_avx512.asm', + ] + + include('autovendored_sources.mozbuild') + SOURCES += sources + + # BITDEPTH + relative_path = '../../../third_party/dav1d/src/x86/' + bitdepth_basenames = [ + 'cdef_init_tmpl.c', + 'film_grain_init_tmpl.c', + 'ipred_init_tmpl.c', + 'itx_init_tmpl.c', + 'loopfilter_init_tmpl.c', + 'looprestoration_init_tmpl.c', + 'mc_init_tmpl.c', + ] + + + for f in bitdepth_basenames: + SOURCES += [ + '!16bd_%s' % f + ] + GeneratedFile('16bd_%s' % f, script='../generate_source.py', + entry_point='add_define', inputs=[relative_path + f], + flags=['BITDEPTH', '16']) + SOURCES += [ + '!8bd_%s' % f + ] + GeneratedFile('8bd_%s' % f, script='../generate_source.py', + entry_point='add_define', inputs=[relative_path + f], + flags=['BITDEPTH', '8']) + +elif CONFIG['CPU_ARCH'] == 'arm' or CONFIG['CPU_ARCH'] == 'aarch64': + SOURCES += [ + '../../../third_party/dav1d/src/arm/cpu.c', + ] + EXPORTS += [ + '../../../third_party/dav1d/src/arm/cpu.h', + '../../../third_party/dav1d/src/arm/msac.h', + ] + + # BITDEPTH c file + relative_path = '../../../third_party/dav1d/src/arm/' + bitdepth_basenames = [ + 'cdef_init_tmpl.c', + 'ipred_init_tmpl.c', + 'itx_init_tmpl.c', + 'loopfilter_init_tmpl.c', + 'looprestoration_init_tmpl.c', + 'mc_init_tmpl.c', + ] + + for f in bitdepth_basenames: + SOURCES += [ + '!16bd_%s' % f + ] + GeneratedFile('16bd_%s' % f, script='../generate_source.py', + entry_point='add_define', inputs=[relative_path + f], + flags=['BITDEPTH', '16']) + SOURCES += [ + '!8bd_%s' % f + ] + GeneratedFile('8bd_%s' % f, script='../generate_source.py', + entry_point='add_define', inputs=[relative_path + f], + flags=['BITDEPTH', '8']) + + # BITDEPTH .S files + if CONFIG['CPU_ARCH'] == 'aarch64': + SOURCES += [ + '../../../third_party/dav1d/src/arm/64/cdef.S', + '../../../third_party/dav1d/src/arm/64/cdef16.S', + '../../../third_party/dav1d/src/arm/64/cdef_tmpl.S', + '../../../third_party/dav1d/src/arm/64/ipred.S', + '../../../third_party/dav1d/src/arm/64/ipred16.S', + # itx.S is used for both 8 and 16 bpc. + '../../../third_party/dav1d/src/arm/64/itx.S', + '../../../third_party/dav1d/src/arm/64/itx16.S', + '../../../third_party/dav1d/src/arm/64/loopfilter.S', + '../../../third_party/dav1d/src/arm/64/loopfilter16.S', + '../../../third_party/dav1d/src/arm/64/looprestoration.S', + '../../../third_party/dav1d/src/arm/64/looprestoration16.S', + '../../../third_party/dav1d/src/arm/64/looprestoration_common.S', + '../../../third_party/dav1d/src/arm/64/looprestoration_tmpl.S', + '../../../third_party/dav1d/src/arm/64/mc.S', + '../../../third_party/dav1d/src/arm/64/mc16.S', + '../../../third_party/dav1d/src/arm/64/msac.S', + ] + elif CONFIG['CPU_ARCH'] == 'arm': + SOURCES += [ + '../../../third_party/dav1d/src/arm/32/cdef.S', + '../../../third_party/dav1d/src/arm/32/cdef16.S', + '../../../third_party/dav1d/src/arm/32/cdef_tmpl.S', + '../../../third_party/dav1d/src/arm/32/ipred.S', + '../../../third_party/dav1d/src/arm/32/itx.S', + '../../../third_party/dav1d/src/arm/32/loopfilter.S', + '../../../third_party/dav1d/src/arm/32/looprestoration.S', + '../../../third_party/dav1d/src/arm/32/looprestoration16.S', + '../../../third_party/dav1d/src/arm/32/mc.S', + '../../../third_party/dav1d/src/arm/32/mc16.S', + '../../../third_party/dav1d/src/arm/32/msac.S', + ] + +if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'): + USE_NASM = True +elif CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['OS_TARGET'] == 'WINNT': + USE_INTEGRATED_CLANGCL_AS = True + +FINAL_LIBRARY = 'gkmedias' + +# We allow warnings for third-party code that can be updated from upstream. +AllowCompilerWarnings() diff --git a/media/libdav1d/asm/x86_32/config.asm b/media/libdav1d/asm/x86_32/config.asm new file mode 100644 index 0000000000..16624aa533 --- /dev/null +++ b/media/libdav1d/asm/x86_32/config.asm @@ -0,0 +1,11 @@ +; Autogenerated by the Meson build system. +; Do not edit, your changes will be lost. + +%define ARCH_X86_32 1 + +%define ARCH_X86_64 0 + +%define PIC 1 + +%define STACK_ALIGNMENT 16 + diff --git a/media/libdav1d/asm/x86_32/win/config.asm b/media/libdav1d/asm/x86_32/win/config.asm new file mode 100644 index 0000000000..f701a081aa --- /dev/null +++ b/media/libdav1d/asm/x86_32/win/config.asm @@ -0,0 +1,13 @@ +; Autogenerated by the Meson build system. +; Do not edit, your changes will be lost. + +%define ARCH_X86_32 1 + +%define ARCH_X86_64 0 + +%define PIC 1 + +%define PREFIX 1 + +%define STACK_ALIGNMENT 4 + diff --git a/media/libdav1d/asm/x86_64/config.asm b/media/libdav1d/asm/x86_64/config.asm new file mode 100644 index 0000000000..26c26f785c --- /dev/null +++ b/media/libdav1d/asm/x86_64/config.asm @@ -0,0 +1,9 @@ +; Autogenerated by the Meson build system. +; Do not edit, your changes will be lost. + +%define ARCH_X86_32 0 + +%define ARCH_X86_64 1 + +%define STACK_ALIGNMENT 32 + diff --git a/media/libdav1d/asm/x86_64/linux/config.asm b/media/libdav1d/asm/x86_64/linux/config.asm new file mode 100644 index 0000000000..8fc2739276 --- /dev/null +++ b/media/libdav1d/asm/x86_64/linux/config.asm @@ -0,0 +1,11 @@ +; Autogenerated by the Meson build system. +; Do not edit, your changes will be lost. + +%define ARCH_X86_32 0 + +%define ARCH_X86_64 1 + +%define PIC 1 + +%define STACK_ALIGNMENT 16 + diff --git a/media/libdav1d/asm/x86_64/osx/config.asm b/media/libdav1d/asm/x86_64/osx/config.asm new file mode 100644 index 0000000000..d1ad0b196e --- /dev/null +++ b/media/libdav1d/asm/x86_64/osx/config.asm @@ -0,0 +1,13 @@ +; Autogenerated by the Meson build system. +; Do not edit, your changes will be lost. + +%define ARCH_X86_32 0 + +%define ARCH_X86_64 1 + +%define PIC 1 + +%define PREFIX 1 + +%define STACK_ALIGNMENT 16 + diff --git a/media/libdav1d/asm/x86_64/win/config.asm b/media/libdav1d/asm/x86_64/win/config.asm new file mode 100644 index 0000000000..8fc2739276 --- /dev/null +++ b/media/libdav1d/asm/x86_64/win/config.asm @@ -0,0 +1,11 @@ +; Autogenerated by the Meson build system. +; Do not edit, your changes will be lost. + +%define ARCH_X86_32 0 + +%define ARCH_X86_64 1 + +%define PIC 1 + +%define STACK_ALIGNMENT 16 + diff --git a/media/libdav1d/autovendored_sources.mozbuild b/media/libdav1d/autovendored_sources.mozbuild new file mode 100755 index 0000000000..709ebd88d5 --- /dev/null +++ b/media/libdav1d/autovendored_sources.mozbuild @@ -0,0 +1,23 @@ +sources = [ + '../../third_party/dav1d/src/cdf.c', + '../../third_party/dav1d/src/cpu.c', + '../../third_party/dav1d/src/data.c', + '../../third_party/dav1d/src/decode.c', + '../../third_party/dav1d/src/dequant_tables.c', + '../../third_party/dav1d/src/getbits.c', + '../../third_party/dav1d/src/intra_edge.c', + '../../third_party/dav1d/src/itx_1d.c', + '../../third_party/dav1d/src/lf_mask.c', + '../../third_party/dav1d/src/log.c', + '../../third_party/dav1d/src/mem.c', + '../../third_party/dav1d/src/msac.c', + '../../third_party/dav1d/src/obu.c', + '../../third_party/dav1d/src/picture.c', + '../../third_party/dav1d/src/qm.c', + '../../third_party/dav1d/src/ref.c', + '../../third_party/dav1d/src/refmvs.c', + '../../third_party/dav1d/src/scan.c', + '../../third_party/dav1d/src/tables.c', + '../../third_party/dav1d/src/warpmv.c', + '../../third_party/dav1d/src/wedge.c', +] diff --git a/media/libdav1d/config.h b/media/libdav1d/config.h new file mode 100644 index 0000000000..218c8ae7f4 --- /dev/null +++ b/media/libdav1d/config.h @@ -0,0 +1,68 @@ +#pragma once + +// Set platform +#if defined(__aarch64__) || defined(_M_ARM64) +# define ARCH_AARCH64 1 +#else +# define ARCH_AARCH64 0 +#endif + +#if defined(__arm__) || defined(_M_ARM) +# define ARCH_ARM 1 +#else +# define ARCH_ARM 0 +#endif + +#if defined(__i386__) || defined(_M_IX86) +# define ARCH_X86_32 1 +#else +# define ARCH_X86_32 0 +#endif + +#if defined(__x86_64__) || defined(_M_X64) +# define ARCH_X86_64 1 +#else +# define ARCH_X86_64 0 +#endif + +#if ARCH_X86_32 == 1 || ARCH_X86_64 == 1 +# define ARCH_X86 1 +#else +# define ARCH_X86 0 +#endif + +// Set both bitdepeth in every case +#define CONFIG_16BPC 1 +#define CONFIG_8BPC 1 + +// Enable asm +#if defined(MOZ_DAV1D_ASM) +# define HAVE_ASM 1 +#else +# define HAVE_ASM 0 +#endif + +#if ARCH_AARCH64 == 1 +// Those values are copied from the auto generated +// config file produced by stand alone dav1d build. +# define HAVE_AS_FUNC 0 +# define HAVE_GETAUXVAL 1 +# define PIC 3 +#endif + +// The following macros are defined from autoconf +// according to the system configuration. +// (HAVE_MEMALIGN | HAVE_ALIGNED_MALLOC | HAVE_POSIX_MEMALIGN) +// HAVE_UNISTD_H + +// Important when asm is enabled +#if defined(__APPLE__) || (ARCH_x86_32 == 1 && defined(_WIN32)) +# define PREFIX 1 +#endif + +#if defined(_WIN32) || defined(__CYGWIN__) +// _WIN32_WINNT 0x0601 is set in global macros +# define UNICODE 1 +# define _UNICODE 1 +# define __USE_MINGW_ANSI_STDIO 1 +#endif diff --git a/media/libdav1d/generate_source.py b/media/libdav1d/generate_source.py new file mode 100644 index 0000000000..4c2dad0dae --- /dev/null +++ b/media/libdav1d/generate_source.py @@ -0,0 +1,11 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +def add_define(out_file, in_path, expr, num = ''): + out_file.write('#define %s %s\n' % (expr, num)) + with open(in_path, 'r', encoding='utf-8') as fh: + out_file.write(fh.read()) diff --git a/media/libdav1d/moz.build b/media/libdav1d/moz.build new file mode 100644 index 0000000000..e8c24260a2 --- /dev/null +++ b/media/libdav1d/moz.build @@ -0,0 +1,191 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Library('dav1d') + +LOCAL_INCLUDES += [ + '/third_party/dav1d', + '/third_party/dav1d/include', + '/third_party/dav1d/include/dav1d', + '/third_party/dav1d/src', +] + +EXPORTS.dav1d += [ + 'config.h', + 'version.h', +] + +# entrypoint source files +entrypoint_source_files = [ + '../../third_party/dav1d/src/lib.c', + '../../third_party/dav1d/src/thread_task.c', +] +SOURCES += [f for f in entrypoint_source_files] + +# Don't export DAV1D_API symbols from libxul +# see: third_party/dav1d/include/dav1d/common.h +DEFINES['DAV1D_API'] = '' + +if CONFIG['MOZ_DAV1D_ASM']: + DIRS += ['asm'] + + # Store the stack alignment that will be used. + stack_alignment = 0 + + # Default stack alignment can be 4 bytes on x86. + if CONFIG['CPU_ARCH'] == 'x86': + if CONFIG['OS_TARGET'] == 'WINNT': + # Allow the default to avoid crashes + stack_alignment = 4 + else: + # Update stack alignment to 16 bytes. + stack_alignment = 16 + if CONFIG['CC_TYPE'] == 'clang': + CFLAGS += ['-mstack-alignment=16'] + for ep in entrypoint_source_files: + SOURCES[ep].flags += ['-mstackrealign'] + elif CONFIG['CC_TYPE'] == 'gcc': + CFLAGS += ['-mpreferred-stack-boundary=4'] + for ep in entrypoint_source_files: + SOURCES[ep].flags += ['-mincoming-stack-boundary=2'] + elif CONFIG['CPU_ARCH'] in ('x86_64', 'aarch64'): + # The default stack alignment is 16 bytes. + stack_alignment = 16 + else: + error('Cpu arch %s is not expected' % CONFIG['CPU_ARCH']) + + # Set the macro here instead of config.h + if stack_alignment == 0: + error('Stack alignment cannot be zero.') + DEFINES['STACK_ALIGNMENT'] = stack_alignment + +if CONFIG['OS_TARGET'] == 'Linux': + # For fuzzing, We only support building on Linux currently. + include('/tools/fuzzing/libfuzzer-config.mozbuild') + if CONFIG['FUZZING_INTERFACES']: + TEST_DIRS += [ + 'test/fuzztest' + ] + +# common sources +include('autovendored_sources.mozbuild') +SOURCES += sources + +# includes src +EXPORTS.dav1d.src += [ + '../../third_party/dav1d/src/cdf.h', + '../../third_party/dav1d/src/cpu.h', + '../../third_party/dav1d/src/ctx.h', + '../../third_party/dav1d/src/data.h', + '../../third_party/dav1d/src/decode.h', + '../../third_party/dav1d/src/dequant_tables.h', + '../../third_party/dav1d/src/film_grain.h', + '../../third_party/dav1d/src/getbits.h', + '../../third_party/dav1d/src/intra_edge.h', + '../../third_party/dav1d/src/lf_mask.h', + '../../third_party/dav1d/src/log.h', + '../../third_party/dav1d/src/mem.h', + '../../third_party/dav1d/src/msac.h', + '../../third_party/dav1d/src/obu.h', + '../../third_party/dav1d/src/picture.h', + '../../third_party/dav1d/src/qm.h', + '../../third_party/dav1d/src/ref.h', + '../../third_party/dav1d/src/refmvs.h', + '../../third_party/dav1d/src/scan.h', + '../../third_party/dav1d/src/tables.h', + '../../third_party/dav1d/src/thread.h', + '../../third_party/dav1d/src/warpmv.h', + '../../third_party/dav1d/src/wedge.h', +] + +# common BITDEPTH 8, 16 +relative_path = '../../third_party/dav1d/src/' +bitdepth_basenames = [ + 'cdef_apply_tmpl.c', + 'cdef_tmpl.c', + 'fg_apply_tmpl.c', + 'film_grain_tmpl.c', + 'ipred_prepare_tmpl.c', + 'ipred_tmpl.c', + 'itx_tmpl.c', + 'lf_apply_tmpl.c', + 'loopfilter_tmpl.c', + 'looprestoration_tmpl.c', + 'lr_apply_tmpl.c', + 'mc_tmpl.c', + 'recon_tmpl.c' +] + +generated_files = [] + +for f in bitdepth_basenames: + file_bd16 = '16bd_%s' % f + file_bd8 = '8bd_%s' % f + + GeneratedFile(file_bd16, + script='generate_source.py', + entry_point='add_define', + inputs=[relative_path + f], + flags=['BITDEPTH', '16']) + GeneratedFile(file_bd8, + script='generate_source.py', + entry_point='add_define', + inputs=[relative_path + f], + flags=['BITDEPTH', '8']) + + generated_files += [file_bd16, file_bd8] + +for p in generated_files: + if p.endswith('.c'): + SOURCES += ['!%s' % p] + +EXPORTS.dav1d.src += [ + '../../third_party/dav1d/src/cdef.h', + '../../third_party/dav1d/src/cdef_apply.h', + '../../third_party/dav1d/src/fg_apply.h', + '../../third_party/dav1d/src/ipred.h', + '../../third_party/dav1d/src/ipred_prepare.h', + '../../third_party/dav1d/src/itx.h', + '../../third_party/dav1d/src/itx_1d.h', + '../../third_party/dav1d/src/lf_apply.h', + '../../third_party/dav1d/src/loopfilter.h', + '../../third_party/dav1d/src/looprestoration.h', + '../../third_party/dav1d/src/lr_apply.h', + '../../third_party/dav1d/src/mc.h', + '../../third_party/dav1d/src/recon.h', +] + +# include/common +EXPORTS.dav1d += [ + '../../third_party/dav1d/include/common/attributes.h', + '../../third_party/dav1d/include/common/bitdepth.h', + '../../third_party/dav1d/include/common/dump.h', + '../../third_party/dav1d/include/common/intops.h', + '../../third_party/dav1d/include/common/validate.h', +] + +# include/dav1d +EXPORTS.dav1d += [ + '../../third_party/dav1d/include/dav1d/common.h', + '../../third_party/dav1d/include/dav1d/data.h', + '../../third_party/dav1d/include/dav1d/dav1d.h', + '../../third_party/dav1d/include/dav1d/headers.h', + '../../third_party/dav1d/include/dav1d/picture.h', +] + +if CONFIG['OS_TARGET'] == 'WINNT': + SOURCES += [ + '../../third_party/dav1d/src/win32/thread.c' + ] + +if CONFIG['CC_TYPE'] == 'gcc': + LOCAL_INCLUDES += ['../../third_party/dav1d/include/compat/gcc/'] + EXPORTS.dav1d += ['../../third_party/dav1d/include/compat/gcc/stdatomic.h'] + +FINAL_LIBRARY = 'gkmedias' + +# We allow warnings for third-party code that can be updated from upstream. +AllowCompilerWarnings() diff --git a/media/libdav1d/moz.yaml b/media/libdav1d/moz.yaml new file mode 100644 index 0000000000..765068caa2 --- /dev/null +++ b/media/libdav1d/moz.yaml @@ -0,0 +1,58 @@ +# Version of this schema +schema: 1 + +bugzilla: + # Bugzilla product and component for this directory and subdirectories + product: Core + component: "Audio/Video: Playback" + +# Document the source of externally hosted code +origin: + + # Short name of the package/library + name: dav1d + + description: dav1d, a fast AV1 decoder + + # Full URL for the package's homepage/etc + # Usually different from repository url + url: https://code.videolan.org/videolan/dav1d + + # Human-readable identifier for this version/release + # Generally "version NNN", "tag SSS", "bookmark SSS" + release: commit 2ca1bfc39fe5c182d885f2750779d5b1678d8ef9 (2020-11-23T21:17:09.000+01:00). + + # Revision to pull in + # Must be a long or short commit SHA (long preferred) + revision: 2ca1bfc39fe5c182d885f2750779d5b1678d8ef9 + + # The package's license, where possible using the mnemonic from + # https://spdx.org/licenses/ + # Multiple licenses can be specified (as a YAML list) + # A "LICENSE" file must exist containing the full license text + license: BSD-2-Clause + + license-file: COPYING + +updatebot: + enabled: True + maintainer-phab: tjr + maintainer-bz: tom@mozilla.com + +vendoring: + url: https://code.videolan.org/videolan/dav1d.git + source-hosting: gitlab + vendor-directory: third_party/dav1d + + exclude: + - build/.gitattributes + - build/.gitignore + + update-actions: + - action: copy-file + from: include/vcs_version.h.in + to: '{yaml_dir}/vcs_version.h' + - action: replace-in-file + pattern: '@VCS_TAG@' + with: '{revision}' + file: '{yaml_dir}/vcs_version.h' diff --git a/media/libdav1d/test/fuzztest/autovendored_sources.mozbuild b/media/libdav1d/test/fuzztest/autovendored_sources.mozbuild new file mode 100755 index 0000000000..a7b9c17d6c --- /dev/null +++ b/media/libdav1d/test/fuzztest/autovendored_sources.mozbuild @@ -0,0 +1,4 @@ +sources = [ +'/third_party/dav1d/tests/libfuzzer/dav1d_fuzzer.c', +'dav1d_fuzz_adapter.cpp', +] diff --git a/media/libdav1d/test/fuzztest/dav1d_fuzz_adapter.cpp b/media/libdav1d/test/fuzztest/dav1d_fuzz_adapter.cpp new file mode 100644 index 0000000000..4a038344a8 --- /dev/null +++ b/media/libdav1d/test/fuzztest/dav1d_fuzz_adapter.cpp @@ -0,0 +1,9 @@ + +#include "FuzzingInterface.h" + +namespace dav1dfuzz { +#include "tests/libfuzzer/dav1d_fuzzer.c" +} + +MOZ_FUZZING_INTERFACE_RAW(nullptr, dav1dfuzz::LLVMFuzzerTestOneInput, + Dav1dDecode); diff --git a/media/libdav1d/test/fuzztest/moz.build b/media/libdav1d/test/fuzztest/moz.build new file mode 100644 index 0000000000..f4fe9e694e --- /dev/null +++ b/media/libdav1d/test/fuzztest/moz.build @@ -0,0 +1,32 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Library('FuzzingDav1d') + +LOCAL_INCLUDES += [ + '/media/libdav1d', + '/third_party/dav1d', + '/third_party/dav1d/include', + '/third_party/dav1d/tests/libfuzzer/', +] + +# We currently only support building on Linux for fuzzing here, as guarded +# in media/libaom/moz.build. More support can be added later if necessary. +if CONFIG['CPU_ARCH'] == 'x86_64': + LOCAL_INCLUDES += [ + '/media/libdav1d/asm/x86_64/', + ] +elif CONFIG['CPU_ARCH'] == 'x86': + LOCAL_INCLUDES += [ + '/media/libdav1d/asm/x86_32/', + ] + +include('autovendored_sources.mozbuild') +SOURCES += sources + +include('/tools/fuzzing/libfuzzer-config.mozbuild') + +FINAL_LIBRARY = 'xul-gtest' diff --git a/media/libdav1d/vcs_version.h b/media/libdav1d/vcs_version.h new file mode 100644 index 0000000000..fa11e44c4e --- /dev/null +++ b/media/libdav1d/vcs_version.h @@ -0,0 +1,2 @@ +/* auto-generated, do not edit */ +#define DAV1D_VERSION "0.8.0-0-g2ca1bfc" diff --git a/media/libdav1d/version.h b/media/libdav1d/version.h new file mode 100644 index 0000000000..cf6ca7b36f --- /dev/null +++ b/media/libdav1d/version.h @@ -0,0 +1,34 @@ +/* + * Copyright © 2019, VideoLAN and dav1d authors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DAV1D_VERSION_H +#define DAV1D_VERSION_H + +#define DAV1D_API_VERSION_MAJOR 5 +#define DAV1D_API_VERSION_MINOR 0 +#define DAV1D_API_VERSION_PATCH 0 + +#endif /* DAV1D_VERSION_H */ |