Skip to content

Commit

Permalink
Revert "libwebp: update to 1.0.2"
Browse files Browse the repository at this point in the history
This reverts commit 7a17297.

Reason for revert: Suspect compile failure on Win32-rel
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/win32-rel/10047

Original change's description:
> libwebp: update to 1.0.2
> 
> minor encoder speedups and roll up to pick up local fuzzer cherry-pick
> 
> Bug: 922319
> Change-Id: I2c8be4423aab86c406c3d4d2848950178337da3c
> Reviewed-on: https://chromium-review.googlesource.com/c/1412021
> Reviewed-by: Urvang Joshi <urvang@chromium.org>
> Commit-Queue: James Zern <jzern@google.com>
> Cr-Commit-Position: refs/heads/master@{#625099}

TBR=jzern@google.com,urvang@chromium.org

Change-Id: I8bb8f22990696269d18f35a95aa611ab4a3efeba
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 922319
Reviewed-on: https://chromium-review.googlesource.com/c/1428629
Reviewed-by: Takashi Sakamoto <tasak@google.com>
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/master@{#625107}
  • Loading branch information
tasak authored and Commit Bot committed Jan 23, 2019
1 parent 4c6aafc commit cd19bf0
Show file tree
Hide file tree
Showing 23 changed files with 228 additions and 684 deletions.
4 changes: 0 additions & 4 deletions third_party/libwebp/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ static_library("libwebp_dsp") {
"src/dsp/mips_macro.h",
"src/dsp/msa_macro.h",
"src/dsp/neon.h",
"src/dsp/quant.h",
"src/dsp/rescaler.c",
"src/dsp/rescaler_mips32.c",
"src/dsp/rescaler_mips_dsp_r2.c",
Expand Down Expand Up @@ -253,7 +252,6 @@ if (use_dsp_neon) {
static_library("libwebp_dsp_neon") {
sources = [
"src/dsp/alpha_processing_neon.c",
"src/dsp/cost_neon.c",
"src/dsp/dec_neon.c",
"src/dsp/enc_neon.c",
"src/dsp/filters_neon.c",
Expand Down Expand Up @@ -508,7 +506,6 @@ if (current_toolchain == host_toolchain) {
sources = [
"examples/cwebp.c",
"examples/stopwatch.h",
"examples/unicode.h",
]

deps = [
Expand All @@ -533,7 +530,6 @@ if (current_toolchain == host_toolchain) {
sources = [
"examples/dwebp.c",
"examples/stopwatch.h",
"examples/unicode.h",
]

deps = [
Expand Down
5 changes: 3 additions & 2 deletions third_party/libwebp/README.chromium
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Name: WebP image encoder/decoder
Short Name: libwebp
URL: http://developers.google.com/speed/webp
Version: v1.0.2
Version: v1.0.1
License: BSD
License File: LICENSE
Security Critical: Yes

Description:
Source archive:
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.1.tar.gz

WebP is an image format that does both lossy and lossless compression of
digital photographic images. WebP consists of a codec based on VP8, that Google
Expand All @@ -23,3 +23,4 @@ Local changes:
(crbug.com/654974)
* Pulled in fuzzers from OSS-Fuzz
https://github.com/google/oss-fuzz/tree/master/projects/libwebp
* cherry-pick 928a75de webp: Fix VP8LBitWriterClone() bug
57 changes: 25 additions & 32 deletions third_party/libwebp/examples/cwebp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "../imageio/image_dec.h"
#include "../imageio/imageio_util.h"
#include "./stopwatch.h"
#include "./unicode.h"
#include "webp/encode.h"

#ifndef WEBP_DLL
Expand Down Expand Up @@ -89,8 +88,7 @@ static int ReadPicture(const char* const filename, WebPPicture* const pic,
}
}
if (!ok) {
WFPRINTF(stderr, "Error! Could not process file %s\n",
(const W_CHAR*)filename);
fprintf(stderr, "Error! Could not process file %s\n", filename);
}
free((void*)data);
return ok;
Expand All @@ -116,8 +114,7 @@ static int ReadPicture(const char* const filename, WebPPicture* const pic,
}
End:
if (!ok) {
WFPRINTF(stderr, "Error! Could not process file %s\n",
(const W_CHAR*)filename);
fprintf(stderr, "Error! Could not process file %s\n", filename);
}
free((void*)data);
return ok;
Expand Down Expand Up @@ -188,7 +185,7 @@ static void PrintExtraInfoLossless(const WebPPicture* const pic,
if (short_output) {
fprintf(stderr, "%7d %2.2f\n", stats->coded_size, stats->PSNR[3]);
} else {
WFPRINTF(stderr, "File: %s\n", (const W_CHAR*)file_name);
fprintf(stderr, "File: %s\n", file_name);
fprintf(stderr, "Dimension: %d x %d\n", pic->width, pic->height);
fprintf(stderr, "Output: %d bytes (%.2f bpp)\n", stats->coded_size,
8.f * stats->coded_size / pic->width / pic->height);
Expand All @@ -207,7 +204,7 @@ static void PrintExtraInfoLossy(const WebPPicture* const pic, int short_output,
const int num_i16 = stats->block_count[1];
const int num_skip = stats->block_count[2];
const int total = num_i4 + num_i16;
WFPRINTF(stderr, "File: %s\n", (const W_CHAR*)file_name);
fprintf(stderr, "File: %s\n", file_name);
fprintf(stderr, "Dimension: %d x %d%s\n",
pic->width, pic->height,
stats->alpha_data_size ? " (with alpha)" : "");
Expand Down Expand Up @@ -312,7 +309,7 @@ static int DumpPicture(const WebPPicture* const picture, const char* PGM_name) {
const int alpha_height =
WebPPictureHasTransparency(picture) ? picture->height : 0;
const int height = picture->height + uv_height + alpha_height;
FILE* const f = WFOPEN(PGM_name, "wb");
FILE* const f = fopen(PGM_name, "wb");
if (f == NULL) return 0;
fprintf(f, "P5\n%d %d\n255\n", stride, height);
for (y = 0; y < picture->height; ++y) {
Expand Down Expand Up @@ -666,34 +663,32 @@ int main(int argc, const char *argv[]) {
Metadata metadata;
Stopwatch stop_watch;

INIT_WARGV(argc, argv);

MetadataInit(&metadata);
WebPMemoryWriterInit(&memory_writer);
if (!WebPPictureInit(&picture) ||
!WebPPictureInit(&original_picture) ||
!WebPConfigInit(&config)) {
fprintf(stderr, "Error! Version mismatch!\n");
FREE_WARGV_AND_RETURN(-1);
return -1;
}

if (argc == 1) {
HelpShort();
FREE_WARGV_AND_RETURN(0);
return 0;
}

for (c = 1; c < argc; ++c) {
int parse_error = 0;
if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) {
HelpShort();
FREE_WARGV_AND_RETURN(0);
return 0;
} else if (!strcmp(argv[c], "-H") || !strcmp(argv[c], "-longhelp")) {
HelpLong();
FREE_WARGV_AND_RETURN(0);
return 0;
} else if (!strcmp(argv[c], "-o") && c < argc - 1) {
out_file = (const char*)GET_WARGV(argv, ++c);
out_file = argv[++c];
} else if (!strcmp(argv[c], "-d") && c < argc - 1) {
dump_file = (const char*)GET_WARGV(argv, ++c);
dump_file = argv[++c];
config.show_compressed = 1;
} else if (!strcmp(argv[c], "-print_psnr")) {
config.show_compressed = 1;
Expand Down Expand Up @@ -821,7 +816,7 @@ int main(int argc, const char *argv[]) {
const int version = WebPGetEncoderVersion();
printf("%d.%d.%d\n",
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
FREE_WARGV_AND_RETURN(0);
return 0;
} else if (!strcmp(argv[c], "-progress")) {
show_progress = 1;
} else if (!strcmp(argv[c], "-quiet")) {
Expand Down Expand Up @@ -883,7 +878,8 @@ int main(int argc, const char *argv[]) {
if (i == kNumTokens) {
fprintf(stderr, "Error! Unknown metadata type '%.*s'\n",
(int)(token - start), start);
FREE_WARGV_AND_RETURN(-1);
HelpLong();
return -1;
}
start = token + 1;
}
Expand All @@ -897,19 +893,19 @@ int main(int argc, const char *argv[]) {
} else if (!strcmp(argv[c], "-v")) {
verbose = 1;
} else if (!strcmp(argv[c], "--")) {
if (c < argc - 1) in_file = (const char*)GET_WARGV(argv, ++c);
if (c < argc - 1) in_file = argv[++c];
break;
} else if (argv[c][0] == '-') {
fprintf(stderr, "Error! Unknown option '%s'\n", argv[c]);
HelpLong();
FREE_WARGV_AND_RETURN(-1);
return -1;
} else {
in_file = (const char*)GET_WARGV(argv, c);
in_file = argv[c];
}

if (parse_error) {
HelpLong();
FREE_WARGV_AND_RETURN(-1);
return -1;
}
}
if (in_file == NULL) {
Expand Down Expand Up @@ -959,8 +955,7 @@ int main(int argc, const char *argv[]) {
}
if (!ReadPicture(in_file, &picture, keep_alpha,
(keep_metadata == 0) ? NULL : &metadata)) {
WFPRINTF(stderr, "Error! Cannot read input picture file '%s'\n",
(const W_CHAR*)in_file);
fprintf(stderr, "Error! Cannot read input picture file '%s'\n", in_file);
goto Error;
}
picture.progress_hook = (show_progress && !quiet) ? ProgressReport : NULL;
Expand All @@ -976,15 +971,14 @@ int main(int argc, const char *argv[]) {

// Open the output
if (out_file != NULL) {
const int use_stdout = !WSTRCMP(out_file, "-");
out = use_stdout ? ImgIoUtilSetBinaryMode(stdout) : WFOPEN(out_file, "wb");
const int use_stdout = !strcmp(out_file, "-");
out = use_stdout ? ImgIoUtilSetBinaryMode(stdout) : fopen(out_file, "wb");
if (out == NULL) {
WFPRINTF(stderr, "Error! Cannot open output file '%s'\n",
(const W_CHAR*)out_file);
fprintf(stderr, "Error! Cannot open output file '%s'\n", out_file);
goto Error;
} else {
if (!short_output && !quiet) {
WFPRINTF(stderr, "Saving file '%s'\n", (const W_CHAR*)out_file);
fprintf(stderr, "Saving file '%s'\n", out_file);
}
}
if (keep_metadata == 0) {
Expand Down Expand Up @@ -1099,8 +1093,7 @@ int main(int argc, const char *argv[]) {
fprintf(stderr, "Warning: can't dump file (-d option) "
"in lossless mode.\n");
} else if (!DumpPicture(&picture, dump_file)) {
WFPRINTF(stderr, "Warning, couldn't dump picture %s\n",
(const W_CHAR*)dump_file);
fprintf(stderr, "Warning, couldn't dump picture %s\n", dump_file);
}
}

Expand Down Expand Up @@ -1176,7 +1169,7 @@ int main(int argc, const char *argv[]) {
fclose(out);
}

FREE_WARGV_AND_RETURN(return_value);
return return_value;
}

//------------------------------------------------------------------------------
43 changes: 20 additions & 23 deletions third_party/libwebp/examples/dwebp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "../imageio/image_enc.h"
#include "../imageio/webpdec.h"
#include "./stopwatch.h"
#include "./unicode.h"

static int verbose = 0;
static int quiet = 0;
Expand All @@ -43,7 +42,7 @@ extern void* VP8GetCPUInfo; // opaque forward declaration.

static int SaveOutput(const WebPDecBuffer* const buffer,
WebPOutputFileFormat format, const char* const out_file) {
const int use_stdout = (out_file != NULL) && !WSTRCMP(out_file, "-");
const int use_stdout = (out_file != NULL) && !strcmp(out_file, "-");
int ok = 1;
Stopwatch stop_watch;

Expand All @@ -57,7 +56,7 @@ static int SaveOutput(const WebPDecBuffer* const buffer,
if (use_stdout) {
fprintf(stderr, "Saved to stdout\n");
} else {
WFPRINTF(stderr, "Saved file %s\n", (const W_CHAR*)out_file);
fprintf(stderr, "Saved file %s\n", out_file);
}
}
if (verbose) {
Expand All @@ -68,7 +67,7 @@ static int SaveOutput(const WebPDecBuffer* const buffer,
if (use_stdout) {
fprintf(stderr, "Error writing to stdout !!\n");
} else {
WFPRINTF(stderr, "Error writing file %s !!\n", (const W_CHAR*)out_file);
fprintf(stderr, "Error writing file %s !!\n", out_file);
}
}
return ok;
Expand Down Expand Up @@ -192,20 +191,18 @@ int main(int argc, const char *argv[]) {
int incremental = 0;
int c;

INIT_WARGV(argc, argv);

if (!WebPInitDecoderConfig(&config)) {
fprintf(stderr, "Library version mismatch!\n");
FREE_WARGV_AND_RETURN(-1);
return -1;
}

for (c = 1; c < argc; ++c) {
int parse_error = 0;
if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) {
Help();
FREE_WARGV_AND_RETURN(0);
return 0;
} else if (!strcmp(argv[c], "-o") && c < argc - 1) {
out_file = (const char*)GET_WARGV(argv, ++c);
out_file = argv[++c];
} else if (!strcmp(argv[c], "-alpha")) {
format = ALPHA_PLANE_ONLY;
} else if (!strcmp(argv[c], "-nofancy")) {
Expand All @@ -226,7 +223,7 @@ int main(int argc, const char *argv[]) {
const int version = WebPGetDecoderVersion();
printf("%d.%d.%d\n",
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
FREE_WARGV_AND_RETURN(0);
return 0;
} else if (!strcmp(argv[c], "-pgm")) {
format = PGM;
} else if (!strcmp(argv[c], "-yuv")) {
Expand Down Expand Up @@ -287,26 +284,26 @@ int main(int argc, const char *argv[]) {
} else if (!strcmp(argv[c], "-incremental")) {
incremental = 1;
} else if (!strcmp(argv[c], "--")) {
if (c < argc - 1) in_file = (const char*)GET_WARGV(argv, ++c);
if (c < argc - 1) in_file = argv[++c];
break;
} else if (argv[c][0] == '-') {
fprintf(stderr, "Unknown option '%s'\n", argv[c]);
Help();
FREE_WARGV_AND_RETURN(-1);
return -1;
} else {
in_file = (const char*)GET_WARGV(argv, c);
in_file = argv[c];
}

if (parse_error) {
Help();
FREE_WARGV_AND_RETURN(-1);
return -1;
}
}

if (in_file == NULL) {
fprintf(stderr, "missing input file!!\n");
Help();
FREE_WARGV_AND_RETURN(-1);
return -1;
}

if (quiet) verbose = 0;
Expand All @@ -315,7 +312,7 @@ int main(int argc, const char *argv[]) {
VP8StatusCode status = VP8_STATUS_OK;
size_t data_size = 0;
if (!LoadWebP(in_file, &data, &data_size, bitstream)) {
FREE_WARGV_AND_RETURN(-1);
return -1;
}

switch (format) {
Expand Down Expand Up @@ -392,18 +389,18 @@ int main(int argc, const char *argv[]) {

if (out_file != NULL) {
if (!quiet) {
WFPRINTF(stderr, "Decoded %s.", (const W_CHAR*)in_file);
fprintf(stderr, " Dimensions: %d x %d %s. Format: %s. Now saving...\n",
output_buffer->width, output_buffer->height,
fprintf(stderr, "Decoded %s. Dimensions: %d x %d %s. Format: %s. "
"Now saving...\n",
in_file, output_buffer->width, output_buffer->height,
bitstream->has_alpha ? " (with alpha)" : "",
kFormatType[bitstream->format]);
}
ok = SaveOutput(output_buffer, format, out_file);
} else {
if (!quiet) {
WFPRINTF(stderr, "File %s can be decoded ", (const W_CHAR*)in_file);
fprintf(stderr, "(dimensions: %d x %d %s. Format: %s).\n",
output_buffer->width, output_buffer->height,
fprintf(stderr, "File %s can be decoded "
"(dimensions: %d x %d %s. Format: %s).\n",
in_file, output_buffer->width, output_buffer->height,
bitstream->has_alpha ? " (with alpha)" : "",
kFormatType[bitstream->format]);
fprintf(stderr, "Nothing written; "
Expand All @@ -414,7 +411,7 @@ int main(int argc, const char *argv[]) {
WebPFreeDecBuffer(output_buffer);
free((void*)external_buffer);
free((void*)data);
FREE_WARGV_AND_RETURN(ok ? 0 : -1);
return ok ? 0 : -1;
}

//------------------------------------------------------------------------------
8 changes: 0 additions & 8 deletions third_party/libwebp/examples/example_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ int ExUtilInitCommandLineArguments(int argc, const char* argv[],
if (argc == 1 && argv[0][0] != '-') {
char* cur;
const char sep[] = " \t\r\n\f\v";

#if defined(_WIN32) && defined(_UNICODE)
fprintf(stderr,
"Error: Reading arguments from a file is a feature unavailable "
"with Unicode binaries.\n");
return 0;
#endif

if (!ExUtilReadFileToWebPData(argv[0], &args->argv_data_)) {
return 0;
}
Expand Down
Loading

0 comments on commit cd19bf0

Please sign in to comment.