2018-11-24 04:53:31 +03:00
|
|
|
# -*- 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',
|
2018-11-30 22:07:07 +03:00
|
|
|
'/third_party/dav1d/src',
|
2018-11-24 04:53:31 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
EXPORTS.dav1d += [
|
2018-12-19 23:05:31 +03:00
|
|
|
'config.h',
|
2018-11-24 04:53:31 +03:00
|
|
|
'version.h',
|
|
|
|
]
|
|
|
|
|
|
|
|
# entrypoint source files
|
2019-03-07 12:32:15 +03:00
|
|
|
entrypoint_source_files = [
|
2018-11-24 04:53:31 +03:00
|
|
|
'../../third_party/dav1d/src/lib.c',
|
|
|
|
'../../third_party/dav1d/src/thread_task.c',
|
|
|
|
]
|
2019-03-07 12:32:15 +03:00
|
|
|
SOURCES += [f for f in entrypoint_source_files]
|
2018-11-24 04:53:31 +03:00
|
|
|
|
2019-01-29 17:19:44 +03:00
|
|
|
# Don't export DAV1D_API symbols from libxul
|
|
|
|
# see: third_party/dav1d/include/dav1d/common.h
|
|
|
|
DEFINES['DAV1D_API'] = ''
|
|
|
|
|
2019-02-06 00:19:07 +03:00
|
|
|
if CONFIG['MOZ_DAV1D_ASM']:
|
2018-12-19 22:18:04 +03:00
|
|
|
DIRS += ['asm']
|
2019-03-22 17:18:27 +03:00
|
|
|
|
2019-03-26 12:45:21 +03:00
|
|
|
# Store the stack alignment that will be used.
|
|
|
|
stack_alignment = 0
|
|
|
|
|
2019-03-22 17:18:27 +03:00
|
|
|
# Default stack alignment can be 4 bytes on x86.
|
|
|
|
if CONFIG['CPU_ARCH'] == 'x86':
|
2019-03-26 12:45:21 +03:00
|
|
|
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']
|
2019-05-08 18:59:15 +03:00
|
|
|
elif CONFIG['CPU_ARCH'] in ('x86_64', 'aarch64'):
|
|
|
|
# The default stack alignment is 16 bytes.
|
2019-03-26 12:45:21 +03:00
|
|
|
stack_alignment = 16
|
2019-03-27 23:46:11 +03:00
|
|
|
else:
|
|
|
|
error('Cpu arch %s is not expected' % CONFIG['CPU_ARCH'])
|
2019-03-22 17:18:27 +03:00
|
|
|
|
2019-03-21 22:43:15 +03:00
|
|
|
# Set the macro here instead of config.h
|
2019-03-26 12:45:21 +03:00
|
|
|
if stack_alignment == 0:
|
|
|
|
error('Stack alignment cannot be zero.')
|
2019-03-21 22:43:15 +03:00
|
|
|
DEFINES['STACK_ALIGNMENT'] = stack_alignment
|
2018-12-19 22:18:04 +03:00
|
|
|
|
2019-03-11 23:00:31 +03:00
|
|
|
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'
|
|
|
|
]
|
|
|
|
|
2018-11-24 04:53:31 +03:00
|
|
|
# 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',
|
2020-03-20 18:17:26 +03:00
|
|
|
'../../third_party/dav1d/src/itx_1d.c',
|
2018-11-24 04:53:31 +03:00
|
|
|
'../../third_party/dav1d/src/lf_mask.c',
|
2019-03-19 20:35:09 +03:00
|
|
|
'../../third_party/dav1d/src/log.c',
|
2018-11-24 04:53:31 +03:00
|
|
|
'../../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',
|
2018-11-30 22:07:07 +03:00
|
|
|
'../../third_party/dav1d/src/film_grain.h',
|
2018-11-24 04:53:31 +03:00
|
|
|
'../../third_party/dav1d/src/getbits.h',
|
|
|
|
'../../third_party/dav1d/src/intra_edge.h',
|
|
|
|
'../../third_party/dav1d/src/lf_mask.h',
|
2019-03-19 20:35:09 +03:00
|
|
|
'../../third_party/dav1d/src/log.h',
|
2018-11-24 04:53:31 +03:00
|
|
|
'../../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',
|
|
|
|
]
|
|
|
|
|
2018-12-19 22:39:07 +03:00
|
|
|
# common BITDEPTH 8, 16
|
2018-11-24 04:53:31 +03:00
|
|
|
relative_path = '../../third_party/dav1d/src/'
|
|
|
|
bitdepth_basenames = [
|
|
|
|
'cdef_apply_tmpl.c',
|
|
|
|
'cdef_tmpl.c',
|
2019-09-23 21:02:33 +03:00
|
|
|
'fg_apply_tmpl.c',
|
2018-11-30 22:07:07 +03:00
|
|
|
'film_grain_tmpl.c',
|
2018-11-24 04:53:31 +03:00
|
|
|
'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'
|
|
|
|
]
|
|
|
|
|
2019-12-18 16:05:39 +03:00
|
|
|
generated_files = []
|
2018-11-24 04:53:31 +03:00
|
|
|
|
|
|
|
for f in bitdepth_basenames:
|
2019-12-18 16:05:39 +03:00
|
|
|
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]
|
2018-11-24 04:53:31 +03:00
|
|
|
|
|
|
|
EXPORTS.dav1d.src += [
|
|
|
|
'../../third_party/dav1d/src/cdef.h',
|
|
|
|
'../../third_party/dav1d/src/cdef_apply.h',
|
2019-09-23 21:02:33 +03:00
|
|
|
'../../third_party/dav1d/src/fg_apply.h',
|
2018-11-24 04:53:31 +03:00
|
|
|
'../../third_party/dav1d/src/ipred.h',
|
|
|
|
'../../third_party/dav1d/src/ipred_prepare.h',
|
|
|
|
'../../third_party/dav1d/src/itx.h',
|
2020-03-20 18:17:26 +03:00
|
|
|
'../../third_party/dav1d/src/itx_1d.h',
|
2018-11-24 04:53:31 +03:00
|
|
|
'../../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',
|
2018-11-30 22:07:07 +03:00
|
|
|
'../../third_party/dav1d/include/dav1d/headers.h',
|
2018-11-24 04:53:31 +03:00
|
|
|
'../../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'] == 'gcc':
|
|
|
|
LOCAL_INCLUDES += ['../../third_party/dav1d/include/compat/gcc/']
|
|
|
|
EXPORTS.dav1d += ['../../third_party/dav1d/include/compat/gcc/stdatomic.h']
|
|
|
|
|
|
|
|
FINAL_LIBRARY = 'gkmedias'
|
|
|
|
|
2018-11-30 06:16:08 +03:00
|
|
|
# We allow warnings for third-party code that can be updated from upstream.
|
|
|
|
AllowCompilerWarnings()
|