Bug 1521478 - Update libwebp to v1.0.2. r=jrmuizel
authorAndrew Osmond <aosmond@mozilla.com>
Mon, 21 Jan 2019 07:36:03 -0500
changeset 454753 fe7e9442e6cc503ad0fa385a1c380e3b3a23b147
parent 454752 1e76cea31571ed9274acd577b515e2c928cd207b
child 454754 19db0edfbc10ad8f540a0a3482bd78c0baf7246d
push id35412
push usercsabou@mozilla.com
push dateTue, 22 Jan 2019 03:56:27 +0000
treeherdermozilla-central@956bd26eec5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1521478
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1521478 - Update libwebp to v1.0.2. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D17110
media/libwebp/AUTHORS
media/libwebp/MOZCHANGES
media/libwebp/NEWS
media/libwebp/README
media/libwebp/README.mux
media/libwebp/src/dec/vp8i_dec.h
media/libwebp/src/demux/demux.c
media/libwebp/src/enc/vp8i_enc.h
media/libwebp/src/utils/utils.h
media/libwebp/src/webp/decode.h
toolkit/moz.configure
--- a/media/libwebp/AUTHORS
+++ b/media/libwebp/AUTHORS
@@ -2,17 +2,17 @@ Contributors:
 - Alan Browning (browning at google dot com)
 - Charles Munger (clm at google dot com)
 - Christian Duvivier (cduvivier at google dot com)
 - Djordje Pesut (djordje dot pesut at imgtec dot com)
 - Hui Su (huisu at google dot com)
 - James Zern (jzern at google dot com)
 - Jan Engelhardt (jengelh at medozas dot de)
 - Jehan (jehan at girinstud dot io)
-- Johann (johann dot koenig at duck dot com)
+- Johann Koenig (johann dot koenig at duck dot com)
 - Jovan Zelincevic (jovan dot zelincevic at imgtec dot com)
 - Jyrki Alakuijala (jyrki at google dot com)
 - Konstantin Ivlev (tomskside at gmail dot com)
 - Lode Vandevenne (lode at google dot com)
 - Lou Quillio (louquillio at google dot com)
 - Mans Rullgard (mans at mansr dot com)
 - Marcin Kowalczyk (qrczak at google dot com)
 - Martin Olsson (mnemo at minimum dot se)
--- a/media/libwebp/MOZCHANGES
+++ b/media/libwebp/MOZCHANGES
@@ -1,5 +1,7 @@
 Changes made to pristine libwebp source by mozilla.org developers.
 
+2018/01/21  -- Synced with libwebp-1.0.2 (bug 1521478).
+
 2018/11/26  -- Synced with libwebp-1.0.1 (bug 1509878).
 
 2018/10/04  -- Synced with libwebp-1.0.0 (bug #1294490).
--- a/media/libwebp/NEWS
+++ b/media/libwebp/NEWS
@@ -1,8 +1,16 @@
+- 1/14/2019: version 1.0.2
+  This is a binary compatible release.
+  * (Windows) unicode file support in the tools (linux and mac already had
+    support, issue #398)
+  * lossless encoder speedups
+  * lossy encoder speedup on ARM
+  * lossless multi-threaded security fix (chromium:917029)
+
 - 11/2/2018: version 1.0.1
   This is a binary compatible release.
   * lossless encoder speedups
   * big-endian fix for alpha decoding (issue #393)
   * gif2webp fix for loop count=65535 transcode (issue #382)
   * further security related hardening in libwebp & libwebpmux
     (issues #383, #385, #386, #387, #388, #391)
     (oss-fuzz #9099, #9100, #9105, #9106, #9111, #9112, #9119, #9123, #9170,
--- a/media/libwebp/README
+++ b/media/libwebp/README
@@ -1,15 +1,15 @@
           __   __  ____  ____  ____
          /  \\/  \/  _ \/  _ )/  _ \
          \       /   __/  _  \   __/
           \__\__/\____/\_____/__/ ____  ___
                 / _/ /    \    \ /  _ \/ _/
                /  \_/   / /   \ \   __/  \__
-               \____/____/\_____/_____/____/v1.0.1
+               \____/____/\_____/_____/____/v1.0.2
 
 Description:
 ============
 
 WebP codec: library to encode and decode images in WebP format. This package
 contains the library that can be used in other programs to add WebP support,
 as well as the command line tools 'cwebp' and 'dwebp'.
 
@@ -131,16 +131,18 @@ make install
 
 If you also want any of the executables, you will need to enable them through
 CMake, e.g.:
 
 cmake -DWEBP_BUILD_CWEBP=ON -DWEBP_BUILD_DWEBP=ON ../
 
 or through your favorite interface (like ccmake or cmake-qt-gui).
 
+Use option -DWEBP_UNICODE=ON for Unicode support on Windows (with chcp 65001).
+
 Finally, once installed, you can also use WebP in your CMake project by doing:
 
 find_package(WebP)
 
 which will define the CMake variables WebP_INCLUDE_DIRS and WebP_LIBRARIES.
 
 Gradle:
 -------
--- a/media/libwebp/README.mux
+++ b/media/libwebp/README.mux
@@ -1,12 +1,12 @@
           __   __  ____  ____  ____  __ __  _     __ __
          /  \\/  \/  _ \/  _ \/  _ \/  \  \/ \___/_ / _\
          \       /   __/  _  \   __/      /  /  (_/  /__
-          \__\__/\_____/_____/__/  \__//_/\_____/__/___/v1.0.1
+          \__\__/\_____/_____/__/  \__//_/\_____/__/___/v1.0.2
 
 
 Description:
 ============
 
 WebPMux: set of two libraries 'Mux' and 'Demux' for creation, extraction and
 manipulation of an extended format WebP file, which can have features like
 color profile, metadata and animation. Reference command-line tools 'webpmux'
--- a/media/libwebp/src/dec/vp8i_dec.h
+++ b/media/libwebp/src/dec/vp8i_dec.h
@@ -27,17 +27,17 @@ extern "C" {
 #endif
 
 //------------------------------------------------------------------------------
 // Various defines and enums
 
 // version numbers
 #define DEC_MAJ_VERSION 1
 #define DEC_MIN_VERSION 0
-#define DEC_REV_VERSION 1
+#define DEC_REV_VERSION 2
 
 // YUV-cache parameters. Cache is 32-bytes wide (= one cacheline).
 // Constraints are: We need to store one 16x16 block of luma samples (y),
 // and two 8x8 chroma blocks (u/v). These are better be 16-bytes aligned,
 // in order to be SIMD-friendly. We also need to store the top, left and
 // top-left samples (from previously decoded blocks), along with four
 // extra top-right samples for luma (intra4x4 prediction only).
 // One possible layout is, using 32 * (17 + 9) bytes:
--- a/media/libwebp/src/demux/demux.c
+++ b/media/libwebp/src/demux/demux.c
@@ -20,17 +20,17 @@
 
 #include "src/utils/utils.h"
 #include "src/webp/decode.h"     // WebPGetFeatures
 #include "src/webp/demux.h"
 #include "src/webp/format_constants.h"
 
 #define DMUX_MAJ_VERSION 1
 #define DMUX_MIN_VERSION 0
-#define DMUX_REV_VERSION 1
+#define DMUX_REV_VERSION 2
 
 typedef struct {
   size_t start_;        // start location of the data
   size_t end_;          // end location
   size_t riff_end_;     // riff chunk end location, can be > end_.
   size_t buf_size_;     // size of the buffer
   const uint8_t* buf_;
 } MemBuffer;
--- a/media/libwebp/src/enc/vp8i_enc.h
+++ b/media/libwebp/src/enc/vp8i_enc.h
@@ -27,17 +27,17 @@ extern "C" {
 #endif
 
 //------------------------------------------------------------------------------
 // Various defines and enums
 
 // version numbers
 #define ENC_MAJ_VERSION 1
 #define ENC_MIN_VERSION 0
-#define ENC_REV_VERSION 1
+#define ENC_REV_VERSION 2
 
 enum { MAX_LF_LEVELS = 64,       // Maximum loop filter level
        MAX_VARIABLE_LEVEL = 67,  // last (inclusive) level with variable cost
        MAX_LEVEL = 2047          // max level (note: max codable is 2047 + 67)
      };
 
 typedef enum {   // Rate-distortion optimization levels
   RD_OPT_NONE        = 0,  // no rd-opt
--- a/media/libwebp/src/utils/utils.h
+++ b/media/libwebp/src/utils/utils.h
@@ -102,29 +102,16 @@ static WEBP_INLINE void PutLE24(uint8_t*
   data[2] = (val >> 16);
 }
 
 static WEBP_INLINE void PutLE32(uint8_t* const data, uint32_t val) {
   PutLE16(data, (int)(val & 0xffff));
   PutLE16(data + 2, (int)(val >> 16));
 }
 
-// Returns 31 ^ clz(n) = log2(n). This is the default C-implementation, either
-// based on table or not. Can be used as fallback if clz() is not available.
-#define WEBP_NEED_LOG_TABLE_8BIT
-extern const uint8_t WebPLogTable8bit[256];
-static WEBP_INLINE int WebPLog2FloorC(uint32_t n) {
-  int log_value = 0;
-  while (n >= 256) {
-    log_value += 8;
-    n >>= 8;
-  }
-  return log_value + WebPLogTable8bit[n];
-}
-
 // Returns (int)floor(log2(n)). n must be > 0.
 // use GNU builtins where available.
 #if defined(__GNUC__) && \
     ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
 static WEBP_INLINE int BitsLog2Floor(uint32_t n) {
   return 31 ^ __builtin_clz(n);
 }
 #elif defined(_MSC_VER) && _MSC_VER > 1310 && \
@@ -133,16 +120,29 @@ static WEBP_INLINE int BitsLog2Floor(uin
 #pragma intrinsic(_BitScanReverse)
 
 static WEBP_INLINE int BitsLog2Floor(uint32_t n) {
   unsigned long first_set_bit;
   _BitScanReverse(&first_set_bit, n);
   return first_set_bit;
 }
 #else   // default: use the C-version.
+// Returns 31 ^ clz(n) = log2(n). This is the default C-implementation, either
+// based on table or not. Can be used as fallback if clz() is not available.
+#define WEBP_NEED_LOG_TABLE_8BIT
+extern const uint8_t WebPLogTable8bit[256];
+static WEBP_INLINE int WebPLog2FloorC(uint32_t n) {
+  int log_value = 0;
+  while (n >= 256) {
+    log_value += 8;
+    n >>= 8;
+  }
+  return log_value + WebPLogTable8bit[n];
+}
+
 static WEBP_INLINE int BitsLog2Floor(uint32_t n) { return WebPLog2FloorC(n); }
 #endif
 
 //------------------------------------------------------------------------------
 // Pixel copying.
 
 struct WebPPicture;
 
--- a/media/libwebp/src/webp/decode.h
+++ b/media/libwebp/src/webp/decode.h
@@ -37,16 +37,22 @@ typedef struct WebPDecoderConfig WebPDec
 // Return the decoder's version number, packed in hexadecimal using 8bits for
 // each of major/minor/revision. E.g: v2.5.7 is 0x020507.
 WEBP_EXTERN int WebPGetDecoderVersion(void);
 
 // Retrieve basic header information: width, height.
 // This function will also validate the header, returning true on success,
 // false otherwise. '*width' and '*height' are only valid on successful return.
 // Pointers 'width' and 'height' can be passed NULL if deemed irrelevant.
+// Note: The following chunk sequences (before the raw VP8/VP8L data) are
+// considered valid by this function:
+// RIFF + VP8(L)
+// RIFF + VP8X + (optional chunks) + VP8(L)
+// ALPH + VP8 <-- Not a valid WebP format: only allowed for internal purpose.
+// VP8(L)     <-- Not a valid WebP format: only allowed for internal purpose.
 WEBP_EXTERN int WebPGetInfo(const uint8_t* data, size_t data_size,
                             int* width, int* height);
 
 // Decodes WebP images pointed to by 'data' and returns RGBA samples, along
 // with the dimensions in *width and *height. The ordering of samples in
 // memory is R, G, B, A, R, G, B, A... in scan order (endian-independent).
 // The returned pointer should be deleted calling WebPFree().
 // Returns NULL in case of error.
@@ -420,16 +426,22 @@ struct WebPBitstreamFeatures {
 WEBP_EXTERN VP8StatusCode WebPGetFeaturesInternal(
     const uint8_t*, size_t, WebPBitstreamFeatures*, int);
 
 // Retrieve features from the bitstream. The *features structure is filled
 // with information gathered from the bitstream.
 // Returns VP8_STATUS_OK when the features are successfully retrieved. Returns
 // VP8_STATUS_NOT_ENOUGH_DATA when more data is needed to retrieve the
 // features from headers. Returns error in other cases.
+// Note: The following chunk sequences (before the raw VP8/VP8L data) are
+// considered valid by this function:
+// RIFF + VP8(L)
+// RIFF + VP8X + (optional chunks) + VP8(L)
+// ALPH + VP8 <-- Not a valid WebP format: only allowed for internal purpose.
+// VP8(L)     <-- Not a valid WebP format: only allowed for internal purpose.
 static WEBP_INLINE VP8StatusCode WebPGetFeatures(
     const uint8_t* data, size_t data_size,
     WebPBitstreamFeatures* features) {
   return WebPGetFeaturesInternal(data, data_size, features,
                                  WEBP_DECODER_ABI_VERSION);
 }
 
 // Decoding options
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -865,17 +865,17 @@ def skia_includes(skia):
         ]
     return includes
 
 set_config('SKIA_INCLUDES', skia_includes)
 
 option('--with-system-webp',
        help='Use system libwebp (located with pkgconfig)')
 
-system_webp = pkg_check_modules('MOZ_WEBP', 'libwebp >= 1.0.1 libwebpdemux >= 1.0.1',
+system_webp = pkg_check_modules('MOZ_WEBP', 'libwebp >= 1.0.2 libwebpdemux >= 1.0.2',
                                 when='--with-system-webp')
 
 set_config('MOZ_SYSTEM_WEBP', depends(when=system_webp)(lambda: True))
 
 # Build Freetype in the tree
 # ==============================================================
 @depends(target, skia_pdf)
 def tree_freetype(target, skia_pdf):