From b094b135956829a293dd409eefa39f2912434fd9 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 24 Jul 2017 13:20:46 +0200 Subject: Add build files to support libwebp decoding. --- media/libwebp/MOZCHANGES | 3 ++ media/libwebp/dec/moz.build | 26 +++++++++++++++ media/libwebp/demux/moz.build | 17 ++++++++++ media/libwebp/dsp/moz.build | 53 ++++++++++++++++++++++++++++++ media/libwebp/moz.build | 28 ++++++++++++++++ media/libwebp/moz/cpu.cpp | 44 +++++++++++++++++++++++++ media/libwebp/moz/moz.build | 17 ++++++++++ media/libwebp/update.sh | 76 +++++++++++++++++++++++++++++++++++++++++++ media/libwebp/utils/moz.build | 26 +++++++++++++++ 9 files changed, 290 insertions(+) create mode 100644 media/libwebp/MOZCHANGES create mode 100644 media/libwebp/dec/moz.build create mode 100644 media/libwebp/demux/moz.build create mode 100644 media/libwebp/dsp/moz.build create mode 100644 media/libwebp/moz.build create mode 100644 media/libwebp/moz/cpu.cpp create mode 100644 media/libwebp/moz/moz.build create mode 100644 media/libwebp/update.sh create mode 100644 media/libwebp/utils/moz.build (limited to 'media') diff --git a/media/libwebp/MOZCHANGES b/media/libwebp/MOZCHANGES new file mode 100644 index 000000000..68937eea6 --- /dev/null +++ b/media/libwebp/MOZCHANGES @@ -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). diff --git a/media/libwebp/dec/moz.build b/media/libwebp/dec/moz.build new file mode 100644 index 000000000..d988ae658 --- /dev/null +++ b/media/libwebp/dec/moz.build @@ -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 diff --git a/media/libwebp/demux/moz.build b/media/libwebp/demux/moz.build new file mode 100644 index 000000000..3024a71c3 --- /dev/null +++ b/media/libwebp/demux/moz.build @@ -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 diff --git a/media/libwebp/dsp/moz.build b/media/libwebp/dsp/moz.build new file mode 100644 index 000000000..006a691a0 --- /dev/null +++ b/media/libwebp/dsp/moz.build @@ -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 diff --git a/media/libwebp/moz.build b/media/libwebp/moz.build new file mode 100644 index 000000000..7d3aa9d0f --- /dev/null +++ b/media/libwebp/moz.build @@ -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 diff --git a/media/libwebp/moz/cpu.cpp b/media/libwebp/moz/cpu.cpp new file mode 100644 index 000000000..39b9f3500 --- /dev/null +++ b/media/libwebp/moz/cpu.cpp @@ -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; diff --git a/media/libwebp/moz/moz.build b/media/libwebp/moz/moz.build new file mode 100644 index 000000000..c60474f45 --- /dev/null +++ b/media/libwebp/moz/moz.build @@ -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 diff --git a/media/libwebp/update.sh b/media/libwebp/update.sh new file mode 100644 index 000000000..57cd45996 --- /dev/null +++ b/media/libwebp/update.sh @@ -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 +# +# 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 diff --git a/media/libwebp/utils/moz.build b/media/libwebp/utils/moz.build new file mode 100644 index 000000000..9fb274e9a --- /dev/null +++ b/media/libwebp/utils/moz.build @@ -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 -- cgit v1.2.3