media/libopus/moz.build
author Ralph Giles <giles@mozilla.com>
Tue, 19 Jul 2016 18:06:20 -0400
changeset 345954 2bf27d83f47943d10f2f22e332a4af5793cd3f5a
parent 326441 36b8d3c16c1776711703f1498902402b0bacf828
child 346136 3ec6380fca8207fa199693206a3ca24975bf9833
permissions -rw-r--r--
Bug 1288091 - Update to libopus 1.1.3. r=jmspeex New upstream release. This is a minor release focusing mainly on optimizations and bug fixes. - Neon optimizations inproving performance on ARMv7 and ARMv8 by up to 15% - Fixes some issues with 16-bit platforms (e.g. TI C55x) - Fixes to comfort noise generation (CNG) - Documenting that PLC packets can also be 2 bytes - Includes experimental ambisonics work (--enable-ambisonics) MozReview-Commit-ID: IcdnCok500X

# -*- Mode: python; c-basic-offset: 4; 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/.

with Files('*'):
    BUG_COMPONENT = ('Core', 'Video/Audio')

EXPORTS.opus += [
    'include/opus.h',
    'include/opus_defines.h',
    'include/opus_multistream.h',
    'include/opus_types.h',
]

# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

FINAL_LIBRARY = 'gkmedias'

DEFINES['OPUS_BUILD'] = True
DEFINES['OPUS_VERSION'] = '"v1.1.3-mozilla"'
DEFINES['USE_ALLOCA'] = True

# Don't export symbols
DEFINES['OPUS_EXPORT'] = ''

if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
    DEFINES['OPUS_ARM_ASM'] = True
    DEFINES['OPUS_ARM_EXTERNAL_ASM'] = True
    DEFINES['OPUS_ARM_INLINE_ASM'] = True
    if int(CONFIG['ARM_ARCH']) >= 6:
        DEFINES['OPUS_ARM_INLINE_EDSP'] = True
        DEFINES['OPUS_ARM_MAY_HAVE_EDSP'] = True
        DEFINES['OPUS_ARM_MAY_HAVE_MEDIA'] = True
        DEFINES['OPUS_ARM_MAY_HAVE_NEON'] = True

if CONFIG['MOZ_DEBUG']:
    DEFINES['ENABLE_ASSERTIONS'] = True

if CONFIG['OS_ARCH'] in ('Linux', 'Darwin', 'DragonFly', 'FreeBSD',
                         'NetBSD', 'OpenBSD'):
    DEFINES['HAVE_LRINTF'] = True

if CONFIG['OS_ARCH'] == 'WINNT':
    DEFINES['inline'] = '__inline'
    if CONFIG['GNU_CC']:
        DEFINES['HAVE_LRINTF'] = True

if CONFIG['OS_ARCH'] == 'AIX':
    DEFINES['alloca'] = '__alloca'

if CONFIG['OS_ARCH'] == 'SunOS':
    DEFINES['HAVE_ALLOCA_H'] = True

if not CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
    DEFINES['FIXED_POINT'] = 1
    DEFINES['DISABLE_FLOAT_API'] = True

LOCAL_INCLUDES += [
    'celt',
    'include',
    'silk',
    'src',
]

# sources.mozbuild is generated from gen-sources.py when a new libopus is
# imported.
include('sources.mozbuild')

UNIFIED_SOURCES += celt_sources
UNIFIED_SOURCES += silk_sources
UNIFIED_SOURCES += opus_sources
SOURCES += opus_nonunified_sources

if CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
    LOCAL_INCLUDES += [
        'silk/float',
    ]
    UNIFIED_SOURCES += silk_sources_float
    UNIFIED_SOURCES += opus_sources_float
else:
    LOCAL_INCLUDES += [
        'silk/fixed',
    ]
    UNIFIED_SOURCES += silk_sources_fixed
# for webrtc
    UNIFIED_SOURCES += opus_sources_float

if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
    SOURCES += celt_sources_arm
    SOURCES += [
        '!celt_pitch_xcorr_arm-gnu.s'
    ]
    # -Os is significantly slower, enable -O3 unless optimization is disabled
    if CONFIG['MOZ_OPTIMIZE']:
        CFLAGS += [
            '-O3',
        ]
        CXXFLAGS += [
            '-O3',
        ]
    # These flags are a lie; they're just used to enable the requisite
    # opcodes; actual arch detection is done at runtime.
    ASFLAGS += [
        '-march=armv7-a',
        '-mfpu=neon',
    ]

# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
    if CONFIG['CLANG_CXX']:
        CFLAGS += ['-Wno-#pragma-messages']