Browse Source

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.
Rémi Verschelde 8 years ago
parent
commit
ee3cf211c6
100 changed files with 242 additions and 209 deletions
  1. 1 4
      SConstruct
  2. 0 2
      drivers/SCsub
  3. 0 16
      drivers/register_driver_types.cpp
  4. 0 115
      drivers/webp/SCsub
  5. 0 51
      drivers/webp/extras.h
  6. 120 0
      modules/webp/SCsub
  7. 6 0
      modules/webp/config.py
  8. 4 3
      modules/webp/image_loader_webp.cpp
  9. 0 0
      modules/webp/image_loader_webp.h
  10. 44 0
      modules/webp/register_types.cpp
  11. 30 0
      modules/webp/register_types.h
  12. 3 0
      platform/x11/detect.py
  13. 16 0
      thirdparty/README.md
  14. 0 0
      thirdparty/libwebp/AUTHORS
  15. 0 0
      thirdparty/libwebp/COPYING
  16. 0 0
      thirdparty/libwebp/PATENTS
  17. 1 1
      thirdparty/libwebp/dec/alpha.c
  18. 0 0
      thirdparty/libwebp/dec/alphai.h
  19. 0 0
      thirdparty/libwebp/dec/buffer.c
  20. 0 0
      thirdparty/libwebp/dec/common.h
  21. 1 1
      thirdparty/libwebp/dec/decode_vp8.h
  22. 0 0
      thirdparty/libwebp/dec/frame.c
  23. 0 0
      thirdparty/libwebp/dec/idec.c
  24. 0 0
      thirdparty/libwebp/dec/io.c
  25. 0 0
      thirdparty/libwebp/dec/quant.c
  26. 0 0
      thirdparty/libwebp/dec/tree.c
  27. 0 0
      thirdparty/libwebp/dec/vp8.c
  28. 0 0
      thirdparty/libwebp/dec/vp8i.h
  29. 0 0
      thirdparty/libwebp/dec/vp8l.c
  30. 0 0
      thirdparty/libwebp/dec/vp8li.h
  31. 1 1
      thirdparty/libwebp/dec/webp.c
  32. 0 0
      thirdparty/libwebp/dec/webpi.h
  33. 3 3
      thirdparty/libwebp/demux/anim_decode.c
  34. 4 4
      thirdparty/libwebp/demux/demux.c
  35. 0 0
      thirdparty/libwebp/dsp/alpha_processing.c
  36. 0 0
      thirdparty/libwebp/dsp/alpha_processing_mips_dsp_r2.c
  37. 0 0
      thirdparty/libwebp/dsp/alpha_processing_sse2.c
  38. 0 0
      thirdparty/libwebp/dsp/alpha_processing_sse41.c
  39. 0 0
      thirdparty/libwebp/dsp/argb.c
  40. 0 0
      thirdparty/libwebp/dsp/argb_mips_dsp_r2.c
  41. 0 0
      thirdparty/libwebp/dsp/argb_sse2.c
  42. 0 0
      thirdparty/libwebp/dsp/common_sse2.h
  43. 0 0
      thirdparty/libwebp/dsp/cost.c
  44. 0 0
      thirdparty/libwebp/dsp/cost_mips32.c
  45. 0 0
      thirdparty/libwebp/dsp/cost_mips_dsp_r2.c
  46. 0 0
      thirdparty/libwebp/dsp/cost_sse2.c
  47. 0 0
      thirdparty/libwebp/dsp/cpu.c
  48. 0 0
      thirdparty/libwebp/dsp/dec.c
  49. 0 0
      thirdparty/libwebp/dsp/dec_clip_tables.c
  50. 0 0
      thirdparty/libwebp/dsp/dec_mips32.c
  51. 0 0
      thirdparty/libwebp/dsp/dec_mips_dsp_r2.c
  52. 0 0
      thirdparty/libwebp/dsp/dec_msa.c
  53. 0 0
      thirdparty/libwebp/dsp/dec_neon.c
  54. 0 0
      thirdparty/libwebp/dsp/dec_sse2.c
  55. 0 0
      thirdparty/libwebp/dsp/dec_sse41.c
  56. 2 2
      thirdparty/libwebp/dsp/dsp.h
  57. 0 0
      thirdparty/libwebp/dsp/enc.c
  58. 0 0
      thirdparty/libwebp/dsp/enc_avx2.c
  59. 0 0
      thirdparty/libwebp/dsp/enc_mips32.c
  60. 0 0
      thirdparty/libwebp/dsp/enc_mips_dsp_r2.c
  61. 0 0
      thirdparty/libwebp/dsp/enc_neon.c
  62. 0 0
      thirdparty/libwebp/dsp/enc_sse2.c
  63. 0 0
      thirdparty/libwebp/dsp/enc_sse41.c
  64. 0 0
      thirdparty/libwebp/dsp/filters.c
  65. 0 0
      thirdparty/libwebp/dsp/filters_mips_dsp_r2.c
  66. 0 0
      thirdparty/libwebp/dsp/filters_sse2.c
  67. 0 0
      thirdparty/libwebp/dsp/lossless.c
  68. 2 2
      thirdparty/libwebp/dsp/lossless.h
  69. 0 0
      thirdparty/libwebp/dsp/lossless_enc.c
  70. 0 0
      thirdparty/libwebp/dsp/lossless_enc_mips32.c
  71. 0 0
      thirdparty/libwebp/dsp/lossless_enc_mips_dsp_r2.c
  72. 0 0
      thirdparty/libwebp/dsp/lossless_enc_neon.c
  73. 0 0
      thirdparty/libwebp/dsp/lossless_enc_sse2.c
  74. 0 0
      thirdparty/libwebp/dsp/lossless_enc_sse41.c
  75. 0 0
      thirdparty/libwebp/dsp/lossless_mips_dsp_r2.c
  76. 0 0
      thirdparty/libwebp/dsp/lossless_neon.c
  77. 0 0
      thirdparty/libwebp/dsp/lossless_sse2.c
  78. 0 0
      thirdparty/libwebp/dsp/mips_macro.h
  79. 0 0
      thirdparty/libwebp/dsp/msa_macro.h
  80. 0 0
      thirdparty/libwebp/dsp/neon.h
  81. 0 0
      thirdparty/libwebp/dsp/rescaler.c
  82. 0 0
      thirdparty/libwebp/dsp/rescaler_mips32.c
  83. 0 0
      thirdparty/libwebp/dsp/rescaler_mips_dsp_r2.c
  84. 0 0
      thirdparty/libwebp/dsp/rescaler_neon.c
  85. 0 0
      thirdparty/libwebp/dsp/rescaler_sse2.c
  86. 0 0
      thirdparty/libwebp/dsp/upsampling.c
  87. 0 0
      thirdparty/libwebp/dsp/upsampling_mips_dsp_r2.c
  88. 0 0
      thirdparty/libwebp/dsp/upsampling_neon.c
  89. 0 0
      thirdparty/libwebp/dsp/upsampling_sse2.c
  90. 0 0
      thirdparty/libwebp/dsp/yuv.c
  91. 0 0
      thirdparty/libwebp/dsp/yuv.h
  92. 0 0
      thirdparty/libwebp/dsp/yuv_mips32.c
  93. 0 0
      thirdparty/libwebp/dsp/yuv_mips_dsp_r2.c
  94. 0 0
      thirdparty/libwebp/dsp/yuv_sse2.c
  95. 0 0
      thirdparty/libwebp/dsp/yuv_tables_sse2.h
  96. 1 1
      thirdparty/libwebp/enc/alpha.c
  97. 0 0
      thirdparty/libwebp/enc/analysis.c
  98. 0 0
      thirdparty/libwebp/enc/backward_references.c
  99. 2 2
      thirdparty/libwebp/enc/backward_references.h
  100. 1 1
      thirdparty/libwebp/enc/config.c

+ 1 - 4
SConstruct

@@ -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'):

+ 0 - 2
drivers/SCsub

@@ -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");
 

+ 0 - 16
drivers/register_driver_types.cpp

@@ -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
-
 }
 
 

+ 0 - 115
drivers/webp/SCsub

@@ -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')
-

+ 0 - 51
drivers/webp/extras.h

@@ -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 - 0
modules/webp/SCsub

@@ -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 - 0
modules/webp/config.py

@@ -0,0 +1,6 @@
+
+def can_build(platform):
+	return True
+
+def configure(env):
+	pass

+ 4 - 3
drivers/webp/image_loader_webp.cpp → modules/webp/image_loader_webp.cpp

@@ -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) {
 

+ 0 - 0
drivers/webp/image_loader_webp.h → modules/webp/image_loader_webp.h


+ 44 - 0
modules/webp/register_types.cpp

@@ -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 - 0
modules/webp/register_types.h

@@ -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 - 0
platform/x11/detect.py

@@ -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 - 0
thirdparty/README.md

@@ -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

+ 0 - 0
drivers/webp/AUTHORS → thirdparty/libwebp/AUTHORS


+ 0 - 0
drivers/webp/COPYING → thirdparty/libwebp/COPYING


+ 0 - 0
drivers/webp/PATENTS → thirdparty/libwebp/PATENTS


+ 1 - 1
drivers/webp/dec/alpha.c → thirdparty/libwebp/dec/alpha.c

@@ -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.

+ 0 - 0
drivers/webp/dec/alphai.h → thirdparty/libwebp/dec/alphai.h


+ 0 - 0
drivers/webp/dec/buffer.c → thirdparty/libwebp/dec/buffer.c


+ 0 - 0
drivers/webp/dec/common.h → thirdparty/libwebp/dec/common.h


+ 1 - 1
drivers/webp/dec/decode_vp8.h → thirdparty/libwebp/dec/decode_vp8.h

@@ -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" {

+ 0 - 0
drivers/webp/dec/frame.c → thirdparty/libwebp/dec/frame.c


+ 0 - 0
drivers/webp/dec/idec.c → thirdparty/libwebp/dec/idec.c


+ 0 - 0
drivers/webp/dec/io.c → thirdparty/libwebp/dec/io.c


+ 0 - 0
drivers/webp/dec/quant.c → thirdparty/libwebp/dec/quant.c


+ 0 - 0
drivers/webp/dec/tree.c → thirdparty/libwebp/dec/tree.c


+ 0 - 0
drivers/webp/dec/vp8.c → thirdparty/libwebp/dec/vp8.c


+ 0 - 0
drivers/webp/dec/vp8i.h → thirdparty/libwebp/dec/vp8i.h


+ 0 - 0
drivers/webp/dec/vp8l.c → thirdparty/libwebp/dec/vp8l.c


+ 0 - 0
drivers/webp/dec/vp8li.h → thirdparty/libwebp/dec/vp8li.h


+ 1 - 1
drivers/webp/dec/webp.c → thirdparty/libwebp/dec/webp.c

@@ -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:

+ 0 - 0
drivers/webp/dec/webpi.h → thirdparty/libwebp/dec/webpi.h


+ 3 - 3
drivers/webp/demux/anim_decode.c → thirdparty/libwebp/demux/anim_decode.c

@@ -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
 

+ 4 - 4
drivers/webp/demux/demux.c → thirdparty/libwebp/demux/demux.c

@@ -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

+ 0 - 0
drivers/webp/dsp/alpha_processing.c → thirdparty/libwebp/dsp/alpha_processing.c


+ 0 - 0
drivers/webp/dsp/alpha_processing_mips_dsp_r2.c → thirdparty/libwebp/dsp/alpha_processing_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/alpha_processing_sse2.c → thirdparty/libwebp/dsp/alpha_processing_sse2.c


+ 0 - 0
drivers/webp/dsp/alpha_processing_sse41.c → thirdparty/libwebp/dsp/alpha_processing_sse41.c


+ 0 - 0
drivers/webp/dsp/argb.c → thirdparty/libwebp/dsp/argb.c


+ 0 - 0
drivers/webp/dsp/argb_mips_dsp_r2.c → thirdparty/libwebp/dsp/argb_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/argb_sse2.c → thirdparty/libwebp/dsp/argb_sse2.c


+ 0 - 0
drivers/webp/dsp/common_sse2.h → thirdparty/libwebp/dsp/common_sse2.h


+ 0 - 0
drivers/webp/dsp/cost.c → thirdparty/libwebp/dsp/cost.c


+ 0 - 0
drivers/webp/dsp/cost_mips32.c → thirdparty/libwebp/dsp/cost_mips32.c


+ 0 - 0
drivers/webp/dsp/cost_mips_dsp_r2.c → thirdparty/libwebp/dsp/cost_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/cost_sse2.c → thirdparty/libwebp/dsp/cost_sse2.c


+ 0 - 0
drivers/webp/dsp/cpu.c → thirdparty/libwebp/dsp/cpu.c


+ 0 - 0
drivers/webp/dsp/dec.c → thirdparty/libwebp/dsp/dec.c


+ 0 - 0
drivers/webp/dsp/dec_clip_tables.c → thirdparty/libwebp/dsp/dec_clip_tables.c


+ 0 - 0
drivers/webp/dsp/dec_mips32.c → thirdparty/libwebp/dsp/dec_mips32.c


+ 0 - 0
drivers/webp/dsp/dec_mips_dsp_r2.c → thirdparty/libwebp/dsp/dec_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/dec_msa.c → thirdparty/libwebp/dsp/dec_msa.c


+ 0 - 0
drivers/webp/dsp/dec_neon.c → thirdparty/libwebp/dsp/dec_neon.c


+ 0 - 0
drivers/webp/dsp/dec_sse2.c → thirdparty/libwebp/dsp/dec_sse2.c


+ 0 - 0
drivers/webp/dsp/dec_sse41.c → thirdparty/libwebp/dsp/dec_sse41.c


+ 2 - 2
drivers/webp/dsp/dsp.h → thirdparty/libwebp/dsp/dsp.h

@@ -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" {

+ 0 - 0
drivers/webp/dsp/enc.c → thirdparty/libwebp/dsp/enc.c


+ 0 - 0
drivers/webp/dsp/enc_avx2.c → thirdparty/libwebp/dsp/enc_avx2.c


+ 0 - 0
drivers/webp/dsp/enc_mips32.c → thirdparty/libwebp/dsp/enc_mips32.c


+ 0 - 0
drivers/webp/dsp/enc_mips_dsp_r2.c → thirdparty/libwebp/dsp/enc_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/enc_neon.c → thirdparty/libwebp/dsp/enc_neon.c


+ 0 - 0
drivers/webp/dsp/enc_sse2.c → thirdparty/libwebp/dsp/enc_sse2.c


+ 0 - 0
drivers/webp/dsp/enc_sse41.c → thirdparty/libwebp/dsp/enc_sse41.c


+ 0 - 0
drivers/webp/dsp/filters.c → thirdparty/libwebp/dsp/filters.c


+ 0 - 0
drivers/webp/dsp/filters_mips_dsp_r2.c → thirdparty/libwebp/dsp/filters_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/filters_sse2.c → thirdparty/libwebp/dsp/filters_sse2.c


+ 0 - 0
drivers/webp/dsp/lossless.c → thirdparty/libwebp/dsp/lossless.c


+ 2 - 2
drivers/webp/dsp/lossless.h → thirdparty/libwebp/dsp/lossless.h

@@ -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"

+ 0 - 0
drivers/webp/dsp/lossless_enc.c → thirdparty/libwebp/dsp/lossless_enc.c


+ 0 - 0
drivers/webp/dsp/lossless_enc_mips32.c → thirdparty/libwebp/dsp/lossless_enc_mips32.c


+ 0 - 0
drivers/webp/dsp/lossless_enc_mips_dsp_r2.c → thirdparty/libwebp/dsp/lossless_enc_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/lossless_enc_neon.c → thirdparty/libwebp/dsp/lossless_enc_neon.c


+ 0 - 0
drivers/webp/dsp/lossless_enc_sse2.c → thirdparty/libwebp/dsp/lossless_enc_sse2.c


+ 0 - 0
drivers/webp/dsp/lossless_enc_sse41.c → thirdparty/libwebp/dsp/lossless_enc_sse41.c


+ 0 - 0
drivers/webp/dsp/lossless_mips_dsp_r2.c → thirdparty/libwebp/dsp/lossless_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/lossless_neon.c → thirdparty/libwebp/dsp/lossless_neon.c


+ 0 - 0
drivers/webp/dsp/lossless_sse2.c → thirdparty/libwebp/dsp/lossless_sse2.c


+ 0 - 0
drivers/webp/dsp/mips_macro.h → thirdparty/libwebp/dsp/mips_macro.h


+ 0 - 0
drivers/webp/dsp/msa_macro.h → thirdparty/libwebp/dsp/msa_macro.h


+ 0 - 0
drivers/webp/dsp/neon.h → thirdparty/libwebp/dsp/neon.h


+ 0 - 0
drivers/webp/dsp/rescaler.c → thirdparty/libwebp/dsp/rescaler.c


+ 0 - 0
drivers/webp/dsp/rescaler_mips32.c → thirdparty/libwebp/dsp/rescaler_mips32.c


+ 0 - 0
drivers/webp/dsp/rescaler_mips_dsp_r2.c → thirdparty/libwebp/dsp/rescaler_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/rescaler_neon.c → thirdparty/libwebp/dsp/rescaler_neon.c


+ 0 - 0
drivers/webp/dsp/rescaler_sse2.c → thirdparty/libwebp/dsp/rescaler_sse2.c


+ 0 - 0
drivers/webp/dsp/upsampling.c → thirdparty/libwebp/dsp/upsampling.c


+ 0 - 0
drivers/webp/dsp/upsampling_mips_dsp_r2.c → thirdparty/libwebp/dsp/upsampling_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/upsampling_neon.c → thirdparty/libwebp/dsp/upsampling_neon.c


+ 0 - 0
drivers/webp/dsp/upsampling_sse2.c → thirdparty/libwebp/dsp/upsampling_sse2.c


+ 0 - 0
drivers/webp/dsp/yuv.c → thirdparty/libwebp/dsp/yuv.c


+ 0 - 0
drivers/webp/dsp/yuv.h → thirdparty/libwebp/dsp/yuv.h


+ 0 - 0
drivers/webp/dsp/yuv_mips32.c → thirdparty/libwebp/dsp/yuv_mips32.c


+ 0 - 0
drivers/webp/dsp/yuv_mips_dsp_r2.c → thirdparty/libwebp/dsp/yuv_mips_dsp_r2.c


+ 0 - 0
drivers/webp/dsp/yuv_sse2.c → thirdparty/libwebp/dsp/yuv_sse2.c


+ 0 - 0
drivers/webp/dsp/yuv_tables_sse2.h → thirdparty/libwebp/dsp/yuv_tables_sse2.h


+ 1 - 1
drivers/webp/enc/alpha.c → thirdparty/libwebp/enc/alpha.c

@@ -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'.

+ 0 - 0
drivers/webp/enc/analysis.c → thirdparty/libwebp/enc/analysis.c


+ 0 - 0
drivers/webp/enc/backward_references.c → thirdparty/libwebp/enc/backward_references.c


+ 2 - 2
drivers/webp/enc/backward_references.h → thirdparty/libwebp/enc/backward_references.h

@@ -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" {

+ 1 - 1
drivers/webp/enc/config.c → thirdparty/libwebp/enc/config.c

@@ -11,7 +11,7 @@
 //
 // Author: Skal ([email protected])
 
-#include "webp/encode.h"
+#include "../webp/encode.h"
 
 //------------------------------------------------------------------------------
 // WebPConfig

Some files were not shown because too many files changed in this diff