webp: Make it a module and unbundle libwebp thirdparty files

Note that there are two Godot-specific changes made to libwebp
for the javascript/HTML5 platform. They are documented in the
README.md.
This commit is contained in:
Rémi Verschelde committed 2016-10-15 11:50:39 +02:00
1 parent b1e8889d96
commit ee3cf211c6
162 files changed
+287 -250

No files matched your search

+1 -4
View File
@@ -128,7 +128,7 @@ opts.Add('theoralib','Theora Video (yes/no)','no')
opts.Add('freetype','Freetype support in editor','builtin')
opts.Add('xml','XML Save/Load support (yes/no)','yes')
opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
opts.Add('libwebp','libwebp library for webp module (system/builtin)','builtin')
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
opts.Add('musepack','Musepack Audio (yes/no)','yes')
@@ -347,9 +347,6 @@ if selected_platform in platform_list:
if (env['theoralib']=='yes'):
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);
if (env['webp']=='yes'):
env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
if (env['tools']=='yes'):
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d']=='yes'):
-2
View File
@@ -26,8 +26,6 @@ if (env['openssl']!='no'):
SConscript("png/SCsub");
if (env["webp"]=="yes"):
SConscript("webp/SCsub");
if (env["builtin_zlib"]=="yes"):
SConscript("builtin_zlib/SCsub");
-16
View File
@@ -30,7 +30,6 @@
#include "png/image_loader_png.h"
#include "png/resource_saver_png.h"
#include "webp/image_loader_webp.h"
#include "chibi/event_stream_chibi.h"
@@ -72,10 +71,6 @@
static ImageLoaderPNG *image_loader_png=NULL;
static ResourceSaverPNG *resource_saver_png=NULL;
#ifdef WEBP_ENABLED
static ImageLoaderWEBP *image_loader_webp=NULL;
#endif
#ifdef TREMOR_ENABLED
static ResourceFormatLoaderAudioStreamOGG *vorbis_stream_loader=NULL;
#endif
@@ -109,11 +104,6 @@ void register_core_driver_types() {
resource_saver_png = memnew( ResourceSaverPNG );
ResourceSaver::add_resource_format_saver(resource_saver_png);
#ifdef WEBP_ENABLED
image_loader_webp = memnew( ImageLoaderWEBP );
ImageLoader::add_image_format_loader( image_loader_webp );
#endif
ObjectTypeDB::register_type<RegEx>();
}
@@ -123,12 +113,6 @@ void unregister_core_driver_types() {
memdelete( image_loader_png );
if (resource_saver_png)
memdelete( resource_saver_png );
#ifdef WEBP_ENABLED
if (image_loader_webp)
memdelete( image_loader_webp );
#endif
}
-115
View File
@@ -1,115 +0,0 @@
Import('env')
webp_sources = [
"webp/enc/webpenc.c",\
"webp/enc/near_lossless.c",\
"webp/enc/frame.c",\
"webp/enc/alpha.c",\
"webp/enc/picture_csp.c",\
"webp/enc/vp8l.c",\
"webp/enc/picture_psnr.c",\
"webp/enc/delta_palettization.c",\
"webp/enc/syntax.c",\
"webp/enc/backward_references.c",\
"webp/enc/token.c",\
"webp/enc/analysis.c",\
"webp/enc/iterator.c",\
"webp/enc/picture_tools.c",\
"webp/enc/picture_rescale.c",\
"webp/enc/config.c",\
"webp/enc/tree.c",\
"webp/enc/cost.c",\
"webp/enc/picture.c",\
"webp/enc/quant.c",\
"webp/enc/filter.c",\
"webp/enc/histogram.c",\
"webp/image_loader_webp.cpp",\
"webp/utils/rescaler.c",\
"webp/utils/filters.c",\
"webp/utils/quant_levels_dec.c",\
"webp/utils/huffman.c",\
"webp/utils/thread.c",\
"webp/utils/quant_levels.c",\
"webp/utils/bit_writer.c",\
"webp/utils/bit_reader.c",\
"webp/utils/random.c",\
"webp/utils/utils.c",\
"webp/utils/huffman_encode.c",\
"webp/utils/color_cache.c",\
"webp/mux/muxinternal.c",\
"webp/mux/muxread.c",\
"webp/mux/anim_encode.c",\
"webp/mux/muxedit.c",\
"webp/dec/webp.c",\
"webp/dec/frame.c",\
"webp/dec/alpha.c",\
"webp/dec/vp8l.c",\
"webp/dec/io.c",\
"webp/dec/vp8.c",\
"webp/dec/idec.c",\
"webp/dec/tree.c",\
"webp/dec/buffer.c",\
"webp/dec/quant.c",\
"webp/demux/demux.c",\
"webp/demux/anim_decode.c",\
"webp/dsp/yuv.c",\
"webp/dsp/filters_sse2.c",\
"webp/dsp/dec_sse41.c",\
"webp/dsp/rescaler.c",\
"webp/dsp/lossless_sse2.c",\
"webp/dsp/alpha_processing_sse41.c",\
"webp/dsp/alpha_processing_sse2.c",\
"webp/dsp/filters.c",\
"webp/dsp/upsampling_mips_dsp_r2.c",\
"webp/dsp/dec_neon.c",\
"webp/dsp/enc_neon.c",\
"webp/dsp/lossless_enc_mips32.c",\
"webp/dsp/lossless_enc_sse2.c",\
"webp/dsp/upsampling.c",\
"webp/dsp/lossless_enc_neon.c",\
"webp/dsp/alpha_processing.c",\
"webp/dsp/cost_sse2.c",\
"webp/dsp/dec_mips32.c",\
"webp/dsp/enc_avx2.c",\
"webp/dsp/rescaler_mips32.c",\
"webp/dsp/enc.c",\
"webp/dsp/lossless_enc_sse41.c",\
"webp/dsp/cost_mips32.c",\
"webp/dsp/lossless_mips_dsp_r2.c",\
"webp/dsp/filters_mips_dsp_r2.c",\
"webp/dsp/upsampling_neon.c",\
"webp/dsp/alpha_processing_mips_dsp_r2.c",\
"webp/dsp/enc_mips_dsp_r2.c",\
"webp/dsp/lossless.c",\
"webp/dsp/yuv_mips_dsp_r2.c",\
"webp/dsp/cost_mips_dsp_r2.c",\
"webp/dsp/argb.c",\
"webp/dsp/dec_sse2.c",\
"webp/dsp/rescaler_sse2.c",\
"webp/dsp/enc_sse41.c",\
"webp/dsp/argb_mips_dsp_r2.c",\
"webp/dsp/lossless_enc_mips_dsp_r2.c",\
"webp/dsp/dec_clip_tables.c",\
"webp/dsp/yuv_mips32.c",\
"webp/dsp/cpu.c",\
"webp/dsp/dec.c",\
"webp/dsp/argb_sse2.c",\
"webp/dsp/lossless_neon.c",\
"webp/dsp/lossless_enc.c",\
"webp/dsp/enc_mips32.c",\
"webp/dsp/cost.c",\
"webp/dsp/rescaler_mips_dsp_r2.c",\
"webp/dsp/dec_mips_dsp_r2.c",\
"webp/dsp/rescaler_neon.c",\
"webp/dsp/yuv_sse2.c",\
"webp/dsp/enc_sse2.c",\
"webp/dsp/upsampling_sse2.c"
]
env.drivers_sources+=webp_sources
#env.add_source_files(env.drivers_sources, webp_sources)
Export('env')
-51
View File
@@ -1,51 +0,0 @@
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
// -----------------------------------------------------------------------------
//
#ifndef WEBP_WEBP_EXTRAS_H_
#define WEBP_WEBP_EXTRAS_H_
#include "./types.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "./encode.h"
#define WEBP_EXTRAS_ABI_VERSION 0x0000 // MAJOR(8b) + MINOR(8b)
//------------------------------------------------------------------------------
// Returns the version number of the extras library, packed in hexadecimal using
// 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507.
WEBP_EXTERN(int) WebPGetExtrasVersion(void);
//------------------------------------------------------------------------------
// Ad-hoc colorspace importers.
// Import luma sample (gray scale image) into 'picture'. The 'picture'
// width and height must be set prior to calling this function.
WEBP_EXTERN(int) WebPImportGray(const uint8_t* gray, WebPPicture* picture);
// Import rgb sample in RGB565 packed format into 'picture'. The 'picture'
// width and height must be set prior to calling this function.
WEBP_EXTERN(int) WebPImportRGB565(const uint8_t* rgb565, WebPPicture* pic);
// Import rgb sample in RGB4444 packed format into 'picture'. The 'picture'
// width and height must be set prior to calling this function.
WEBP_EXTERN(int) WebPImportRGB4444(const uint8_t* rgb4444, WebPPicture* pic);
//------------------------------------------------------------------------------
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* WEBP_WEBP_EXTRAS_H_ */
+120
View File
@@ -0,0 +1,120 @@
Import('env')
Import('env_modules')
# Thirdparty source files
if (env["libwebp"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libwebp/"
thirdparty_libwebp_sources = [
"enc/webpenc.c",
"enc/near_lossless.c",
"enc/frame.c",
"enc/alpha.c",
"enc/picture_csp.c",
"enc/vp8l.c",
"enc/picture_psnr.c",
"enc/delta_palettization.c",
"enc/syntax.c",
"enc/backward_references.c",
"enc/token.c",
"enc/analysis.c",
"enc/iterator.c",
"enc/picture_tools.c",
"enc/picture_rescale.c",
"enc/config.c",
"enc/tree.c",
"enc/cost.c",
"enc/picture.c",
"enc/quant.c",
"enc/filter.c",
"enc/histogram.c",
"utils/rescaler.c",
"utils/filters.c",
"utils/quant_levels_dec.c",
"utils/huffman.c",
"utils/thread.c",
"utils/quant_levels.c",
"utils/bit_writer.c",
"utils/bit_reader.c",
"utils/random.c",
"utils/utils.c",
"utils/huffman_encode.c",
"utils/color_cache.c",
"mux/muxinternal.c",
"mux/muxread.c",
"mux/anim_encode.c",
"mux/muxedit.c",
"dec/webp.c",
"dec/frame.c",
"dec/alpha.c",
"dec/vp8l.c",
"dec/io.c",
"dec/vp8.c",
"dec/idec.c",
"dec/tree.c",
"dec/buffer.c",
"dec/quant.c",
"demux/demux.c",
"demux/anim_decode.c",
"dsp/yuv.c",
"dsp/filters_sse2.c",
"dsp/dec_sse41.c",
"dsp/rescaler.c",
"dsp/lossless_sse2.c",
"dsp/alpha_processing_sse41.c",
"dsp/alpha_processing_sse2.c",
"dsp/filters.c",
"dsp/upsampling_mips_dsp_r2.c",
"dsp/dec_neon.c",
"dsp/enc_neon.c",
"dsp/lossless_enc_mips32.c",
"dsp/lossless_enc_sse2.c",
"dsp/upsampling.c",
"dsp/lossless_enc_neon.c",
"dsp/alpha_processing.c",
"dsp/cost_sse2.c",
"dsp/dec_mips32.c",
"dsp/enc_avx2.c",
"dsp/rescaler_mips32.c",
"dsp/enc.c",
"dsp/lossless_enc_sse41.c",
"dsp/cost_mips32.c",
"dsp/lossless_mips_dsp_r2.c",
"dsp/filters_mips_dsp_r2.c",
"dsp/upsampling_neon.c",
"dsp/alpha_processing_mips_dsp_r2.c",
"dsp/enc_mips_dsp_r2.c",
"dsp/lossless.c",
"dsp/yuv_mips_dsp_r2.c",
"dsp/cost_mips_dsp_r2.c",
"dsp/argb.c",
"dsp/dec_sse2.c",
"dsp/rescaler_sse2.c",
"dsp/enc_sse41.c",
"dsp/argb_mips_dsp_r2.c",
"dsp/lossless_enc_mips_dsp_r2.c",
"dsp/dec_clip_tables.c",
"dsp/yuv_mips32.c",
"dsp/cpu.c",
"dsp/dec.c",
"dsp/argb_sse2.c",
"dsp/lossless_neon.c",
"dsp/lossless_enc.c",
"dsp/enc_mips32.c",
"dsp/cost.c",
"dsp/rescaler_mips_dsp_r2.c",
"dsp/dec_mips_dsp_r2.c",
"dsp/rescaler_neon.c",
"dsp/yuv_sse2.c",
"dsp/enc_sse2.c",
"dsp/upsampling_sse2.c",
]
thirdparty_libwebp_sources = [thirdparty_dir + file for file in thirdparty_libwebp_sources]
env_modules.add_source_files(env.modules_sources, thirdparty_libwebp_sources)
env_modules.Append(CPPPATH = [thirdparty_dir])
# Godot source files
env_modules.add_source_files(env.modules_sources, "*.cpp")
Export('env_modules')
Export('env')
+6
View File
@@ -0,0 +1,6 @@
def can_build(platform):
return True
def configure(env):
pass
@@ -28,12 +28,13 @@
/*************************************************************************/
#include "image_loader_webp.h"
#include "io/marshalls.h"
#include "print_string.h"
#include "os/os.h"
#include "drivers/webp/decode.h"
#include "drivers/webp/encode.h"
#include "io/marshalls.h"
#include <stdlib.h>
#include <webp/decode.h>
#include <webp/encode.h>
static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) {
File renamed without changes.
+44
View File
@@ -0,0 +1,44 @@
/*************************************************************************/
/* register_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
#include "image_loader_webp.h"
static ImageLoaderWEBP *image_loader_webp = NULL;
void register_webp_types() {
image_loader_webp = memnew( ImageLoaderWEBP );
ImageLoader::add_image_format_loader(image_loader_webp);
}
void unregister_webp_types() {
memdelete( image_loader_webp );
}
+30
View File
@@ -0,0 +1,30 @@
/*************************************************************************/
/* register_types.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_webp_types();
void unregister_webp_types();
+3
View File
@@ -146,6 +146,9 @@ def configure(env):
if (env["libpng"] == "system"):
env.ParseConfig('pkg-config libpng --cflags --libs')
if (env["libwebp"] == "system"):
env.ParseConfig('pkg-config libwebp --cflags --libs')
if (env["freetype"]=="yes"):
env.ParseConfig('pkg-config freetype2 --cflags --libs')
+16
View File
@@ -44,6 +44,22 @@ Files extracted from upstream source:
- scripts/pnglibconf.h.prebuilt as pnglibconf.h
## libwebp
- Upstream: https://chromium.googlesource.com/webm/libwebp/
- Version: 0.5.1
- License: BSD-3-Clause
Files extracted from the upstream source:
- src/\* except from: \*.am, \*.in, extras/, webp/extras.h
- AUTHORS, COPYING, PATENTS
Important: The files `utils/bit_reader.{c,h}` have Godot-made
changes to ensure they build for Javascript/HTML5. Those
changes are marked with `// -- GODOT --` comments.
## pvrtccompressor
- Upstream: https://bitbucket.org/jthlim/pvrtccompressor
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -18,7 +18,7 @@
#include "../dsp/dsp.h"
#include "../utils/quant_levels_dec.h"
#include "../utils/utils.h"
#include "webp/format_constants.h"
#include "../webp/format_constants.h"
//------------------------------------------------------------------------------
// ALPHDecoder object.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -14,7 +14,7 @@
#ifndef WEBP_WEBP_DECODE_VP8_H_
#define WEBP_WEBP_DECODE_VP8_H_
#include "webp/decode.h"
#include "../webp/decode.h"
#ifdef __cplusplus
extern "C" {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -17,7 +17,7 @@
#include "./vp8li.h"
#include "./webpi.h"
#include "../utils/utils.h"
#include "webp/mux_types.h" // ALPHA_FLAG
#include "../webp/mux_types.h" // ALPHA_FLAG
//------------------------------------------------------------------------------
// RIFF layout is:
File renamed without changes.
@@ -11,15 +11,15 @@
//
#ifdef HAVE_CONFIG_H
#include "webp/config.h"
#include "../webp/config.h"
#endif
#include <assert.h>
#include <string.h>
#include "../utils/utils.h"
#include "webp/decode.h"
#include "webp/demux.h"
#include "../webp/decode.h"
#include "../webp/demux.h"
#define NUM_CHANNELS 4
@@ -11,7 +11,7 @@
//
#ifdef HAVE_CONFIG_H
#include "webp/config.h"
#include "../webp/config.h"
#endif
#include <assert.h>
@@ -19,9 +19,9 @@
#include <string.h>
#include "../utils/utils.h"
#include "webp/decode.h" // WebPGetFeatures
#include "webp/demux.h"
#include "webp/format_constants.h"
#include "../webp/decode.h" // WebPGetFeatures
#include "../webp/demux.h"
#include "../webp/format_constants.h"
#define DMUX_MAJ_VERSION 0
#define DMUX_MIN_VERSION 3
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -15,10 +15,10 @@
#define WEBP_DSP_DSP_H_
#ifdef HAVE_CONFIG_H
#include "webp/config.h"
#include "../webp/config.h"
#endif
#include "webp/types.h"
#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -15,8 +15,8 @@
#ifndef WEBP_DSP_LOSSLESS_H_
#define WEBP_DSP_LOSSLESS_H_
#include "webp/types.h"
#include "webp/decode.h"
#include "../webp/types.h"
#include "../webp/decode.h"
#include "../enc/histogram.h"
#include "../utils/utils.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -19,7 +19,7 @@
#include "../utils/filters.h"
#include "../utils/quant_levels.h"
#include "../utils/utils.h"
#include "webp/format_constants.h"
#include "../webp/format_constants.h"
// -----------------------------------------------------------------------------
// Encodes the given alpha data via specified compression method 'method'.
File renamed without changes.
File renamed without changes.
@@ -15,8 +15,8 @@
#include <assert.h>
#include <stdlib.h>
#include "webp/types.h"
#include "webp/format_constants.h"
#include "../webp/types.h"
#include "../webp/format_constants.h"
#ifdef __cplusplus
extern "C" {
@@ -11,7 +11,7 @@
//
// Author: Skal (pascal.massimino@gmail.com)
#include "webp/encode.h"
#include "../webp/encode.h"
//------------------------------------------------------------------------------
// WebPConfig
Loaded 100 of 162 files, more files were not shown because too many files have changed in this diff. Show more