Add build files to support libwebp decoding.

This commit is contained in:
wolfbeast 2017-07-24 13:20:46 +02:00 committed by Roy Tam
commit 85b4e45fa7
10 changed files with 292 additions and 0 deletions

View file

@ -36,6 +36,8 @@ if not CONFIG['MOZ_SYSTEM_LIBVPX']:
if not CONFIG['MOZ_SYSTEM_PNG']:
external_dirs += ['media/libpng']
external_dirs += ['media/libwebp']
if CONFIG['CPU_ARCH'] == 'arm':
external_dirs += ['media/openmax_dl']

3
media/libwebp/MOZCHANGES Normal file
View file

@ -0,0 +1,3 @@
Changes made to pristine libwebp source by mozilla.org developers.
2017/01/27 -- Synced with libwebp-0.6.0 (bug #1294490).

View file

@ -0,0 +1,26 @@
# -*- 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'ImageLib')
SOURCES += [
'alpha_dec.c',
'buffer_dec.c',
'frame_dec.c',
'idec_dec.c',
'io_dec.c',
'quant_dec.c',
'tree_dec.c',
'vp8_dec.c',
'vp8l_dec.c',
'webp_dec.c',
]
FINAL_LIBRARY = 'gkmedias'
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

View file

@ -0,0 +1,17 @@
# -*- 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'ImageLib')
SOURCES += [
'demux.c',
]
FINAL_LIBRARY = 'gkmedias'
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

View file

@ -0,0 +1,53 @@
# -*- 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'ImageLib')
SOURCES += [
'alpha_processing.c',
'alpha_processing_sse2.c',
'alpha_processing_sse41.c',
'dec.c',
'dec_clip_tables.c',
'dec_neon.c',
'dec_sse2.c',
'dec_sse41.c',
'filters.c',
'filters_sse2.c',
'lossless.c',
'lossless_neon.c',
'lossless_sse2.c',
'rescaler.c',
'rescaler_neon.c',
'rescaler_sse2.c',
'upsampling.c',
'upsampling_neon.c',
'upsampling_sse2.c',
'yuv.c',
'yuv_sse2.c',
]
if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['BUILD_ARM_NEON']:
SOURCES['dec_neon.c'].flags += CONFIG['NEON_FLAGS']
SOURCES['lossless_neon.c'].flags += CONFIG['NEON_FLAGS']
SOURCES['rescaler_neon.c'].flags += CONFIG['NEON_FLAGS']
SOURCES['upsampling_neon.c'].flags += CONFIG['NEON_FLAGS']
elif CONFIG['INTEL_ARCHITECTURE']:
SOURCES['alpha_processing_sse2.c'].flags += CONFIG['SSE2_FLAGS']
SOURCES['alpha_processing_sse41.c'].flags += CONFIG['SSE2_FLAGS']
SOURCES['dec_sse2.c'].flags += CONFIG['SSE2_FLAGS']
SOURCES['dec_sse41.c'].flags += CONFIG['SSE2_FLAGS']
SOURCES['filters_sse2.c'].flags += CONFIG['SSE2_FLAGS']
SOURCES['lossless_sse2.c'].flags += CONFIG['SSE2_FLAGS']
SOURCES['rescaler_sse2.c'].flags += CONFIG['SSE2_FLAGS']
SOURCES['upsampling_sse2.c'].flags += CONFIG['SSE2_FLAGS']
SOURCES['yuv_sse2.c'].flags += CONFIG['SSE2_FLAGS']
FINAL_LIBRARY = 'gkmedias'
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

28
media/libwebp/moz.build Normal file
View file

@ -0,0 +1,28 @@
# -*- 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'ImageLib')
EXPORTS.webp += [
'webp/decode.h',
'webp/demux.h',
'webp/mux_types.h',
'webp/types.h',
]
DIRS += [
'dec',
'demux',
'dsp',
'moz',
'utils',
]
FINAL_LIBRARY = 'gkmedias'
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

44
media/libwebp/moz/cpu.cpp Normal file
View file

@ -0,0 +1,44 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* 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/. */
/* This file replaces the CPU info methods originally implemented in
* src/dsp/cpu.c, due to missing dependencies for Andriod builds. It
* controls if NEON/SSE/etc is used. */
#include "../dsp/dsp.h"
#include "mozilla/arm.h"
#include "mozilla/SSE.h"
static int MozCPUInfo(CPUFeature feature)
{
switch (feature) {
#if defined(__i386__) || defined(__x86_64__) || defined(WEBP_MSC_SSE2)
case kSSE2:
return mozilla::supports_sse2();
case kSSE3:
return mozilla::supports_sse3();
case kSSE4_1:
return mozilla::supports_sse4_1();
case kAVX:
return mozilla::supports_avx();
case kAVX2:
return mozilla::supports_avx2();
#endif
#if defined(WEBP_USE_NEON) || defined(WEBP_ANDROID_NEON)
case kNEON:
return mozilla::supports_neon();
#endif
#if defined(WEBP_USE_MIPS32) || defined(WEBP_USE_MIPS_DSP_R2) || defined(WEBP_USE_MSA)
case kMIPS32:
case kMIPSdspR2:
case kMSA:
return 1;
#endif
default:
return 0;
}
}
VP8CPUInfo VP8GetCPUInfo = MozCPUInfo;

View file

@ -0,0 +1,17 @@
# -*- 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'ImageLib')
SOURCES += [
'cpu.cpp',
]
FINAL_LIBRARY = 'gkmedias'
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

76
media/libwebp/update.sh Normal file
View file

@ -0,0 +1,76 @@
#!/bin/sh
# 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/.
#
# Usage: ./update.sh <libwebp_directory>
#
# Copies the needed files from a directory containing the original
# libwebp source.
cp $1/AUTHORS .
cp $1/COPYING .
cp $1/NEWS .
cp $1/PATENTS .
cp $1/README .
cp $1/README.mux .
mkdir -p webp
cp $1/src/webp/*.h webp
mkdir -p dec
cp $1/src/dec/*.h dec
cp $1/src/dec/alpha_dec.c dec
cp $1/src/dec/buffer_dec.c dec
cp $1/src/dec/frame_dec.c dec
cp $1/src/dec/idec_dec.c dec
cp $1/src/dec/io_dec.c dec
cp $1/src/dec/quant_dec.c dec
cp $1/src/dec/tree_dec.c dec
cp $1/src/dec/vp8_dec.c dec
cp $1/src/dec/vp8l_dec.c dec
cp $1/src/dec/webp_dec.c dec
mkdir -p demux
cp $1/src/demux/demux.c demux
mkdir -p dsp
cp $1/src/dsp/*.h dsp
cp $1/src/dsp/alpha_processing.c dsp
cp $1/src/dsp/alpha_processing_sse2.c dsp
cp $1/src/dsp/alpha_processing_sse41.c dsp
cp $1/src/dsp/dec.c dsp
cp $1/src/dsp/dec_clip_tables.c dsp
cp $1/src/dsp/dec_neon.c dsp
cp $1/src/dsp/dec_sse2.c dsp
cp $1/src/dsp/dec_sse41.c dsp
cp $1/src/dsp/filters.c dsp
cp $1/src/dsp/filters_sse2.c dsp
cp $1/src/dsp/lossless.c dsp
cp $1/src/dsp/lossless_neon.c dsp
cp $1/src/dsp/lossless_sse2.c dsp
cp $1/src/dsp/rescaler.c dsp
cp $1/src/dsp/rescaler_neon.c dsp
cp $1/src/dsp/rescaler_sse2.c dsp
cp $1/src/dsp/upsampling.c dsp
cp $1/src/dsp/upsampling_neon.c dsp
cp $1/src/dsp/upsampling_sse2.c dsp
cp $1/src/dsp/yuv.c dsp
cp $1/src/dsp/yuv_sse2.c dsp
mkdir -p enc
cp $1/src/enc/*.h enc
mkdir -p utils
cp $1/src/utils/*.h utils
cp $1/src/utils/bit_reader_utils.c utils
cp $1/src/utils/color_cache_utils.c utils
cp $1/src/utils/filters_utils.c utils
cp $1/src/utils/huffman_utils.c utils
cp $1/src/utils/quant_levels_dec_utils.c utils
cp $1/src/utils/quant_levels_utils.c utils
cp $1/src/utils/random_utils.c utils
cp $1/src/utils/rescaler_utils.c utils
cp $1/src/utils/thread_utils.c utils
cp $1/src/utils/utils.c utils

View file

@ -0,0 +1,26 @@
# -*- 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'ImageLib')
SOURCES += [
'bit_reader_utils.c',
'color_cache_utils.c',
'filters_utils.c',
'huffman_utils.c',
'quant_levels_dec_utils.c',
'quant_levels_utils.c',
'random_utils.c',
'rescaler_utils.c',
'thread_utils.c',
'utils.c',
]
FINAL_LIBRARY = 'gkmedias'
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True