From 2edda639b2c2b2000a78f560a9366a9f39b5e333 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 23 Nov 2017 23:58:22 -0800 Subject: [PATCH 01/10] README: add webpinfo section Change-Id: Iee4a4ecbe562d6154f627ba62524cd1871a06564 --- README | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README b/README index 05f2c16f..9a1cb982 100644 --- a/README +++ b/README @@ -113,8 +113,8 @@ make install CMake: ------ -With CMake, you can compile libwebp, cwebp, dwebp, gif2web, img2webp and the -JS bindings. +With CMake, you can compile libwebp, cwebp, dwebp, gif2web, img2webp, webpinfo +and the JS bindings. Prerequisites: A compiler (e.g., gcc with autotools) and CMake. @@ -367,6 +367,22 @@ Use following options to convert into alternate image formats: -quiet ....... quiet mode, don't print anything -noasm ....... disable all assembly optimizations +WebP file analysis tool: +======================== + +'webpinfo' can be used to print out the chunk level structure and bitstream +header information of WebP files. It can also check if the files are of valid +WebP format. + +Usage: webpinfo [options] in_files +Note: there could be multiple input files; + options must come before input files. +Options: + -quiet ............. Do not show chunk parsing information. + -diag .............. Show parsing error diagnosis. + -summary ........... Show chunk stats summary. + -bitstream_info .... Parse bitstream header. + Visualization tool: =================== From d3e261449392cfc3db99795feefddfd9e154e830 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 24 Nov 2017 00:14:18 -0800 Subject: [PATCH 02/10] update NEWS Change-Id: I66c8abe05b54558030a8555d80010506730ecbe9 --- NEWS | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NEWS b/NEWS index 3bf4bd05..85d273e0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ +- 11/24/2017: version 0.6.1 + This is a binary compatible release. + * lossless performance and compression improvements + a new 'cruncher' mode + (-m 6 -q 100) + * ARM performance improvements with clang (15-20% w/ndk r15c, issue #339) + * webp-js: emscripten/webassembly based javascript decoder + * miscellaneous bug & build fixes (issue #329, #332, #343, #353, #360, #361, + #363) + Tool updates / additions: + added webpinfo - prints file format information (issue #330) + gif2webp - loop behavior modified to match Chrome M63+ (crbug.com/649264); + '-loop_compatibility' can be used for the old behavior + - 1/26/2017: version 0.6.0 * lossless performance and compression improvements * miscellaneous performance improvements (SSE2, NEON, MSA) From 9add62b581d621e569b4e493a03228988c8cf3bb Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 24 Nov 2017 00:27:22 -0800 Subject: [PATCH 03/10] bump version to 0.6.1 libwebp{,decoder} - 0.6.1 libwebp libtool - 7.1.0 libwebpdecoder libtool - 3.1.0 mux - 0.4.1 libtool - 3.1.0 demux - 0.3.3 libtool - 2.3.0 Change-Id: If4a95c6e9829d4a608028ee9258b5c2b7af60c37 --- README | 2 +- README.mux | 2 +- configure.ac | 2 +- extras/extras.c | 2 +- src/Makefile.am | 4 ++-- src/dec/vp8i_dec.h | 2 +- src/demux/Makefile.am | 2 +- src/demux/demux.c | 2 +- src/demux/libwebpdemux.rc | 8 ++++---- src/enc/vp8i_enc.h | 2 +- src/libwebp.rc | 8 ++++---- src/libwebpdecoder.rc | 8 ++++---- src/mux/Makefile.am | 2 +- src/mux/libwebpmux.rc | 8 ++++---- src/mux/muxi.h | 2 +- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/README b/README index 9a1cb982..facd1751 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ \__\__/\____/\_____/__/ ____ ___ / _/ / \ \ / _ \/ _/ / \_/ / / \ \ __/ \__ - \____/____/\_____/_____/____/v0.6.0 + \____/____/\_____/_____/____/v0.6.1 Description: ============ diff --git a/README.mux b/README.mux index 04fedd16..c15d3a51 100644 --- a/README.mux +++ b/README.mux @@ -1,7 +1,7 @@  __ __ ____ ____ ____ __ __ _ __ __ / \\/ \/ _ \/ _ \/ _ \/ \ \/ \___/_ / _\ \ / __/ _ \ __/ / / (_/ /__ - \__\__/\_____/_____/__/ \__//_/\_____/__/___/v0.4.0 + \__\__/\_____/_____/__/ \__//_/\_____/__/___/v0.4.1 Description: diff --git a/configure.ac b/configure.ac index b327a795..58a4ef69 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libwebp], [0.6.0], +AC_INIT([libwebp], [0.6.1], [https://bugs.chromium.org/p/webp],, [http://developers.google.com/speed/webp]) AC_CANONICAL_HOST diff --git a/extras/extras.c b/extras/extras.c index a75dcd1e..d01aadbd 100644 --- a/extras/extras.c +++ b/extras/extras.c @@ -18,7 +18,7 @@ #define XTRA_MAJ_VERSION 0 #define XTRA_MIN_VERSION 1 -#define XTRA_REV_VERSION 0 +#define XTRA_REV_VERSION 1 //------------------------------------------------------------------------------ diff --git a/src/Makefile.am b/src/Makefile.am index 827cf1eb..7b5f26da 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ libwebp_la_LIBADD += utils/libwebputils.la # other than the ones listed on the command line, i.e., after linking, it will # not have unresolved symbols. Some platforms (Windows among them) require all # symbols in shared libraries to be resolved at library creation. -libwebp_la_LDFLAGS = -no-undefined -version-info 7:0:0 +libwebp_la_LDFLAGS = -no-undefined -version-info 7:1:0 libwebpincludedir = $(includedir)/webp pkgconfig_DATA = libwebp.pc @@ -48,7 +48,7 @@ if BUILD_LIBWEBPDECODER libwebpdecoder_la_LIBADD += dsp/libwebpdspdecode.la libwebpdecoder_la_LIBADD += utils/libwebputilsdecode.la - libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 3:0:0 + libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 3:1:0 pkgconfig_DATA += libwebpdecoder.pc endif diff --git a/src/dec/vp8i_dec.h b/src/dec/vp8i_dec.h index c95ecea3..28244d9d 100644 --- a/src/dec/vp8i_dec.h +++ b/src/dec/vp8i_dec.h @@ -32,7 +32,7 @@ extern "C" { // version numbers #define DEC_MAJ_VERSION 0 #define DEC_MIN_VERSION 6 -#define DEC_REV_VERSION 0 +#define DEC_REV_VERSION 1 // YUV-cache parameters. Cache is 32-bytes wide (= one cacheline). // Constraints are: We need to store one 16x16 block of luma samples (y), diff --git a/src/demux/Makefile.am b/src/demux/Makefile.am index 6a9e61b3..362c2afe 100644 --- a/src/demux/Makefile.am +++ b/src/demux/Makefile.am @@ -10,6 +10,6 @@ libwebpdemuxinclude_HEADERS += ../webp/mux_types.h libwebpdemuxinclude_HEADERS += ../webp/types.h libwebpdemux_la_LIBADD = ../libwebp.la -libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:2:0 +libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:3:0 libwebpdemuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpdemux.pc diff --git a/src/demux/demux.c b/src/demux/demux.c index dc75b851..79c24a5a 100644 --- a/src/demux/demux.c +++ b/src/demux/demux.c @@ -25,7 +25,7 @@ #define DMUX_MAJ_VERSION 0 #define DMUX_MIN_VERSION 3 -#define DMUX_REV_VERSION 2 +#define DMUX_REV_VERSION 3 typedef struct { size_t start_; // start location of the data diff --git a/src/demux/libwebpdemux.rc b/src/demux/libwebpdemux.rc index b9ab68b3..5a6994d2 100644 --- a/src/demux/libwebpdemux.rc +++ b/src/demux/libwebpdemux.rc @@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,3,0,2 - PRODUCTVERSION 0,3,0,2 + FILEVERSION 0,3,0,3 + PRODUCTVERSION 0,3,0,3 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpdemux DLL" - VALUE "FileVersion", "0.3.2" + VALUE "FileVersion", "0.3.3" VALUE "InternalName", "libwebpdemux.dll" VALUE "LegalCopyright", "Copyright (C) 2017" VALUE "OriginalFilename", "libwebpdemux.dll" VALUE "ProductName", "WebP Image Demuxer" - VALUE "ProductVersion", "0.3.2" + VALUE "ProductVersion", "0.3.3" END END BLOCK "VarFileInfo" diff --git a/src/enc/vp8i_enc.h b/src/enc/vp8i_enc.h index 7ab28b05..3463491e 100644 --- a/src/enc/vp8i_enc.h +++ b/src/enc/vp8i_enc.h @@ -32,7 +32,7 @@ extern "C" { // version numbers #define ENC_MAJ_VERSION 0 #define ENC_MIN_VERSION 6 -#define ENC_REV_VERSION 0 +#define ENC_REV_VERSION 1 enum { MAX_LF_LEVELS = 64, // Maximum loop filter level MAX_VARIABLE_LEVEL = 67, // last (inclusive) level with variable cost diff --git a/src/libwebp.rc b/src/libwebp.rc index cb9afed0..3a47fce2 100644 --- a/src/libwebp.rc +++ b/src/libwebp.rc @@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,6,0,0 - PRODUCTVERSION 0,6,0,0 + FILEVERSION 0,6,0,1 + PRODUCTVERSION 0,6,0,1 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebp DLL" - VALUE "FileVersion", "0.6.0" + VALUE "FileVersion", "0.6.1" VALUE "InternalName", "libwebp.dll" VALUE "LegalCopyright", "Copyright (C) 2017" VALUE "OriginalFilename", "libwebp.dll" VALUE "ProductName", "WebP Image Codec" - VALUE "ProductVersion", "0.6.0" + VALUE "ProductVersion", "0.6.1" END END BLOCK "VarFileInfo" diff --git a/src/libwebpdecoder.rc b/src/libwebpdecoder.rc index 3fdcbfaf..9fb0b447 100644 --- a/src/libwebpdecoder.rc +++ b/src/libwebpdecoder.rc @@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,6,0,0 - PRODUCTVERSION 0,6,0,0 + FILEVERSION 0,6,0,1 + PRODUCTVERSION 0,6,0,1 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpdecoder DLL" - VALUE "FileVersion", "0.6.0" + VALUE "FileVersion", "0.6.1" VALUE "InternalName", "libwebpdecoder.dll" VALUE "LegalCopyright", "Copyright (C) 2017" VALUE "OriginalFilename", "libwebpdecoder.dll" VALUE "ProductName", "WebP Image Decoder" - VALUE "ProductVersion", "0.6.0" + VALUE "ProductVersion", "0.6.1" END END BLOCK "VarFileInfo" diff --git a/src/mux/Makefile.am b/src/mux/Makefile.am index b5e82aff..374c1e7b 100644 --- a/src/mux/Makefile.am +++ b/src/mux/Makefile.am @@ -15,6 +15,6 @@ libwebpmuxinclude_HEADERS += ../webp/mux_types.h libwebpmuxinclude_HEADERS += ../webp/types.h libwebpmux_la_LIBADD = ../libwebp.la -libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:0:0 -lm +libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:1:0 -lm libwebpmuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpmux.pc diff --git a/src/mux/libwebpmux.rc b/src/mux/libwebpmux.rc index 7f9a33a0..a9d07e47 100644 --- a/src/mux/libwebpmux.rc +++ b/src/mux/libwebpmux.rc @@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,4,0,0 - PRODUCTVERSION 0,4,0,0 + FILEVERSION 0,4,0,1 + PRODUCTVERSION 0,4,0,1 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpmux DLL" - VALUE "FileVersion", "0.4.0" + VALUE "FileVersion", "0.4.1" VALUE "InternalName", "libwebpmux.dll" VALUE "LegalCopyright", "Copyright (C) 2017" VALUE "OriginalFilename", "libwebpmux.dll" VALUE "ProductName", "WebP Image Muxer" - VALUE "ProductVersion", "0.4.0" + VALUE "ProductVersion", "0.4.1" END END BLOCK "VarFileInfo" diff --git a/src/mux/muxi.h b/src/mux/muxi.h index 7aa87967..b73e3fbd 100644 --- a/src/mux/muxi.h +++ b/src/mux/muxi.h @@ -28,7 +28,7 @@ extern "C" { #define MUX_MAJ_VERSION 0 #define MUX_MIN_VERSION 4 -#define MUX_REV_VERSION 0 +#define MUX_REV_VERSION 1 // Chunk object. typedef struct WebPChunk WebPChunk; From 126be109500c7b6a17a234bcf284b217d594fa75 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 24 Nov 2017 14:17:51 -0800 Subject: [PATCH 04/10] webpinfo: add -version option Change-Id: I5861d5ccd2119dd6749dc70b65fd145b5a732f98 --- README | 1 + examples/webpinfo.c | 6 ++++++ man/webpinfo.1 | 13 ++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README b/README index facd1751..e9817bfc 100644 --- a/README +++ b/README @@ -378,6 +378,7 @@ Usage: webpinfo [options] in_files Note: there could be multiple input files; options must come before input files. Options: + -version ........... Print version number and exit. -quiet ............. Do not show chunk parsing information. -diag .............. Show parsing error diagnosis. -summary ........... Show chunk stats summary. diff --git a/examples/webpinfo.c b/examples/webpinfo.c index 4b6d78c7..cc6a70f4 100644 --- a/examples/webpinfo.c +++ b/examples/webpinfo.c @@ -1106,6 +1106,7 @@ static void HelpLong(void) { "Note: there could be multiple input files;\n" " options must come before input files.\n" "Options:\n" + " -version ........... Print version number and exit.\n" " -quiet ............. Do not show chunk parsing information.\n" " -diag .............. Show parsing error diagnosis.\n" " -summary ........... Show chunk stats summary.\n" @@ -1139,6 +1140,11 @@ int main(int argc, const char* argv[]) { show_summary = 1; } else if (!strcmp(argv[c], "-bitstream_info")) { parse_bitstream = 1; + } else if (!strcmp(argv[c], "-version")) { + const int version = WebPGetDecoderVersion(); + printf("WebP Decoder version: %d.%d.%d\n", + (version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff); + return 0; } else { // Assume the remaining are all input files. break; } diff --git a/man/webpinfo.1 b/man/webpinfo.1 index b2737591..902ba9e0 100644 --- a/man/webpinfo.1 +++ b/man/webpinfo.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH WEBPINFO 1 "May 08, 2017" +.TH WEBPINFO 1 "November 24, 2017" .SH NAME webpinfo \- print out the chunk level structure of WebP files along with basic integrity checks. @@ -22,16 +22,19 @@ WebP format. .SH OPTIONS .TP -.B -quiet +.B \-version +Print the version number (as major.minor.revision) and exit. +.TP +.B \-quiet Do not show chunk parsing information. .TP -.B -diag +.B \-diag Show parsing error diagnosis. .TP -.B -summary +.B \-summary Show chunk stats summary. .TP -.BI -bitstream_info +.BI \-bitstream_info Parse bitstream header. .TP .B \-h, \-help From 1b27bf8b76fb4914ae8b5f3e5147db2cfb8fec26 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Fri, 24 Nov 2017 00:13:27 -0800 Subject: [PATCH 05/10] WEBP_REDUCE_SIZE: disable all rescaler code BUG=webp:355 Change-Id: Id87cb11902e3fb8544a214308526ea9665ce8440 (cherry picked from commit 0df22b9eed70f51029648de5218a9b576a72ba54) --- src/dec/buffer_dec.c | 5 +++++ src/dec/io_dec.c | 7 +++++++ src/dec/vp8l_dec.c | 18 +++++++++++++++++- src/dsp/rescaler.c | 4 ++-- src/dsp/rescaler_mips32.c | 2 +- src/dsp/rescaler_mips_dsp_r2.c | 2 +- src/dsp/rescaler_msa.c | 2 +- src/dsp/rescaler_neon.c | 2 +- src/dsp/rescaler_sse2.c | 2 +- 9 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/dec/buffer_dec.c b/src/dec/buffer_dec.c index 5fea4021..75eb3c40 100644 --- a/src/dec/buffer_dec.c +++ b/src/dec/buffer_dec.c @@ -194,7 +194,9 @@ VP8StatusCode WebPAllocateDecBuffer(int width, int height, width = cw; height = ch; } + if (options->use_scaling) { +#if !defined(WEBP_REDUCE_SIZE) int scaled_width = options->scaled_width; int scaled_height = options->scaled_height; if (!WebPRescalerGetScaledDimensions( @@ -203,6 +205,9 @@ VP8StatusCode WebPAllocateDecBuffer(int width, int height, } width = scaled_width; height = scaled_height; +#else + return VP8_STATUS_INVALID_PARAM; // rescaling not supported +#endif } } buffer->width = width; diff --git a/src/dec/io_dec.c b/src/dec/io_dec.c index 576c12d4..e603f19c 100644 --- a/src/dec/io_dec.c +++ b/src/dec/io_dec.c @@ -241,6 +241,7 @@ static int EmitAlphaRGBA4444(const VP8Io* const io, WebPDecParams* const p, //------------------------------------------------------------------------------ // YUV rescaling (no final RGB conversion needed) +#if !defined(WEBP_REDUCE_SIZE) static int Rescale(const uint8_t* src, int src_stride, int new_lines, WebPRescaler* const wrk) { int num_lines_out = 0; @@ -541,6 +542,8 @@ static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) { return 1; } +#endif // WEBP_REDUCE_SIZE + //------------------------------------------------------------------------------ // Default custom functions @@ -561,10 +564,14 @@ static int CustomSetup(VP8Io* io) { WebPInitUpsamplers(); } if (io->use_scaling) { +#if !defined(WEBP_REDUCE_SIZE) const int ok = is_rgb ? InitRGBRescaler(io, p) : InitYUVRescaler(io, p); if (!ok) { return 0; // memory error } +#else + return 0; // rescaling support not compiled +#endif } else { if (is_rgb) { WebPInitSamplers(); diff --git a/src/dec/vp8l_dec.c b/src/dec/vp8l_dec.c index b3ffcbda..42ea3b5e 100644 --- a/src/dec/vp8l_dec.c +++ b/src/dec/vp8l_dec.c @@ -485,6 +485,7 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize, //------------------------------------------------------------------------------ // Scaling. +#if !defined(WEBP_REDUCE_SIZE) static int AllocateAndInitRescaler(VP8LDecoder* const dec, VP8Io* const io) { const int num_channels = 4; const int in_width = io->mb_w; @@ -516,10 +517,13 @@ static int AllocateAndInitRescaler(VP8LDecoder* const dec, VP8Io* const io) { out_width, out_height, 0, num_channels, work); return 1; } +#endif // WEBP_REDUCE_SIZE //------------------------------------------------------------------------------ // Export to ARGB +#if !defined(WEBP_REDUCE_SIZE) + // We have special "export" function since we need to convert from BGRA static int Export(WebPRescaler* const rescaler, WEBP_CSP_MODE colorspace, int rgba_stride, uint8_t* const rgba) { @@ -561,6 +565,8 @@ static int EmitRescaledRowsRGBA(const VP8LDecoder* const dec, return num_lines_out; } +#endif // WEBP_REDUCE_SIZE + // Emit rows without any scaling. static int EmitRows(WEBP_CSP_MODE colorspace, const uint8_t* row_in, int in_stride, @@ -746,9 +752,12 @@ static void ProcessRows(VP8LDecoder* const dec, int row) { if (WebPIsRGBMode(output->colorspace)) { // convert to RGBA const WebPRGBABuffer* const buf = &output->u.RGBA; uint8_t* const rgba = buf->rgba + dec->last_out_row_ * buf->stride; - const int num_rows_out = io->use_scaling ? + const int num_rows_out = +#if !defined(WEBP_REDUCE_SIZE) + io->use_scaling ? EmitRescaledRowsRGBA(dec, rows_data, in_stride, io->mb_h, rgba, buf->stride) : +#endif // WEBP_REDUCE_SIZE EmitRows(output->colorspace, rows_data, in_stride, io->mb_w, io->mb_h, rgba, buf->stride); // Update 'last_out_row_'. @@ -1632,12 +1641,19 @@ int VP8LDecodeImage(VP8LDecoder* const dec) { if (!AllocateInternalBuffers32b(dec, io->width)) goto Err; +#if !defined(WEBP_REDUCE_SIZE) if (io->use_scaling && !AllocateAndInitRescaler(dec, io)) goto Err; if (io->use_scaling || WebPIsPremultipliedMode(dec->output_->colorspace)) { // need the alpha-multiply functions for premultiplied output or rescaling WebPInitAlphaProcessing(); } +#else + if (io->use_scaling) { + dec->status_ = VP8_STATUS_INVALID_PARAM; + goto Err; + } +#endif if (!WebPIsRGBMode(dec->output_->colorspace)) { WebPInitConvertARGBToYUV(); if (dec->output_->u.YUVA.a != NULL) WebPInitAlphaProcessing(); diff --git a/src/dsp/rescaler.c b/src/dsp/rescaler.c index dc61325b..4b6b7834 100644 --- a/src/dsp/rescaler.c +++ b/src/dsp/rescaler.c @@ -209,7 +209,7 @@ static volatile VP8CPUInfo rescaler_last_cpuinfo_used = WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) { if (rescaler_last_cpuinfo_used == VP8GetCPUInfo) return; - +#if !defined(WEBP_REDUCE_SIZE) #if !WEBP_NEON_OMIT_C_CODE WebPRescalerExportRowExpand = WebPRescalerExportRowExpand_C; WebPRescalerExportRowShrink = WebPRescalerExportRowShrink_C; @@ -252,6 +252,6 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) { assert(WebPRescalerExportRowShrink != NULL); assert(WebPRescalerImportRowExpand != NULL); assert(WebPRescalerImportRowShrink != NULL); - +#endif // WEBP_REDUCE_SIZE rescaler_last_cpuinfo_used = VP8GetCPUInfo; } diff --git a/src/dsp/rescaler_mips32.c b/src/dsp/rescaler_mips32.c index 17014fc8..542f7e59 100644 --- a/src/dsp/rescaler_mips32.c +++ b/src/dsp/rescaler_mips32.c @@ -13,7 +13,7 @@ #include "src/dsp/dsp.h" -#if defined(WEBP_USE_MIPS32) +#if defined(WEBP_USE_MIPS32) && !defined(WEBP_REDUCE_SIZE) #include #include "src/utils/rescaler_utils.h" diff --git a/src/dsp/rescaler_mips_dsp_r2.c b/src/dsp/rescaler_mips_dsp_r2.c index 3a02f9b0..b78aac15 100644 --- a/src/dsp/rescaler_mips_dsp_r2.c +++ b/src/dsp/rescaler_mips_dsp_r2.c @@ -13,7 +13,7 @@ #include "src/dsp/dsp.h" -#if defined(WEBP_USE_MIPS_DSP_R2) +#if defined(WEBP_USE_MIPS_DSP_R2) && !defined(WEBP_REDUCE_SIZE) #include #include "src/utils/rescaler_utils.h" diff --git a/src/dsp/rescaler_msa.c b/src/dsp/rescaler_msa.c index b33c6bcb..f3bc99f1 100644 --- a/src/dsp/rescaler_msa.c +++ b/src/dsp/rescaler_msa.c @@ -13,7 +13,7 @@ #include "src/dsp/dsp.h" -#if defined(WEBP_USE_MSA) +#if defined(WEBP_USE_MSA) && !defined(WEBP_REDUCE_SIZE) #include diff --git a/src/dsp/rescaler_neon.c b/src/dsp/rescaler_neon.c index ab443f6f..3eff9fba 100644 --- a/src/dsp/rescaler_neon.c +++ b/src/dsp/rescaler_neon.c @@ -13,7 +13,7 @@ #include "src/dsp/dsp.h" -#if defined(WEBP_USE_NEON) +#if defined(WEBP_USE_NEON) && !defined(WEBP_REDUCE_SIZE) #include #include diff --git a/src/dsp/rescaler_sse2.c b/src/dsp/rescaler_sse2.c index 7bbcd0ff..f93b204f 100644 --- a/src/dsp/rescaler_sse2.c +++ b/src/dsp/rescaler_sse2.c @@ -13,7 +13,7 @@ #include "src/dsp/dsp.h" -#if defined(WEBP_USE_SSE2) +#if defined(WEBP_USE_SSE2) && !defined(WEBP_REDUCE_SIZE) #include #include From 0d4466c2b44384ac30836407ec373b4958717203 Mon Sep 17 00:00:00 2001 From: James Zern Date: Sat, 25 Nov 2017 13:52:03 -0800 Subject: [PATCH 06/10] webp_to_sdl.c: fix file mode Change-Id: I1ca8506d40a60cd6db7f6f0d63a4431848bb0ea9 --- extras/webp_to_sdl.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 extras/webp_to_sdl.c diff --git a/extras/webp_to_sdl.c b/extras/webp_to_sdl.c old mode 100755 new mode 100644 From c10a493cafd2c0f7cb4ad9d5bf183ff7cc126cfa Mon Sep 17 00:00:00 2001 From: James Zern Date: Sat, 25 Nov 2017 18:21:44 -0800 Subject: [PATCH 07/10] vwebp: disable double buffering on windows & mac this results in flickering with animated webp + alpha. disabling the option is a workaround to restore the behavior to the previous release. BUG=webp:365 Change-Id: Iac7fcc0d483837e76cc54ad3f26c4e0e5511e31d --- examples/vwebp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/vwebp.c b/examples/vwebp.c index 6376e563..b19465cd 100644 --- a/examples/vwebp.c +++ b/examples/vwebp.c @@ -378,13 +378,23 @@ static void HandleDisplay(void) { } } glPopMatrix(); +#if defined(__APPLE__) || defined(_WIN32) + glFlush(); +#else glutSwapBuffers(); +#endif } static void StartDisplay(void) { const int width = kParams.canvas_width; const int height = kParams.canvas_height; + // TODO(webp:365) GLUT_DOUBLE results in flickering / old frames to be + // partially displayed with animated webp + alpha. +#if defined(__APPLE__) || defined(_WIN32) + glutInitDisplayMode(GLUT_RGBA); +#else glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); +#endif glutInitWindowSize(width, height); glutCreateWindow("WebP viewer"); glutDisplayFunc(HandleDisplay); From a289d8e774f6c4dabb5d6ae7884d0cfaaaf8ce25 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 24 Nov 2017 13:36:03 -0800 Subject: [PATCH 08/10] update ChangeLog Change-Id: Ia1e4669e6270faa6daae6306f47baa31488f119d --- ChangeLog | 283 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7ac7b5f8..1a5fbc30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,292 @@ +c10a493c vwebp: disable double buffering on windows & mac +0d4466c2 webp_to_sdl.c: fix file mode +1b27bf8b WEBP_REDUCE_SIZE: disable all rescaler code +126be109 webpinfo: add -version option +9add62b5 bump version to 0.6.1 +d3e26144 update NEWS +2edda639 README: add webpinfo section +9ca568ef Merge "right-size some tables" +31f1995c Merge "SSE2 implementation of HasAlphaXXX" +a80c46bd SSE2 implementation of HasAlphaXXX +083507f2 right-size some tables +2e5785b2 anim_utils.c: remove warning when !defined(WEBP_HAVE_GIF) +b299c47e add WEBP_REDUCE_SIZE +f593d71a enc: disable pic->stats/extra_info w/WEBP_DISABLE_STATS +541179a9 Merge "predictor_enc: fix build w/--disable-near-lossless" +5755a7ec predictor_enc: fix build w/--disable-near-lossless +eab5bab7 add WEBP_DISABLE_STATS +8052c585 remove some petty TODOs from vwebp. +c245343d move LOAD8x4 and STORE8x2 closer to their use location +b9e734fd dec,cosmetics: normalize function naming style +c188d546 dec: harmonize function suffixes +28c5ac81 dec_sse41: harmonize function suffixes +e65b72a3 Merge "introduce WebPHasAlpha8b and WebPHasAlpha32b" +b94cee98 dec_sse2: remove HE8uv_SSE2 +44a0ee3f introduce WebPHasAlpha8b and WebPHasAlpha32b +aebf59ac Merge "WebPPictureAllocARGB: align argb allocation" +c184665e WebPPictureAllocARGB: align argb allocation +3daf7509 WebPParseHeaders: remove obsolete animation TODO +80285d97 cmake: avoid security warnings under msvc +650eac55 cmake: don't set -Wall with MSVC +c462cd00 Remove useless code. +01a98217 Merge "remove WebPWorkerImpl declaration from the header" +3c49fc47 Merge "thread_utils: fix potentially bad call to Execute" +fde2782e thread_utils: fix potentially bad call to Execute +2a270c1d remove WebPWorkerImpl declaration from the header +f1f437cc remove mention of 'lossy-only parameters' from the doc +3879074d Merge "WebPMemToUint32: remove ptr cast to int" +04b029d2 WebPMemToUint32: remove ptr cast to int +b7971d0e dsp: avoid defining _C functions w/NEON builds +6ba98764 webpdec: correct alloc size check w/use_argb +5cfb3b0f normalize include guards +f433205e Merge changes Ia17c7dfc,I75423abb,Ia2f716b4,I161caa14,I4210081a, ... +8d033b14 {dec,enc}_neon: harmonize function suffixes x2 +0295e981 upsampling_neon: harmonize function suffixes +d572c4e5 yuv_neon: harmonize function suffixes +ab9c2500 rescaler_neon: harmonize function suffixes +93e0ce27 lossless_neon: harmonize function suffixes +22fbc50e lossless_enc_neon: harmonize function suffixes +447875b4 filters_neon,cosmetics: fix indent +e51bdd43 remove unused VP8TokenToStats() function +785da7ea enc_neon: harmonize function suffixes +bc1a251f dec_neon: harmonize function suffixes +61e535f1 dsp/lossless: workaround gcc-4.8 bug on arm +68b2eab7 cwebp: fix alpha reporting w/lossless & metadata +30042faa WebPDemuxGetI: add doc details around WebPFormatFeature +0a17f471 Merge "WIP: list includes as descendants of the project dir" +a4399721 WIP: list includes as descendants of the project dir +08275708 Merge "Make sure we reach the full range for alpha blending." +d361a6a7 yuv_sse2: harmonize function suffixes +6921aa6f upsampling_sse2: harmonize function suffixes +08c67d3e ssim_sse2: harmonize function suffixes +582a1b57 rescaler_sse2: harmonize function suffixes +2c1b18ba lossless_sse2: harmonize function suffixes +0ac46e81 lossless_enc_sse2: harmonize function suffixes +bc634d57 enc_sse2: harmonize function suffixes +bcb7347c dec_sse2: harmonize function suffixes +e14ad93c Make sure we reach the full range for alpha blending. +7038ca8d demux,StoreFrame: restore hdr size check to min req +fb3daad6 cpu: fix ssse3 check +be590e06 Merge "Fix CMake redefinition for HAVE_CPU_FEATURES_H" +35f736e1 Fix CMake redefinition for HAVE_CPU_FEATURES_H +a5216efc Fix integer overflow warning. +a9c8916b decode.h,WebPIDecGetRGB: clarify output ptr validity +3c74c645 gif2webp: handle 1-frame case properly + fix anim_diff +c7f295d3 Merge "gif2webp: introduce -loop_compatibility option" +b4e04677 gif2webp: introduce -loop_compatibility option +f78da3de add LOCAL_CLANG_PREREQ and avoid WORK_AROUND_GCC w/3.8+ +01c426f1 define WEBP_USE_INTRINSICS w/gcc-4.9+ +8635973d use sdl-config (if available) to determine the link flags +e9459382 use CPPFLAGS before CFLAGS +4a9d788e Merge "Android.mk,mips: fix clang build with r15" +4fbdc9fb Android.mk,mips: fix clang build with r15 +a80fcc4a ifdef code not used by Chrome/Android. +3993af12 Fix signed integer overflows. +f66f94ef anim_dump: small tool to dump frames from animated WebP +6eba857b Merge "rationalize the Makefile.am" +c5e34fba function definition cleanup +3822762a rationalize the Makefile.am +501ef6e4 configure style fix: animdiff -> anim_diff +f8bdc268 Merge "protect against NULL dump_folder[] value in ReadAnimatedImage()" +23bfc652 protect against NULL dump_folder[] value in ReadAnimatedImage() +8dc3d71b cosmetics,ReadAnimatedWebP: correct function comment +5bd40066 Merge changes I66a64a0a,I4d2e520f +7945575c cosmetics,webpinfo: remove an else after a return +8729fa11 cosmetics,cwebp: remove an else after a return +f324b7f9 cosmetics: normalize fn proto & decl param names +869eb369 CMake cleanups. +289e62a3 Remove declaration of unimplemented VP8ApplyNearLosslessPredict +20a94186 pnmdec,PAM: validate depth before calculating bytes_per_px +34130afe anim_encode: fix integer overflow +42c79aa6 Merge "Encoder: harmonize function suffixes" +b09307dc Encoder: harmonize function suffixes +bed0456d Merge "SSIM: harmonize the function suffix" +54f6a3cf lossless_sse2.c: fix some missed suffix changes +088f1dcc SSIM: harmonize the function suffix +86fc4dd9 webpdec: use ImgIoUtilCheckSizeArgumentsOverflow +08ea9ecd imageio: add ability restrict max image size +6f9daa4a jpegdec,ReadError: fix leaks on error +a0f72a4f VP8LTransformColorFunc: drop an non-respected 'const' from the signature. +8c934902 Merge "Lossess dec: harmonize the function suffixes" +622242aa Lossess dec: harmonize the function suffixes +1411f027 Lossless Enc: harmonize the function suffixes +24ad2e3c add const to two variables +46efe062 Merge "Allow the lossless cruncher to work for alpha." +8c3f9a47 Speed-up LZ77. +1aef4c71 Allow the lossless cruncher to work for alpha. +b8821dbd Improve the box LZ77 speed. +7beed280 add missing ()s to macro parameters +6473d20b Merge "fix Android standalone toolchain build" +dcefed95 Merge "build.gradle: fix arm64 build" +0c83a8bc Merge "yuv: harmonize suffix naming" +c6d1db4b fix Android standalone toolchain build +663a6d9d unify the ALTERNATE_CODE flag usage +73ea9f27 yuv: harmonize suffix naming +c71b68ac build.gradle: fix arm64 build +c4568b47 Rescaler: harmonize the suffix naming +6cb13b05 Merge "alpha_processing: harmonize the naming suffixes to be _C()" +83a3e69a Merge "simplify WEBP_EXTERN macro" +7295fde2 Merge "filters: harmonize the suffixes naming to _SSE2(), _C(), etc." +8e42ba4c simplify WEBP_EXTERN macro +331ab34b cost*.c: harmonize the suffix namings +b161f670 filters: harmonize the suffixes naming to _SSE2(), _C(), etc. +dec5e4d3 alpha_processing: harmonize the naming suffixes to be _C() +6878d427 fix memory leak in SDL_Init() +461ae555 Merge "configure: fix warnings in sdl check" +62486a22 configure: test for -Wundef +92982609 dsp.h: fix -Wundef w/__mips_dsp_rev +0265cede configure: fix warnings in sdl check +88c73d8a backward_references_enc.h: fix WINDOW_SIZE_BITS check +4ea49f6b rescaler_sse2.c: fix WEBP_RESCALER_FIX -> _RFIX typo +1b526638 Clean-up some CMake +87f57a4b Merge "cmake: fix gif lib detection when cross compiling" +b34a9db1 cosmetics,dec_sse2: remove some redundant comments +471c5755 cmake: fix gif lib detection when cross compiling +c793417a cmake: disable gif2webp if gif lib isn't found +dcbc1c88 cmake: split gif detection from IMG deps +66ad84f0 Merge "muxread: remove unreachable code" +50ec3ab7 muxread: remove unreachable code +7d67a164 Lossy encoding: smoothen transparent areas to improve compression +e50650c7 Merge "fix signature for DISABLE_TOKEN_BUFFER compilation" +671d2567 fix signature for DISABLE_TOKEN_BUFFER compilation +d6755580 cpu.cmake: use unique flag to test simd disable flags +28914528 Merge "Remove the argb* files." +8acb4942 Remove the argb* files. +3b62347b README: correct cmake invocation note +7ca0df13 Have the SSE2 version of PackARGB use common code. +7b250459 Merge "Re-use the transformed image when trying several LZ77 in lossless." +e132072f Re-use the transformed image when trying several LZ77 in lossless. +5d7a50ef Get code to compile in C++. +7b012987 configure: test for -Wparentheses-equality +f0569adb Fix man pages for multi-threading. +f1d5a397 multithread cruncher: only copy stats when picture->stats != NULL +f8c2ac15 Multi-thread the lossless cruncher. +a88c6522 Merge "Integrate a new LZ77 looking for matches in the neighborhood of a pixel only." +8f6df1d0 Unroll Predictors 10, 11 and 12. +355c3d1b Integrate a new LZ77 looking for matches in the neighborhood of a pixel only. +a1779a01 Refactor LZ77 handling in preparation for a new method. +67de68b5 Android.mk/build.gradle: fix mips build with clang from r14b +f209a548 Use the plane code and not the distance when computing statistics. +b903b80c Split cost-based backward references in its own file. +498cad34 Cosmetic changes in backward reference. +e4eb4587 lossless, VP8LTransformColor_C: make sure no overflow happens with colors. +af6deaff webpinfo: handle alpha flag mismatch +7caef29b Fix typo that creeped in. +39e19f92 Merge "near lossless: fix unsigned int overflow warnings." +9bbc0891 near lossless: fix unsigned int overflow warnings. +e1118d62 Merge "cosmetics,FindClosestDiscretized: use uint in mask creation" +186bc9b7 Merge "webpinfo: tolerate ALPH+VP8L" +b5887297 cosmetics,FindClosestDiscretized: use uint in mask creation +f1784aee near_lossless,FindClosestDiscretized: use unsigned ops +0d20abb3 webpinfo: tolerate ALPH+VP8L +972104b3 webpmux: tolerate false positive Alpha flag +dd7e83cc tiffdec,ReadTIFF: ensure data_size is < tsize_t max +d988eb7b tiffdec,MyRead: quiet -Wshorten-64-to-32 warning +dabda707 webpinfo: add support to parse Alpha bitstream +4c117643 webpinfo: correct background color output, BGRA->ARGB +defc98d7 Doc: clarify the role of quality in WebPConfig. +d78ff780 Merge "Fix code to compile with C++." +c8f14093 Fix code to compile with C++. +497dc6a7 pnmdec: sanitize invalid header output +d78e5867 Merge "configure: test for -Wconstant-conversion" +481e91eb Merge "pnmdec,PAM: set bytes_per_px based on depth when missing" +93b12753 configure: test for -Wconstant-conversion +645f0c53 pnmdec,PAM: set bytes_per_px based on depth when missing +e9154605 Merge "vwebp: activate GLUT double-buffering" +818d795b vwebp: activate GLUT double-buffering +d63e6f4b Add a man page for webpinfo +4d708435 Merge "NEON: implement ConvertRGB24ToY/BGR24/ARGB/RGBA32ToUV/ARGBToUV" +faf42213 NEON: implement ConvertRGB24ToY/BGR24/ARGB/RGBA32ToUV/ARGBToUV +b4d576fa Install man pages with CMake. +cbc1b921 webpinfo: add features to parse bitstream header +e644c556 Fix bad bit writer initialization. +b62cdad2 Merge "Implement a cruncher for lossless at method 6." +da3e4dfb use the exact constant for the gamma transfer function +a9c701e0 Merge "tiffdec: fix EXTRASAMPLES check" +adab8ce0 Implement a cruncher for lossless at method 6. +1b92b237 Merge "Fix VP8ApplyNearLossless to respect const and stride." +1923ff02 tiffdec: fix EXTRASAMPLES check +97cce5ba tiffdec: only request EXTRASAMPLES w/> 3 samples/px +0dcd85b6 Fix VP8ApplyNearLossless to respect const and stride. +f7682189 yuv: rationalize the C/SSE2 function naming +52245424 NEON implementation of some Sharp-YUV420 functions +690efd82 Avoid several backward reference copies. +4bb1f607 src/dec/vp8_dec.h, cosmetics: fix comments +285748be cmake: build/install webpinfo +78fd199c backward_references_enc.c: clear -Wshadow warnings +ae836410 WebPLog2FloorC: clear -Wshadow warning +d0b7404e Merge "WASM support" +134e314f WASM support +c08adb6f Merge "VP8LEnc: remove use of BitsLog2Ceiling()" +28c37ebd VP8LEnc: remove use of BitsLog2Ceiling() +2cb58ab2 webpinfo: output format as a human readable string +bb175a93 Merge "rename some symbols clashing with MSVC headers" +39eda658 Remove a duplicated pixel hash implementation. +36b8274d rename some symbols clashing with MSVC headers +274daf54 Add webpinfo tool. +ec5036e4 add explicit reference to /usr/local/{lib,inc} +18f0dfac Merge "fix TIFF encoder regarding rgbA/RGBA" +4e2b0b50 Merge "webpdec.h: fix a doc typo" +e2eeabff Merge "Install binaries, libraries and headers in CMake." +836607e6 webpdec.h: fix a doc typo +9273e441 fix TIFF encoder regarding rgbA/RGBA +17e3c11f Add limited PAM decoding support +5f624871 Install binaries, libraries and headers in CMake. +976adac1 Merge "lossless incremental decoding: fix missing eos_ test" +f8fad4fa lossless incremental decoding: fix missing eos_ test +27415d41 Merge "vwebp_sdl: fix the makefile.unix" +49566182 Merge "ImgIoUtilWriteFile(): use ImgIoUtilSetBinaryMode" +6f75a51b Analyze the transform entropy on the whole image. +a5e4e3af Use palette only if we can in entropy analysis. +75a9c3c4 Improve compression by better entropy analysis. +39cf6f4f vwebp_sdl: fix the makefile.unix +699b0416 ImgIoUtilWriteFile(): use ImgIoUtilSetBinaryMode +7d985bd1 Fix small entropy analysis bug. +6e7caf06 Optimize the color cache size. +833c9219 More efficient stochastic histogram merge. +5183326b Refactor the greedy histogram merge. +99f6f462 Merge "histogram_enc.c,MyRand: s/ul/u/ for unsigned constants" +80a22186 ssim.c: remove dead include +a128dfff histogram_enc.c,MyRand: s/ul/u/ for unsigned constants +693bf74e move the SSIM calculation code in ssim.c / ssim_sse2.c +10d791ca Merge "Fix the random generator in HistogramCombineStochastic." +fa63a966 Fix the random generator in HistogramCombineStochastic. +16be192f VP8LSetBitPos: remove the eos_ setting +027151ca don't erase the surface before blitting. +4105d565 disable WEBP_USE_XXX optimisations when EMSCRIPTEN is defined +9ee32a75 Merge "WebP-JS: emscripten-based Javascript decoder" +ca9f7b7d WebP-JS: emscripten-based Javascript decoder +868aa690 Perform greedy histogram merge in a unified way. +5b393f2d Merge "fix path typo for vwebp_sdl in Makefile.vc" +e0012bea CMake: only use libwebpdecoder for building dwebp +84c2a7b0 fix path typo for vwebp_sdl in Makefile.vc +1b0e4abf Merge "Add a flag to disable SIMD optimizations." +32263250 Add a flag to disable SIMD optimizations. +b494fdec optimize the ARGB->ARGB Import to use memcpy +f1536039 Merge "ReadWebP: decode directly into a pre-allocated buffer" +e69ed291 ReadWebP: decode directly into a pre-allocated buffer +57d8de8a Merge "vwebp_sdl: simple viewer based on SDL" +5cfd4ebc LZ77 interval speedups. Faster, smaller, simpler. +1e7ad88b PNM header decoder: add some basic numerical validation +17c7890c Merge "Add a decoder only library for WebP in CMake." +be733786 Merge "Add clang build fix for MSA" +03cda0e4 Add a decoder only library for WebP in CMake. +aa893914 Add clang build fix for MSA +31a92e97 Merge "imageio: add limited PNM support for reading" +dcf9d82a imageio: add limited PNM support for reading +6524fcd6 vwebp_sdl: simple viewer based on SDL +6cf24a24 get_disto: fix reference file read +43d472aa Merge tag 'v0.6.0' +50d1a848 update ChangeLog (tag: v0.6.0, origin/0.6.0, 0.6.0) 20a7fea0 extras/Makefile.am: fix libwebpextras.la reference 415f3ffe update ChangeLog (tag: v0.6.0-rc3) 3c6d1224 update NEWS ee4a4141 update AUTHORS 32ed856f Fix "all|no frames are keyframes" settings. +1c3190b6 Merge "Fix "all|no frames are keyframes" settings." f4dc56fd disable GradientUnfilter_NEON +4f3e3bbd disable GradientUnfilter_NEON +2dc0bdca Fix "all|no frames are keyframes" settings. 0d8e0588 img2webp: treat -loop as a no-op w/single images b0450139 ReadImage(): restore size reporting 0ad3b4ef update ChangeLog (tag: v0.6.0-rc2) From f66955de5f1bd47f2ffcde3975e8533e24961bd9 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Wed, 22 Nov 2017 23:51:19 -0800 Subject: [PATCH 09/10] WEBP_REDUCE_CSP: restrict colorspace support only supported ones are: RGBA/BGRA/rgbA/bgrA (decoder) as well as: WebPPictureImportRGB/RGBX/RGBA (encoder). (note: extras/get_disto is affected too) Change-Id: If6c4f95054ca15759c4e289fb3b4c352b3521c2c (cherry picked from commit 6de20df02c63b88f408f4b6f52830db339dfdd04) --- extras/get_disto.c | 7 ++++ src/dsp/upsampling.c | 69 +++++++++++++++++++++++++------- src/dsp/upsampling_mips_dsp_r2.c | 36 +++++++++++------ src/dsp/upsampling_msa.c | 14 ++++--- src/dsp/upsampling_neon.c | 14 ++++--- src/dsp/upsampling_sse2.c | 23 +++++++---- src/enc/picture_csp_enc.c | 43 +++++++++++--------- src/enc/picture_enc.c | 8 +++- 8 files changed, 150 insertions(+), 64 deletions(-) diff --git a/extras/get_disto.c b/extras/get_disto.c index 7deb832f..1d45af7f 100644 --- a/extras/get_disto.c +++ b/extras/get_disto.c @@ -322,6 +322,7 @@ int main(int argc, const char *argv[]) { fprintf(stderr, "Can only compute the difference map in ARGB format.\n"); goto End; } +#if !defined(WEBP_REDUCE_CSP) data_size = WebPEncodeLosslessBGRA((const uint8_t*)pic1.argb, pic1.width, pic1.height, pic1.argb_stride * 4, @@ -333,6 +334,12 @@ int main(int argc, const char *argv[]) { ret = ImgIoUtilWriteFile(output, data, data_size) ? 0 : 1; WebPFree(data); if (ret) goto End; +#else + (void)data; + (void)data_size; + fprintf(stderr, "Cannot save the difference map. Please recompile " + "without the WEBP_REDUCE_CSP flag.\n"); +#endif // WEBP_REDUCE_CSP } ret = 0; diff --git a/src/dsp/upsampling.c b/src/dsp/upsampling.c index a6cfc7fe..e72626a8 100644 --- a/src/dsp/upsampling.c +++ b/src/dsp/upsampling.c @@ -94,13 +94,37 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ // All variants implemented. #if !WEBP_NEON_OMIT_C_CODE -UPSAMPLE_FUNC(UpsampleRgbLinePair_C, VP8YuvToRgb, 3) -UPSAMPLE_FUNC(UpsampleBgrLinePair_C, VP8YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleRgbaLinePair_C, VP8YuvToRgba, 4) UPSAMPLE_FUNC(UpsampleBgraLinePair_C, VP8YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) UPSAMPLE_FUNC(UpsampleArgbLinePair_C, VP8YuvToArgb, 4) +UPSAMPLE_FUNC(UpsampleRgbLinePair_C, VP8YuvToRgb, 3) +UPSAMPLE_FUNC(UpsampleBgrLinePair_C, VP8YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleRgba4444LinePair_C, VP8YuvToRgba4444, 2) UPSAMPLE_FUNC(UpsampleRgb565LinePair_C, VP8YuvToRgb565, 2) +#else +static void EmptyUpsampleFunc(const uint8_t* top_y, const uint8_t* bottom_y, + const uint8_t* top_u, const uint8_t* top_v, + const uint8_t* cur_u, const uint8_t* cur_v, + uint8_t* top_dst, uint8_t* bottom_dst, int len) { + (void)top_y; + (void)bottom_y; + (void)top_u; + (void)top_v; + (void)cur_u; + (void)cur_v; + (void)top_dst; + (void)bottom_dst; + (void)len; + assert(0); // COLORSPACE SUPPORT NOT COMPILED +} +#define UpsampleArgbLinePair_C EmptyUpsampleFunc +#define UpsampleRgbLinePair_C EmptyUpsampleFunc +#define UpsampleBgrLinePair_C EmptyUpsampleFunc +#define UpsampleRgba4444LinePair_C EmptyUpsampleFunc +#define UpsampleRgb565LinePair_C EmptyUpsampleFunc +#endif // WEBP_REDUCE_CSP + #endif #undef LOAD_UV @@ -162,13 +186,30 @@ void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ for (i = 0; i < len; ++i) FUNC(y[i], u[i], v[i], &dst[i * (XSTEP)]); \ } -YUV444_FUNC(WebPYuv444ToRgb_C, VP8YuvToRgb, 3) -YUV444_FUNC(WebPYuv444ToBgr_C, VP8YuvToBgr, 3) YUV444_FUNC(WebPYuv444ToRgba_C, VP8YuvToRgba, 4) YUV444_FUNC(WebPYuv444ToBgra_C, VP8YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +YUV444_FUNC(WebPYuv444ToRgb_C, VP8YuvToRgb, 3) +YUV444_FUNC(WebPYuv444ToBgr_C, VP8YuvToBgr, 3) YUV444_FUNC(WebPYuv444ToArgb_C, VP8YuvToArgb, 4) YUV444_FUNC(WebPYuv444ToRgba4444_C, VP8YuvToRgba4444, 2) YUV444_FUNC(WebPYuv444ToRgb565_C, VP8YuvToRgb565, 2) +#else +static void EmptyYuv444Func(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { + (void)y; + (void)u; + (void)v; + (void)dst; + (void)len; +} +#define WebPYuv444ToRgb_C EmptyYuv444Func +#define WebPYuv444ToBgr_C EmptyYuv444Func +#define WebPYuv444ToArgb_C EmptyYuv444Func +#define WebPYuv444ToRgba4444_C EmptyYuv444Func +#define WebPYuv444ToRgb565_C EmptyYuv444Func +#endif // WEBP_REDUCE_CSP #undef YUV444_FUNC @@ -183,10 +224,10 @@ static volatile VP8CPUInfo upsampling_last_cpuinfo_used1 = WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444Converters(void) { if (upsampling_last_cpuinfo_used1 == VP8GetCPUInfo) return; - WebPYUV444Converters[MODE_RGB] = WebPYuv444ToRgb_C; WebPYUV444Converters[MODE_RGBA] = WebPYuv444ToRgba_C; - WebPYUV444Converters[MODE_BGR] = WebPYuv444ToBgr_C; WebPYUV444Converters[MODE_BGRA] = WebPYuv444ToBgra_C; + WebPYUV444Converters[MODE_RGB] = WebPYuv444ToRgb_C; + WebPYUV444Converters[MODE_BGR] = WebPYuv444ToBgr_C; WebPYUV444Converters[MODE_ARGB] = WebPYuv444ToArgb_C; WebPYUV444Converters[MODE_RGBA_4444] = WebPYuv444ToRgba4444_C; WebPYUV444Converters[MODE_RGB_565] = WebPYuv444ToRgb565_C; @@ -226,15 +267,15 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) { #ifdef FANCY_UPSAMPLING #if !WEBP_NEON_OMIT_C_CODE - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_C; WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair_C; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_C; WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair_C; + WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair_C; + WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair_C; + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_C; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_C; WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair_C; WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair_C; WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair_C; - WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair_C; - WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair_C; WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair_C; WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair_C; #endif @@ -265,15 +306,15 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) { } #endif - assert(WebPUpsamplers[MODE_RGB] != NULL); assert(WebPUpsamplers[MODE_RGBA] != NULL); - assert(WebPUpsamplers[MODE_BGR] != NULL); assert(WebPUpsamplers[MODE_BGRA] != NULL); + assert(WebPUpsamplers[MODE_rgbA] != NULL); + assert(WebPUpsamplers[MODE_bgrA] != NULL); + assert(WebPUpsamplers[MODE_RGB] != NULL); + assert(WebPUpsamplers[MODE_BGR] != NULL); assert(WebPUpsamplers[MODE_ARGB] != NULL); assert(WebPUpsamplers[MODE_RGBA_4444] != NULL); assert(WebPUpsamplers[MODE_RGB_565] != NULL); - assert(WebPUpsamplers[MODE_rgbA] != NULL); - assert(WebPUpsamplers[MODE_bgrA] != NULL); assert(WebPUpsamplers[MODE_Argb] != NULL); assert(WebPUpsamplers[MODE_rgbA_4444] != NULL); diff --git a/src/dsp/upsampling_mips_dsp_r2.c b/src/dsp/upsampling_mips_dsp_r2.c index de065d5f..10d499d7 100644 --- a/src/dsp/upsampling_mips_dsp_r2.c +++ b/src/dsp/upsampling_mips_dsp_r2.c @@ -46,6 +46,7 @@ ); \ } while (0) +#if !defined(WEBP_REDUCE_CSP) static WEBP_INLINE void YuvToRgb(int y, int u, int v, uint8_t* const rgb) { int r, g, b; YUV_TO_RGB(y, u, v, r, g, b); @@ -91,10 +92,12 @@ static WEBP_INLINE void YuvToRgba4444(int y, int u, int v, #endif } } +#endif // WEBP_REDUCE_CSP //----------------------------------------------------------------------------- // Alpha handling variants +#if !defined(WEBP_REDUCE_CSP) static WEBP_INLINE void YuvToArgb(uint8_t y, uint8_t u, uint8_t v, uint8_t* const argb) { int r, g, b; @@ -104,6 +107,7 @@ static WEBP_INLINE void YuvToArgb(uint8_t y, uint8_t u, uint8_t v, argb[2] = g; argb[3] = b; } +#endif // WEBP_REDUCE_CSP static WEBP_INLINE void YuvToBgra(uint8_t y, uint8_t u, uint8_t v, uint8_t* const bgra) { int r, g, b; @@ -197,13 +201,15 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ } // All variants implemented. -UPSAMPLE_FUNC(UpsampleRgbLinePair, YuvToRgb, 3) -UPSAMPLE_FUNC(UpsampleBgrLinePair, YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleRgbaLinePair, YuvToRgba, 4) UPSAMPLE_FUNC(UpsampleBgraLinePair, YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +UPSAMPLE_FUNC(UpsampleRgbLinePair, YuvToRgb, 3) +UPSAMPLE_FUNC(UpsampleBgrLinePair, YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleArgbLinePair, YuvToArgb, 4) UPSAMPLE_FUNC(UpsampleRgba4444LinePair, YuvToRgba4444, 2) UPSAMPLE_FUNC(UpsampleRgb565LinePair, YuvToRgb565, 2) +#endif // WEBP_REDUCE_CSP #undef LOAD_UV #undef UPSAMPLE_FUNC @@ -214,17 +220,19 @@ UPSAMPLE_FUNC(UpsampleRgb565LinePair, YuvToRgb565, 2) extern void WebPInitUpsamplersMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersMIPSdspR2(void) { - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair; + WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; + WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair; WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair; - WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair; WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair; +#endif // WEBP_REDUCE_CSP } #endif // FANCY_UPSAMPLING @@ -239,13 +247,15 @@ static void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ for (i = 0; i < len; ++i) FUNC(y[i], u[i], v[i], &dst[i * XSTEP]); \ } -YUV444_FUNC(Yuv444ToRgb, YuvToRgb, 3) -YUV444_FUNC(Yuv444ToBgr, YuvToBgr, 3) YUV444_FUNC(Yuv444ToRgba, YuvToRgba, 4) YUV444_FUNC(Yuv444ToBgra, YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +YUV444_FUNC(Yuv444ToRgb, YuvToRgb, 3) +YUV444_FUNC(Yuv444ToBgr, YuvToBgr, 3) YUV444_FUNC(Yuv444ToArgb, YuvToArgb, 4) YUV444_FUNC(Yuv444ToRgba4444, YuvToRgba4444, 2) YUV444_FUNC(Yuv444ToRgb565, YuvToRgb565, 2) +#endif // WEBP_REDUCE_CSP #undef YUV444_FUNC @@ -255,17 +265,19 @@ YUV444_FUNC(Yuv444ToRgb565, YuvToRgb565, 2) extern void WebPInitYUV444ConvertersMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444ConvertersMIPSdspR2(void) { - WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb; WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba; - WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr; WebPYUV444Converters[MODE_BGRA] = Yuv444ToBgra; + WebPYUV444Converters[MODE_rgbA] = Yuv444ToRgba; + WebPYUV444Converters[MODE_bgrA] = Yuv444ToBgra; +#if !defined(WEBP_REDUCE_CSP) + WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb; + WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr; WebPYUV444Converters[MODE_ARGB] = Yuv444ToArgb; WebPYUV444Converters[MODE_RGBA_4444] = Yuv444ToRgba4444; WebPYUV444Converters[MODE_RGB_565] = Yuv444ToRgb565; - WebPYUV444Converters[MODE_rgbA] = Yuv444ToRgba; - WebPYUV444Converters[MODE_bgrA] = Yuv444ToBgra; WebPYUV444Converters[MODE_Argb] = Yuv444ToArgb; WebPYUV444Converters[MODE_rgbA_4444] = Yuv444ToRgba4444; +#endif // WEBP_REDUCE_CSP } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/src/dsp/upsampling_msa.c b/src/dsp/upsampling_msa.c index 5748a6f6..535ffb77 100644 --- a/src/dsp/upsampling_msa.c +++ b/src/dsp/upsampling_msa.c @@ -640,13 +640,15 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bot_y, \ } \ } -UPSAMPLE_FUNC(UpsampleRgbLinePair, YuvToRgb, 3) -UPSAMPLE_FUNC(UpsampleBgrLinePair, YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleRgbaLinePair, YuvToRgba, 4) UPSAMPLE_FUNC(UpsampleBgraLinePair, YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +UPSAMPLE_FUNC(UpsampleRgbLinePair, YuvToRgb, 3) +UPSAMPLE_FUNC(UpsampleBgrLinePair, YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleArgbLinePair, YuvToArgb, 4) UPSAMPLE_FUNC(UpsampleRgba4444LinePair, YuvToRgba4444, 2) UPSAMPLE_FUNC(UpsampleRgb565LinePair, YuvToRgb565, 2) +#endif // WEBP_REDUCE_CSP //------------------------------------------------------------------------------ // Entry point @@ -656,17 +658,19 @@ extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; extern void WebPInitUpsamplersMSA(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersMSA(void) { - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair; - WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; + WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair; WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair; WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair; WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair; +#endif // WEBP_REDUCE_CSP } #endif // FANCY_UPSAMPLING diff --git a/src/dsp/upsampling_neon.c b/src/dsp/upsampling_neon.c index 1107c85c..17cbc9f9 100644 --- a/src/dsp/upsampling_neon.c +++ b/src/dsp/upsampling_neon.c @@ -243,13 +243,15 @@ static void FUNC_NAME(const uint8_t *top_y, const uint8_t *bottom_y, \ } // NEON variants of the fancy upsampler. -NEON_UPSAMPLE_FUNC(UpsampleRgbLinePair_NEON, Rgb, 3) -NEON_UPSAMPLE_FUNC(UpsampleBgrLinePair_NEON, Bgr, 3) NEON_UPSAMPLE_FUNC(UpsampleRgbaLinePair_NEON, Rgba, 4) NEON_UPSAMPLE_FUNC(UpsampleBgraLinePair_NEON, Bgra, 4) +#if !defined(WEBP_REDUCE_CSP) +NEON_UPSAMPLE_FUNC(UpsampleRgbLinePair_NEON, Rgb, 3) +NEON_UPSAMPLE_FUNC(UpsampleBgrLinePair_NEON, Bgr, 3) NEON_UPSAMPLE_FUNC(UpsampleArgbLinePair_NEON, Argb, 4) NEON_UPSAMPLE_FUNC(UpsampleRgba4444LinePair_NEON, Rgba4444, 2) NEON_UPSAMPLE_FUNC(UpsampleRgb565LinePair_NEON, Rgb565, 2) +#endif // WEBP_REDUCE_CSP //------------------------------------------------------------------------------ // Entry point @@ -259,17 +261,19 @@ extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; extern void WebPInitUpsamplersNEON(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersNEON(void) { - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_NEON; WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair_NEON; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_NEON; WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair_NEON; - WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair_NEON; WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair_NEON; WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair_NEON; +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_NEON; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_NEON; + WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair_NEON; WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair_NEON; WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair_NEON; WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair_NEON; WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair_NEON; +#endif // WEBP_REDUCE_CSP } #endif // FANCY_UPSAMPLING diff --git a/src/dsp/upsampling_sse2.c b/src/dsp/upsampling_sse2.c index aa0638b1..fd5d3039 100644 --- a/src/dsp/upsampling_sse2.c +++ b/src/dsp/upsampling_sse2.c @@ -169,13 +169,16 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ } // SSE2 variants of the fancy upsampler. -SSE2_UPSAMPLE_FUNC(UpsampleRgbLinePair_SSE2, VP8YuvToRgb, 3) -SSE2_UPSAMPLE_FUNC(UpsampleBgrLinePair_SSE2, VP8YuvToBgr, 3) SSE2_UPSAMPLE_FUNC(UpsampleRgbaLinePair_SSE2, VP8YuvToRgba, 4) SSE2_UPSAMPLE_FUNC(UpsampleBgraLinePair_SSE2, VP8YuvToBgra, 4) + +#if !defined(WEBP_REDUCE_CSP) +SSE2_UPSAMPLE_FUNC(UpsampleRgbLinePair_SSE2, VP8YuvToRgb, 3) +SSE2_UPSAMPLE_FUNC(UpsampleBgrLinePair_SSE2, VP8YuvToBgr, 3) SSE2_UPSAMPLE_FUNC(UpsampleArgbLinePair_SSE2, VP8YuvToArgb, 4) SSE2_UPSAMPLE_FUNC(UpsampleRgba4444LinePair_SSE2, VP8YuvToRgba4444, 2) SSE2_UPSAMPLE_FUNC(UpsampleRgb565LinePair_SSE2, VP8YuvToRgb565, 2) +#endif // WEBP_REDUCE_CSP #undef GET_M #undef PACK_AND_STORE @@ -193,17 +196,19 @@ extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; extern void WebPInitUpsamplersSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersSSE2(void) { - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_SSE2; WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair_SSE2; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_SSE2; WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair_SSE2; - WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair_SSE2; WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair_SSE2; WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair_SSE2; +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_SSE2; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_SSE2; + WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair_SSE2; WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair_SSE2; WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair_SSE2; WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair_SSE2; WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair_SSE2; +#endif // WEBP_REDUCE_CSP } #endif // FANCY_UPSAMPLING @@ -230,25 +235,29 @@ static void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ YUV444_FUNC(Yuv444ToRgba_SSE2, VP8YuvToRgba32_SSE2, WebPYuv444ToRgba_C, 4); YUV444_FUNC(Yuv444ToBgra_SSE2, VP8YuvToBgra32_SSE2, WebPYuv444ToBgra_C, 4); +#if !defined(WEBP_REDUCE_CSP) YUV444_FUNC(Yuv444ToRgb_SSE2, VP8YuvToRgb32_SSE2, WebPYuv444ToRgb_C, 3); YUV444_FUNC(Yuv444ToBgr_SSE2, VP8YuvToBgr32_SSE2, WebPYuv444ToBgr_C, 3); YUV444_FUNC(Yuv444ToArgb_SSE2, VP8YuvToArgb32_SSE2, WebPYuv444ToArgb_C, 4) YUV444_FUNC(Yuv444ToRgba4444_SSE2, VP8YuvToRgba444432_SSE2, \ WebPYuv444ToRgba4444_C, 2) YUV444_FUNC(Yuv444ToRgb565_SSE2, VP8YuvToRgb56532_SSE2, WebPYuv444ToRgb565_C, 2) +#endif // WEBP_REDUCE_CSP WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444ConvertersSSE2(void) { WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba_SSE2; WebPYUV444Converters[MODE_BGRA] = Yuv444ToBgra_SSE2; + WebPYUV444Converters[MODE_rgbA] = Yuv444ToRgba_SSE2; + WebPYUV444Converters[MODE_bgrA] = Yuv444ToBgra_SSE2; +#if !defined(WEBP_REDUCE_CSP) WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb_SSE2; WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr_SSE2; WebPYUV444Converters[MODE_ARGB] = Yuv444ToArgb_SSE2; WebPYUV444Converters[MODE_RGBA_4444] = Yuv444ToRgba4444_SSE2; WebPYUV444Converters[MODE_RGB_565] = Yuv444ToRgb565_SSE2; - WebPYUV444Converters[MODE_rgbA] = Yuv444ToRgba_SSE2; - WebPYUV444Converters[MODE_bgrA] = Yuv444ToBgra_SSE2; WebPYUV444Converters[MODE_Argb] = Yuv444ToArgb_SSE2; WebPYUV444Converters[MODE_rgbA_4444] = Yuv444ToRgba4444_SSE2; +#endif // WEBP_REDUCE_CSP } #else diff --git a/src/enc/picture_csp_enc.c b/src/enc/picture_csp_enc.c index cf5170b3..d531dd02 100644 --- a/src/enc/picture_csp_enc.c +++ b/src/enc/picture_csp_enc.c @@ -1134,12 +1134,7 @@ static int Import(WebPPicture* const picture, // Public API -int WebPPictureImportRGB(WebPPicture* picture, - const uint8_t* rgb, int rgb_stride) { - return (picture != NULL && rgb != NULL) - ? Import(picture, rgb, rgb_stride, 3, 0, 0) - : 0; -} +#if !defined(WEBP_REDUCE_CSP) int WebPPictureImportBGR(WebPPicture* picture, const uint8_t* rgb, int rgb_stride) { @@ -1148,13 +1143,6 @@ int WebPPictureImportBGR(WebPPicture* picture, : 0; } -int WebPPictureImportRGBA(WebPPicture* picture, - const uint8_t* rgba, int rgba_stride) { - return (picture != NULL && rgba != NULL) - ? Import(picture, rgba, rgba_stride, 4, 0, 1) - : 0; -} - int WebPPictureImportBGRA(WebPPicture* picture, const uint8_t* rgba, int rgba_stride) { return (picture != NULL && rgba != NULL) @@ -1162,12 +1150,6 @@ int WebPPictureImportBGRA(WebPPicture* picture, : 0; } -int WebPPictureImportRGBX(WebPPicture* picture, - const uint8_t* rgba, int rgba_stride) { - return (picture != NULL && rgba != NULL) - ? Import(picture, rgba, rgba_stride, 4, 0, 0) - : 0; -} int WebPPictureImportBGRX(WebPPicture* picture, const uint8_t* rgba, int rgba_stride) { @@ -1176,4 +1158,27 @@ int WebPPictureImportBGRX(WebPPicture* picture, : 0; } +#endif // WEBP_REDUCE_CSP + +int WebPPictureImportRGB(WebPPicture* picture, + const uint8_t* rgb, int rgb_stride) { + return (picture != NULL && rgb != NULL) + ? Import(picture, rgb, rgb_stride, 3, 0, 0) + : 0; +} + +int WebPPictureImportRGBA(WebPPicture* picture, + const uint8_t* rgba, int rgba_stride) { + return (picture != NULL && rgba != NULL) + ? Import(picture, rgba, rgba_stride, 4, 0, 1) + : 0; +} + +int WebPPictureImportRGBX(WebPPicture* picture, + const uint8_t* rgba, int rgba_stride) { + return (picture != NULL && rgba != NULL) + ? Import(picture, rgba, rgba_stride, 4, 0, 0) + : 0; +} + //------------------------------------------------------------------------------ diff --git a/src/enc/picture_enc.c b/src/enc/picture_enc.c index e6e75568..c691622d 100644 --- a/src/enc/picture_enc.c +++ b/src/enc/picture_enc.c @@ -270,9 +270,11 @@ size_t NAME(const uint8_t* in, int w, int h, int bps, float q, \ } ENCODE_FUNC(WebPEncodeRGB, WebPPictureImportRGB) -ENCODE_FUNC(WebPEncodeBGR, WebPPictureImportBGR) ENCODE_FUNC(WebPEncodeRGBA, WebPPictureImportRGBA) +#if !defined(WEBP_REDUCE_CSP) +ENCODE_FUNC(WebPEncodeBGR, WebPPictureImportBGR) ENCODE_FUNC(WebPEncodeBGRA, WebPPictureImportBGRA) +#endif // WEBP_REDUCE_CSP #undef ENCODE_FUNC @@ -283,9 +285,11 @@ size_t NAME(const uint8_t* in, int w, int h, int bps, uint8_t** out) { \ } LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessRGB, WebPPictureImportRGB) -LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessBGR, WebPPictureImportBGR) LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessRGBA, WebPPictureImportRGBA) +#if !defined(WEBP_REDUCE_CSP) +LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessBGR, WebPPictureImportBGR) LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessBGRA, WebPPictureImportBGRA) +#endif // WEBP_REDUCE_CSP #undef LOSSLESS_ENCODE_FUNC From 6b7a95fd8385baa6d18c96d5c0f2bea5632faf55 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 28 Nov 2017 12:01:56 -0800 Subject: [PATCH 10/10] update ChangeLog Change-Id: I868b7680164ddc712233acc8607a8dfb6b3a4cbe --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1a5fbc30..b17feb20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +f66955de WEBP_REDUCE_CSP: restrict colorspace support +a289d8e7 update ChangeLog (tag: v0.6.1-rc2) c10a493c vwebp: disable double buffering on windows & mac 0d4466c2 webp_to_sdl.c: fix file mode 1b27bf8b WEBP_REDUCE_SIZE: disable all rescaler code