Browse Source

Modified webp source codes for godot

volzhs 9 years ago
parent
commit
e55c6f8232

+ 1 - 1
drivers/webp/dec/alpha.c

@@ -18,7 +18,7 @@
 #include "../dsp/dsp.h"
 #include "../dsp/dsp.h"
 #include "../utils/quant_levels_dec.h"
 #include "../utils/quant_levels_dec.h"
 #include "../utils/utils.h"
 #include "../utils/utils.h"
-#include "../webp/format_constants.h"
+#include "webp/format_constants.h"
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 // ALPHDecoder object.
 // ALPHDecoder object.

+ 1 - 1
drivers/webp/dec/decode_vp8.h

@@ -14,7 +14,7 @@
 #ifndef WEBP_WEBP_DECODE_VP8_H_
 #ifndef WEBP_WEBP_DECODE_VP8_H_
 #define WEBP_WEBP_DECODE_VP8_H_
 #define WEBP_WEBP_DECODE_VP8_H_
 
 
-#include "../webp/decode.h"
+#include "webp/decode.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/dec/webp.c

@@ -17,7 +17,7 @@
 #include "./vp8li.h"
 #include "./vp8li.h"
 #include "./webpi.h"
 #include "./webpi.h"
 #include "../utils/utils.h"
 #include "../utils/utils.h"
-#include "../webp/mux_types.h"  // ALPHA_FLAG
+#include "webp/mux_types.h"  // ALPHA_FLAG
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 // RIFF layout is:
 // RIFF layout is:

+ 3 - 3
drivers/webp/demux/anim_decode.c

@@ -11,15 +11,15 @@
 //
 //
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "../webp/config.h"
+#include "webp/config.h"
 #endif
 #endif
 
 
 #include <assert.h>
 #include <assert.h>
 #include <string.h>
 #include <string.h>
 
 
 #include "../utils/utils.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
 #define NUM_CHANNELS 4
 
 

+ 4 - 4
drivers/webp/demux/demux.c

@@ -11,7 +11,7 @@
 //
 //
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "../webp/config.h"
+#include "webp/config.h"
 #endif
 #endif
 
 
 #include <assert.h>
 #include <assert.h>
@@ -19,9 +19,9 @@
 #include <string.h>
 #include <string.h>
 
 
 #include "../utils/utils.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_MAJ_VERSION 0
 #define DMUX_MIN_VERSION 3
 #define DMUX_MIN_VERSION 3

+ 2 - 2
drivers/webp/dsp/dsp.h

@@ -15,10 +15,10 @@
 #define WEBP_DSP_DSP_H_
 #define WEBP_DSP_DSP_H_
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "../webp/config.h"
+#include "webp/config.h"
 #endif
 #endif
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 2 - 2
drivers/webp/dsp/lossless.h

@@ -15,8 +15,8 @@
 #ifndef WEBP_DSP_LOSSLESS_H_
 #ifndef WEBP_DSP_LOSSLESS_H_
 #define 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 "../enc/histogram.h"
 #include "../utils/utils.h"
 #include "../utils/utils.h"

+ 1 - 1
drivers/webp/enc/alpha.c

@@ -19,7 +19,7 @@
 #include "../utils/filters.h"
 #include "../utils/filters.h"
 #include "../utils/quant_levels.h"
 #include "../utils/quant_levels.h"
 #include "../utils/utils.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'.
 // Encodes the given alpha data via specified compression method 'method'.

+ 2 - 2
drivers/webp/enc/backward_references.h

@@ -15,8 +15,8 @@
 
 
 #include <assert.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <stdlib.h>
-#include "../webp/types.h"
-#include "../webp/format_constants.h"
+#include "webp/types.h"
+#include "webp/format_constants.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/enc/config.c

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

+ 1 - 1
drivers/webp/enc/delta_palettization.c

@@ -13,7 +13,7 @@
 #include "./delta_palettization.h"
 #include "./delta_palettization.h"
 
 
 #ifdef WEBP_EXPERIMENTAL_FEATURES
 #ifdef WEBP_EXPERIMENTAL_FEATURES
-#include "../webp/types.h"
+#include "webp/types.h"
 #include "../dsp/lossless.h"
 #include "../dsp/lossless.h"
 
 
 #define MK_COL(r, g, b) (((r) << 16) + ((g) << 8) + (b))
 #define MK_COL(r, g, b) (((r) << 16) + ((g) << 8) + (b))

+ 1 - 1
drivers/webp/enc/delta_palettization.h

@@ -13,7 +13,7 @@
 #ifndef WEBP_ENC_DELTA_PALETTIZATION_H_
 #ifndef WEBP_ENC_DELTA_PALETTIZATION_H_
 #define WEBP_ENC_DELTA_PALETTIZATION_H_
 #define WEBP_ENC_DELTA_PALETTIZATION_H_
 
 
-#include "../webp/encode.h"
+#include "webp/encode.h"
 #include "../enc/vp8li.h"
 #include "../enc/vp8li.h"
 
 
 // Replaces enc->argb_[] input by a palettizable approximation of it,
 // Replaces enc->argb_[] input by a palettizable approximation of it,

+ 1 - 1
drivers/webp/enc/frame.c

@@ -17,7 +17,7 @@
 #include "./cost.h"
 #include "./cost.h"
 #include "./vp8enci.h"
 #include "./vp8enci.h"
 #include "../dsp/dsp.h"
 #include "../dsp/dsp.h"
-#include "../webp/format_constants.h"  // RIFF constants
+#include "webp/format_constants.h"  // RIFF constants
 
 
 #define SEGMENT_VISU 0
 #define SEGMENT_VISU 0
 #define DEBUG_SEARCH 0    // useful to track search convergence
 #define DEBUG_SEARCH 0    // useful to track search convergence

+ 1 - 1
drivers/webp/enc/histogram.c

@@ -10,7 +10,7 @@
 // Author: Jyrki Alakuijala ([email protected])
 // Author: Jyrki Alakuijala ([email protected])
 //
 //
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "../webp/config.h"
+#include "webp/config.h"
 #endif
 #endif
 
 
 #include <math.h>
 #include <math.h>

+ 2 - 2
drivers/webp/enc/histogram.h

@@ -17,8 +17,8 @@
 #include <string.h>
 #include <string.h>
 
 
 #include "./backward_references.h"
 #include "./backward_references.h"
-#include "../webp/format_constants.h"
-#include "../webp/types.h"
+#include "webp/format_constants.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 2 - 2
drivers/webp/enc/syntax.c

@@ -14,8 +14,8 @@
 #include <assert.h>
 #include <assert.h>
 
 
 #include "../utils/utils.h"
 #include "../utils/utils.h"
-#include "../webp/format_constants.h"  // RIFF constants
-#include "../webp/mux_types.h"         // ALPHA_FLAG
+#include "webp/format_constants.h"  // RIFF constants
+#include "webp/mux_types.h"         // ALPHA_FLAG
 #include "./vp8enci.h"
 #include "./vp8enci.h"
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------

+ 1 - 1
drivers/webp/enc/vp8enci.h

@@ -20,7 +20,7 @@
 #include "../utils/bit_writer.h"
 #include "../utils/bit_writer.h"
 #include "../utils/thread.h"
 #include "../utils/thread.h"
 #include "../utils/utils.h"
 #include "../utils/utils.h"
-#include "../webp/encode.h"
+#include "webp/encode.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/enc/vp8l.c

@@ -23,7 +23,7 @@
 #include "../utils/bit_writer.h"
 #include "../utils/bit_writer.h"
 #include "../utils/huffman_encode.h"
 #include "../utils/huffman_encode.h"
 #include "../utils/utils.h"
 #include "../utils/utils.h"
-#include "../webp/format_constants.h"
+#include "webp/format_constants.h"
 
 
 #include "./delta_palettization.h"
 #include "./delta_palettization.h"
 
 

+ 2 - 2
drivers/webp/enc/vp8li.h

@@ -17,8 +17,8 @@
 #include "./backward_references.h"
 #include "./backward_references.h"
 #include "./histogram.h"
 #include "./histogram.h"
 #include "../utils/bit_writer.h"
 #include "../utils/bit_writer.h"
-#include "../webp/encode.h"
-#include "../webp/format_constants.h"
+#include "webp/encode.h"
+#include "webp/format_constants.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 4 - 4
drivers/webp/mux/anim_encode.c

@@ -17,10 +17,10 @@
 #include <stdlib.h>  // for abs()
 #include <stdlib.h>  // for abs()
 
 
 #include "../utils/utils.h"
 #include "../utils/utils.h"
-#include "../webp/decode.h"
-#include "../webp/encode.h"
-#include "../webp/format_constants.h"
-#include "../webp/mux.h"
+#include "webp/decode.h"
+#include "webp/encode.h"
+#include "webp/format_constants.h"
+#include "webp/mux.h"
 
 
 #if defined(_MSC_VER) && _MSC_VER < 1900
 #if defined(_MSC_VER) && _MSC_VER < 1900
 #define snprintf _snprintf
 #define snprintf _snprintf

+ 1 - 1
drivers/webp/mux/muxi.h

@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include "../dec/vp8i.h"
 #include "../dec/vp8i.h"
 #include "../dec/vp8li.h"
 #include "../dec/vp8li.h"
-#include "../webp/mux.h"
+#include "webp/mux.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 6 - 1
drivers/webp/utils/bit_reader.c

@@ -12,7 +12,7 @@
 // Author: Skal ([email protected])
 // Author: Skal ([email protected])
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "../webp/config.h"
+#include "webp/config.h"
 #endif
 #endif
 
 
 #include "./bit_reader_inl.h"
 #include "./bit_reader_inl.h"
@@ -41,7 +41,12 @@ void VP8InitBitReader(VP8BitReader* const br,
   br->bits_    = -8;   // to load the very first 8bits
   br->bits_    = -8;   // to load the very first 8bits
   br->eof_     = 0;
   br->eof_     = 0;
   VP8BitReaderSetBuffer(br, start, size);
   VP8BitReaderSetBuffer(br, start, size);
+#ifdef JAVASCRIPT_ENABLED // html5 required aligned reads
+  while(((uintptr_t)br->buf_ & 1) != 0 && !br->eof_)
+    VP8LoadFinalBytes(br);
+#else
   VP8LoadNewBytes(br);
   VP8LoadNewBytes(br);
+#endif
 }
 }
 
 
 void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset) {
 void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset) {

+ 9 - 1
drivers/webp/utils/bit_reader.h

@@ -19,7 +19,7 @@
 #ifdef _MSC_VER
 #ifdef _MSC_VER
 #include <stdlib.h>  // _byteswap_ulong
 #include <stdlib.h>  // _byteswap_ulong
 #endif
 #endif
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {
@@ -37,6 +37,12 @@ extern "C" {
 // BITS can be any multiple of 8 from 8 to 56 (inclusive).
 // BITS can be any multiple of 8 from 8 to 56 (inclusive).
 // Pick values that fit natural register size.
 // Pick values that fit natural register size.
 
 
+#ifdef JAVASCRIPT_ENABLED
+
+#define BITS 16
+
+#else
+
 #if defined(__i386__) || defined(_M_IX86)      // x86 32bit
 #if defined(__i386__) || defined(_M_IX86)      // x86 32bit
 #define BITS 24
 #define BITS 24
 #elif defined(__x86_64__) || defined(_M_X64)   // x86 64bit
 #elif defined(__x86_64__) || defined(_M_X64)   // x86 64bit
@@ -51,6 +57,8 @@ extern "C" {
 #define BITS 24
 #define BITS 24
 #endif
 #endif
 
 
+#endif
+
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 // Derived types and constants:
 // Derived types and constants:
 //   bit_t = natural register type for storing 'value_' (which is BITS+8 bits)
 //   bit_t = natural register type for storing 'value_' (which is BITS+8 bits)

+ 1 - 1
drivers/webp/utils/bit_reader_inl.h

@@ -17,7 +17,7 @@
 #define WEBP_UTILS_BIT_READER_INL_H_
 #define WEBP_UTILS_BIT_READER_INL_H_
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "../webp/config.h"
+#include "webp/config.h"
 #endif
 #endif
 
 
 #ifdef WEBP_FORCE_ALIGNED
 #ifdef WEBP_FORCE_ALIGNED

+ 1 - 1
drivers/webp/utils/bit_writer.h

@@ -14,7 +14,7 @@
 #ifndef WEBP_UTILS_BIT_WRITER_H_
 #ifndef WEBP_UTILS_BIT_WRITER_H_
 #define WEBP_UTILS_BIT_WRITER_H_
 #define WEBP_UTILS_BIT_WRITER_H_
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/utils/color_cache.h

@@ -15,7 +15,7 @@
 #ifndef WEBP_UTILS_COLOR_CACHE_H_
 #ifndef WEBP_UTILS_COLOR_CACHE_H_
 #define WEBP_UTILS_COLOR_CACHE_H_
 #define WEBP_UTILS_COLOR_CACHE_H_
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/utils/filters.h

@@ -14,7 +14,7 @@
 #ifndef WEBP_UTILS_FILTERS_H_
 #ifndef WEBP_UTILS_FILTERS_H_
 #define WEBP_UTILS_FILTERS_H_
 #define WEBP_UTILS_FILTERS_H_
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 #include "../dsp/dsp.h"
 #include "../dsp/dsp.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus

+ 1 - 1
drivers/webp/utils/huffman.c

@@ -15,8 +15,8 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
 #include "./huffman.h"
 #include "./huffman.h"
+#include "webp/format_constants.h"
 #include "./utils.h"
 #include "./utils.h"
-#include "../webp/format_constants.h"
 
 
 // Huffman data read via DecodeImageStream is represented in two (red and green)
 // Huffman data read via DecodeImageStream is represented in two (red and green)
 // bytes.
 // bytes.

+ 2 - 2
drivers/webp/utils/huffman.h

@@ -15,8 +15,8 @@
 #define WEBP_UTILS_HUFFMAN_H_
 #define WEBP_UTILS_HUFFMAN_H_
 
 
 #include <assert.h>
 #include <assert.h>
-#include "../webp/format_constants.h"
-#include "../webp/types.h"
+#include "webp/format_constants.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/utils/huffman_encode.c

@@ -15,8 +15,8 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
 #include "./huffman_encode.h"
 #include "./huffman_encode.h"
+#include "webp/format_constants.h"
 #include "./utils.h"
 #include "./utils.h"
-#include "../webp/format_constants.h"
 
 
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
 // Util function to optimize the symbol map for RLE coding
 // Util function to optimize the symbol map for RLE coding

+ 1 - 1
drivers/webp/utils/huffman_encode.h

@@ -14,7 +14,7 @@
 #ifndef WEBP_UTILS_HUFFMAN_ENCODE_H_
 #ifndef WEBP_UTILS_HUFFMAN_ENCODE_H_
 #define WEBP_UTILS_HUFFMAN_ENCODE_H_
 #define WEBP_UTILS_HUFFMAN_ENCODE_H_
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/utils/quant_levels.h

@@ -16,7 +16,7 @@
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/utils/quant_levels_dec.h

@@ -14,7 +14,7 @@
 #ifndef WEBP_UTILS_QUANT_LEVELS_DEC_H_
 #ifndef WEBP_UTILS_QUANT_LEVELS_DEC_H_
 #define WEBP_UTILS_QUANT_LEVELS_DEC_H_
 #define WEBP_UTILS_QUANT_LEVELS_DEC_H_
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/utils/random.h

@@ -15,7 +15,7 @@
 #define WEBP_UTILS_RANDOM_H_
 #define WEBP_UTILS_RANDOM_H_
 
 
 #include <assert.h>
 #include <assert.h>
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 1 - 1
drivers/webp/utils/rescaler.h

@@ -18,7 +18,7 @@
 extern "C" {
 extern "C" {
 #endif
 #endif
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #define WEBP_RESCALER_RFIX 32   // fixed-point precision for multiplies
 #define WEBP_RESCALER_RFIX 32   // fixed-point precision for multiplies
 #define WEBP_RESCALER_ONE (1ull << WEBP_RESCALER_RFIX)
 #define WEBP_RESCALER_ONE (1ull << WEBP_RESCALER_RFIX)

+ 2 - 2
drivers/webp/utils/thread.h

@@ -15,10 +15,10 @@
 #define WEBP_UTILS_THREAD_H_
 #define WEBP_UTILS_THREAD_H_
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "../webp/config.h"
+#include "webp/config.h"
 #endif
 #endif
 
 
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {

+ 3 - 3
drivers/webp/utils/utils.c

@@ -13,9 +13,9 @@
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>  // for memcpy()
 #include <string.h>  // for memcpy()
-#include "../webp/decode.h"
-#include "../webp/encode.h"
-#include "../webp/format_constants.h"  // for MAX_PALETTE_SIZE
+#include "webp/decode.h"
+#include "webp/encode.h"
+#include "webp/format_constants.h"  // for MAX_PALETTE_SIZE
 #include "./utils.h"
 #include "./utils.h"
 
 
 // If PRINT_MEM_INFO is defined, extra info (like total memory used, number of
 // If PRINT_MEM_INFO is defined, extra info (like total memory used, number of

+ 2 - 2
drivers/webp/utils/utils.h

@@ -16,13 +16,13 @@
 #define WEBP_UTILS_UTILS_H_
 #define WEBP_UTILS_UTILS_H_
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "../webp/config.h"
+#include "webp/config.h"
 #endif
 #endif
 
 
 #include <assert.h>
 #include <assert.h>
 
 
 #include "../dsp/dsp.h"
 #include "../dsp/dsp.h"
-#include "../webp/types.h"
+#include "webp/types.h"
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {