Bug 1493400 - Create build files for dav1d. r=firefox-build-system-reviewers,chmanchester
authorAlex Chronopoulos <achronop@gmail.com>
Sat, 24 Nov 2018 01:53:31 +0000
changeset 504735 5c4bf474ddb3d0f47c493bca5e8a2e9b01ce38e5
parent 504734 94a729d77bc5451e8372c28238f1d3b58856dd6f
child 504736 8b2be3d7ece96e3ea35ea4f7b4a9cf7d3559012e
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, chmanchester
bugs1493400
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1493400 - Create build files for dav1d. r=firefox-build-system-reviewers,chmanchester Differential Revision: https://phabricator.services.mozilla.com/D12163
config/external/moz.build
media/libdav1d/config/aarch64/config.h
media/libdav1d/config/arm/config.h
media/libdav1d/config/x86_32/android/config.h
media/libdav1d/config/x86_32/config.h
media/libdav1d/config/x86_64/config.h
media/libdav1d/config/x86_64/win_asan/config.h
media/libdav1d/dav1d.rc
media/libdav1d/generate_source.py
media/libdav1d/moz.build
media/libdav1d/version.h
--- a/config/external/moz.build
+++ b/config/external/moz.build
@@ -33,16 +33,17 @@ if CONFIG['MOZ_TREMOR']:
 if CONFIG['MOZ_WEBM_ENCODER']:
     external_dirs += ['media/libmkv']
 
 if not CONFIG['MOZ_SYSTEM_LIBVPX']:
     external_dirs += ['media/libvpx']
 
 if CONFIG['MOZ_AV1']:
     external_dirs += ['media/libaom']
+    external_dirs += ['media/libdav1d']
 
 if not CONFIG['MOZ_SYSTEM_PNG']:
     external_dirs += ['media/libpng']
 
 if not CONFIG['MOZ_SYSTEM_WEBP']:
     external_dirs += ['media/libwebp']
 
 if CONFIG['CPU_ARCH'] == 'arm':
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/config/aarch64/config.h
@@ -0,0 +1,29 @@
+/*
+ * Autogenerated by the Meson build system.
+ * Do not edit, your changes will be lost.
+ */
+
+#pragma once
+
+#define ARCH_AARCH64 1
+
+#define ARCH_ARM 0
+
+#define ARCH_X86 0
+
+#define ARCH_X86_32 0
+
+#define ARCH_X86_64 0
+
+#define CONFIG_10BPC 1
+
+#define CONFIG_8BPC 1
+
+#define HAVE_ASM 0
+
+#define HAVE_POSIX_MEMALIGN 1
+
+#define HAVE_UNISTD_H 1
+
+#define STACK_ALIGNMENT 32
+
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/config/arm/config.h
@@ -0,0 +1,29 @@
+/*
+ * Autogenerated by the Meson build system.
+ * Do not edit, your changes will be lost.
+ */
+
+#pragma once
+
+#define ARCH_AARCH64 0
+
+#define ARCH_ARM 1
+
+#define ARCH_X86 0
+
+#define ARCH_X86_32 0
+
+#define ARCH_X86_64 0
+
+#define CONFIG_10BPC 1
+
+#define CONFIG_8BPC 1
+
+#define HAVE_ASM 0
+
+#define HAVE_MEMALIGN 1
+
+#define HAVE_UNISTD_H 1
+
+#define STACK_ALIGNMENT 32
+
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/config/x86_32/android/config.h
@@ -0,0 +1,29 @@
+/*
+ * Autogenerated by the Meson build system.
+ * Do not edit, your changes will be lost.
+ */
+
+#pragma once
+
+#define ARCH_AARCH64 0
+
+#define ARCH_ARM 0
+
+#define ARCH_X86 1
+
+#define ARCH_X86_32 1
+
+#define ARCH_X86_64 0
+
+#define CONFIG_10BPC 1
+
+#define CONFIG_8BPC 1
+
+#define HAVE_ASM 0
+
+#define HAVE_MEMALIGN 1
+
+#define HAVE_UNISTD_H 1
+
+#define STACK_ALIGNMENT 32
+
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/config/x86_32/config.h
@@ -0,0 +1,29 @@
+/*
+ * Autogenerated by the Meson build system.
+ * Do not edit, your changes will be lost.
+ */
+
+#pragma once
+
+#define ARCH_AARCH64 0
+
+#define ARCH_ARM 0
+
+#define ARCH_X86 1
+
+#define ARCH_X86_32 1
+
+#define ARCH_X86_64 0
+
+#define CONFIG_10BPC 1
+
+#define CONFIG_8BPC 1
+
+#define HAVE_ASM 0
+
+#define HAVE_POSIX_MEMALIGN 1
+
+#define HAVE_UNISTD_H 1
+
+#define STACK_ALIGNMENT 32
+
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/config/x86_64/config.h
@@ -0,0 +1,29 @@
+/*
+ * Autogenerated by the Meson build system.
+ * Do not edit, your changes will be lost.
+ */
+
+#pragma once
+
+#define ARCH_AARCH64 0
+
+#define ARCH_ARM 0
+
+#define ARCH_X86 1
+
+#define ARCH_X86_32 0
+
+#define ARCH_X86_64 1
+
+#define CONFIG_10BPC 1
+
+#define CONFIG_8BPC 1
+
+#define HAVE_ASM 0
+
+#define HAVE_POSIX_MEMALIGN 1
+
+#define HAVE_UNISTD_H 1
+
+#define STACK_ALIGNMENT 32
+
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/config/x86_64/win_asan/config.h
@@ -0,0 +1,29 @@
+/*
+ * Autogenerated by the Meson build system.
+ * Do not edit, your changes will be lost.
+ */
+
+#pragma once
+
+#define ARCH_AARCH64 0
+
+#define ARCH_ARM 0
+
+#define ARCH_X86 1
+
+#define ARCH_X86_32 0
+
+#define ARCH_X86_64 1
+
+#define CONFIG_10BPC 1
+
+#define CONFIG_8BPC 1
+
+#define HAVE_ASM 0
+
+#define HAVE_ALIGNED_MALLOC 1
+
+#define HAVE_UNISTD_H 1
+
+#define STACK_ALIGNMENT 32
+
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/dav1d.rc
@@ -0,0 +1,30 @@
+#define VERSION_NUMBER 0,0,1,0
+#define VERSION_NUMBER_STR "0.0.1.0"
+
+#include <windows.h>
+
+1 VERSIONINFO
+FILETYPE VFT_DLL
+FILEOS VOS_NT_WINDOWS32
+PRODUCTVERSION VERSION_NUMBER
+FILEVERSION VERSION_NUMBER
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904E4"
+    BEGIN
+      VALUE "CompanyName", "VideoLAN"
+      VALUE "ProductName", "dav1d"
+      VALUE "ProductVersion", VERSION_NUMBER_STR
+      VALUE "FileVersion", VERSION_NUMBER_STR
+      VALUE "FileDescription", "dav1d AV1 decoder"
+      VALUE "InternalName", "dav1d"
+      VALUE "OriginalFilename", "libdav1d.dll"
+      VALUE "LegalCopyright", "Copyright \251 2018 VideoLAN and dav1d Authors"
+    END
+  END
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x409, 1252
+  END
+END
new file mode 100644
--- /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') as fh:
+        out_file.write(fh.read())
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/moz.build
@@ -0,0 +1,181 @@
+# -*- 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',
+]
+
+if CONFIG['CPU_ARCH'] == 'x86':
+    if CONFIG['OS_TARGET'] == 'Android':
+        LOCAL_INCLUDES += ['/media/libdav1d/config/x86_32/android/']
+        EXPORTS.dav1d += ['config/x86_32/android/config.h']
+    else:
+        LOCAL_INCLUDES += ['/media/libdav1d/config/x86_32/']
+        EXPORTS.dav1d += ['config/x86_32/config.h']
+elif CONFIG['CPU_ARCH'] == 'x86_64':
+    if CONFIG['MOZ_ASAN'] and CONFIG['OS_TARGET'] == 'WINNT':
+        LOCAL_INCLUDES += ['/media/libdav1d/config/x86_64/win_asan/']
+        EXPORTS.dav1d += ['config/x86_64/win_asan/config.h']
+    else:
+        LOCAL_INCLUDES += ['/media/libdav1d/config/x86_64/']
+        EXPORTS.dav1d += ['config/x86_64/config.h']
+elif CONFIG['CPU_ARCH'] == 'arm':
+    LOCAL_INCLUDES += ['/media/libdav1d/config/arm/']
+    EXPORTS.dav1d += ['config/arm/config.h']
+elif CONFIG['CPU_ARCH'] == 'aarch64':
+    LOCAL_INCLUDES += ['/media/libdav1d/config/aarch64/']
+    EXPORTS.dav1d += ['config/aarch64/config.h']
+
+EXPORTS.dav1d += [
+    'version.h',
+]
+
+# entrypoint source files
+SOURCES += [
+    '../../third_party/dav1d/src/lib.c',
+    '../../third_party/dav1d/src/thread_task.c',
+]
+
+# common sources
+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/lf_mask.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/ref_mvs.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',
+]
+
+# 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/getbits.h',
+    '../../third_party/dav1d/src/intra_edge.h',
+    '../../third_party/dav1d/src/lf_mask.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/ref_mvs.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, 10
+relative_path = '../../third_party/dav1d/src/'
+bitdepth_basenames = [
+    'cdef_apply_tmpl.c',
+    'cdef_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 += [
+    '10bd_%s' % p for p in bitdepth_basenames
+]
+
+for f in bitdepth_basenames:
+    a = GENERATED_FILES['10bd_%s' % f]
+    a.script = 'generate_source.py:add_define'
+    a.inputs = [relative_path + f]
+    a.flags = ['BITDEPTH', '10']
+
+GENERATED_FILES += [
+    '8bd_%s' % p for p in bitdepth_basenames
+]
+
+for f in bitdepth_basenames:
+    a = GENERATED_FILES['8bd_%s' % f]
+    a.script = 'generate_source.py:add_define'
+    a.inputs = [relative_path + f]
+    a.flags = ['BITDEPTH', '8']
+
+SOURCES += [
+    '!%s' % p for p in GENERATED_FILES if p.endswith('.c')
+]
+
+EXPORTS.dav1d.src += [
+    '../../third_party/dav1d/src/cdef.h',
+    '../../third_party/dav1d/src/cdef_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/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/mem.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/picture.h',
+]
+
+if CONFIG['OS_TARGET'] == 'WINNT':
+    RCFILE = 'dav1d.rc'
+    SOURCES += [
+        '../../third_party/dav1d/src/win32/thread.c'
+    ]
+
+if CONFIG['CC_TYPE'] == 'msvc':
+    LOCAL_INCLUDES += ['../../third_party/dav1d/include/compat/msvc/']
+    EXPORTS.dav1d += ['../../third_party/dav1d/include/compat/msvc/stdatomic.h']
+
+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()
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/version.h
@@ -0,0 +1,2 @@
+/* auto-generated, do not edit */
+#define DAV1D_VERSION "0.0.1"