Compare commits

...

13 Commits

Author SHA1 Message Date
Pascal Massimino
c1cb86af5f fix 16b overflow in SSE2
the 'accum' variable can be larger than 15b for large
rescale values.

Assert triggered:
 src/dsp/rescaler_sse2.c:249: RescalerExportRowExpand_SSE2: Assertion `v >= 0 && v <= 255' failed.
 src/dsp/rescaler_sse2.c:350: RescalerExportRowShrink_SSE2: Assertion `v >= 0 && v <= 255' failed.

-> fall back to C implementation in this case for now

Change-Id: I7ea1cb72301cafc1459be403f6a6f4e3cbc89bb1
2018-04-11 21:25:06 +00:00
Pascal Massimino
e577feb7c2 makefile.unix: add DEBUG flag for compiling w/ debug-symbol
usage example: make -f makefile.unix DEBUG=

Change-Id: I5aefe026a3364e5db5e0220b9fa506687cb98a8d
2018-04-11 20:51:04 +00:00
James Zern
99be34b3a8 cwebp,get_disto: fix bpp output
bits-per-pixel were intended, not bytes-per-pixel

Change-Id: I023349013ac5956154ab4526bd1e195dfe95b8ab
(cherry picked from commit e122e511cf)
2018-04-10 18:00:23 -07:00
Vincent Rabaud
f5565ca84a cmake: Make sure we use near-lossless by default.
The name of the CMake variable needs to be the same
as the C define used in cmake/config.h.in.

Change-Id: Id56d338617f6e4ed5f1da7ce01006d324ef4989f
2018-04-10 14:40:33 -07:00
Pascal Massimino
d898dc14a5 fix bug in WebPImport565: alpha value was not set
Change-Id: I2af4efb3c6ed49800bc16dbd4a997f7a95931918
2018-04-09 18:39:45 +00:00
James Zern
882784b03d update ChangeLog
Change-Id: I7e38d9beb2d733b85f56a44add8481cb45faf698
2018-04-03 20:22:31 -07:00
James Zern
2f930e0872 Revert "Use proper targets for CMake."
This reverts commit 8165e8fb3b.

breaks webp_js builds: missing includes, multiply defined symbols

Change-Id: I8df7eda3974e708c2a96b98600ec69981ec7aacb
2018-04-03 19:53:20 -07:00
Vincent Rabaud
8165e8fb3b Use proper targets for CMake.
Also fix the bug where near lossless was not used
and allow examples to be built by default.

Change-Id: Ieb5ef77fafe83f3776ff4fd27a6d26534c7a51f3
(cherry picked from commit e155dda0cc)
2018-04-03 18:38:09 -07:00
Vincent Rabaud
3f157dd5e7 Remove some very hard TODOs.
Change-Id: I3d1b0072e0ac9125840fbbd76e91d151c82489ec
(cherry picked from commit 4033e1d70d)
2018-04-03 18:38:00 -07:00
James Zern
cd758a1745 {de,}mux/Makefile.am: add missing headers
demux + mux: format_constants.h
demux: decode.h (included by demux.h for anim_decode)

Change-Id: I290a3416d4e47b4b6ebc14e99775d9db1ce5aec2
2018-04-03 18:02:27 -07:00
James Zern
b892b8ba8b makefile.unix,dist: use ascii for text output
this prevents unknown escapes containing '-'s getting stripped on OS X
when a tty targeted font is used

Change-Id: I11d77f2984d9fd67a8b22948fb21e4c11396aec4
2018-04-03 12:55:01 -07:00
Pascal Massimino
64a57d0587 add -version option to anim_dump,anim_diff and img2webp
This is to harmonize the -h/-version options on all our examples.

+ added GetAnimatedImageVersions() method to anim_util.*

Change-Id: I2304a1c29e310682e97f236d3867274a192a7a09
2018-04-03 11:46:17 -07:00
Pascal Massimino
fc1b8e3a8b webp_js: fix webp_js demo html
We need to export 'Module.cwrap' method.

Change-Id: I2986c5a4c06630ae3f95086a114e727a86c99a2b
2018-04-03 13:56:53 +02:00
19 changed files with 108 additions and 34 deletions

View File

@@ -10,7 +10,7 @@ option(WEBP_BUILD_GIF2WEBP "Build the gif2webp conversion tool." OFF)
option(WEBP_BUILD_IMG2WEBP "Build the img2webp animation tool." OFF) option(WEBP_BUILD_IMG2WEBP "Build the img2webp animation tool." OFF)
option(WEBP_BUILD_WEBPINFO "Build the webpinfo command line tool." OFF) option(WEBP_BUILD_WEBPINFO "Build the webpinfo command line tool." OFF)
option(WEBP_BUILD_WEBP_JS "Emscripten build of webp.js." OFF) option(WEBP_BUILD_WEBP_JS "Emscripten build of webp.js." OFF)
option(WEBP_ENABLE_NEAR_LOSSLESS "Enable near-lossless encoding" ON) option(WEBP_NEAR_LOSSLESS "Enable near-lossless encoding" ON)
option(WEBP_ENABLE_SWAP_16BIT_CSP "Enable byte swap for 16 bit colorspaces." OFF) option(WEBP_ENABLE_SWAP_16BIT_CSP "Enable byte swap for 16 bit colorspaces." OFF)
if(WEBP_BUILD_WEBP_JS) if(WEBP_BUILD_WEBP_JS)
@@ -289,7 +289,8 @@ if(WEBP_BUILD_WEBP_JS)
target_link_libraries(webp_js webpdecoder SDL) target_link_libraries(webp_js webpdecoder SDL)
set(WEBP_HAVE_SDL 1) set(WEBP_HAVE_SDL 1)
set_target_properties(webp_js PROPERTIES LINK_FLAGS set_target_properties(webp_js PROPERTIES LINK_FLAGS
"-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0") "-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
set_target_properties(webp_js PROPERTIES OUTPUT_NAME webp) set_target_properties(webp_js PROPERTIES OUTPUT_NAME webp)
target_compile_definitions(webp_js PUBLIC EMSCRIPTEN WEBP_HAVE_SDL) target_compile_definitions(webp_js PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
@@ -299,7 +300,8 @@ if(WEBP_BUILD_WEBP_JS)
target_link_libraries(webp_wasm webpdecoder SDL) target_link_libraries(webp_wasm webpdecoder SDL)
set_target_properties(webp_wasm PROPERTIES LINK_FLAGS set_target_properties(webp_wasm PROPERTIES LINK_FLAGS
"-s WASM=1 -s 'BINARYEN_METHOD=\"native-wasm\"' \ "-s WASM=1 -s 'BINARYEN_METHOD=\"native-wasm\"' \
-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0") -s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL) target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
target_compile_definitions(webpdecoder PUBLIC EMSCRIPTEN) target_compile_definitions(webpdecoder PUBLIC EMSCRIPTEN)

View File

@@ -1,3 +1,11 @@
2f930e08 Revert "Use proper targets for CMake."
8165e8fb Use proper targets for CMake.
3f157dd5 Remove some very hard TODOs.
cd758a17 {de,}mux/Makefile.am: add missing headers
b892b8ba makefile.unix,dist: use ascii for text output
64a57d05 add -version option to anim_dump,anim_diff and img2webp
fc1b8e3a webp_js: fix webp_js demo html
15aa48d9 update ChangeLog
e607dabc update AUTHORS e607dabc update AUTHORS
38410c08 [CFI] Remove function pointer casts 38410c08 [CFI] Remove function pointer casts
c57b2736 bump version to 1.0.0 c57b2736 bump version to 1.0.0

3
README
View File

@@ -458,6 +458,7 @@ File-level options (only used at the start of compression):
-mixed ............... use mixed lossy/lossless automatic mode -mixed ............... use mixed lossy/lossless automatic mode
-v ................... verbose mode -v ................... verbose mode
-h ................... this help -h ................... this help
-version ............. print version number and exit
Per-frame options (only used for subsequent images input): Per-frame options (only used for subsequent images input):
-d <int> ............. frame duration in ms (default: 100) -d <int> ............. frame duration in ms (default: 100)
@@ -527,6 +528,8 @@ Options:
-max_diff <int> ..... maximum allowed difference per channel -max_diff <int> ..... maximum allowed difference per channel
between corresponding pixels in subsequent between corresponding pixels in subsequent
frames frames
-h .................. this help
-version ............ print version number and exit
Building: Building:
--------- ---------

View File

@@ -32,7 +32,8 @@ using Emscripten and CMake.
webp.js.mem files generated. webp.js.mem files generated.
The callable JavaScript function is WebPToSDL(), which decodes a raw WebP The callable JavaScript function is WebPToSDL(), which decodes a raw WebP
bitstream into a canvas. See webp_js/index.html for a simple usage sample. bitstream into a canvas. See webp_js/index.html for a simple usage sample
(see below for instructions).
Demo HTML page: Demo HTML page:
=============== ===============

View File

@@ -190,6 +190,8 @@ static void Help(void) {
printf(" -max_diff <int> ..... maximum allowed difference per channel\n" printf(" -max_diff <int> ..... maximum allowed difference per channel\n"
" between corresponding pixels in subsequent\n" " between corresponding pixels in subsequent\n"
" frames\n"); " frames\n");
printf(" -h .................. this help\n");
printf(" -version ............ print version number and exit\n");
} }
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
@@ -205,11 +207,6 @@ int main(int argc, const char* argv[]) {
const char* files[2] = { NULL, NULL }; const char* files[2] = { NULL, NULL };
AnimatedImage images[2]; AnimatedImage images[2];
if (argc < 3) {
Help();
return -1;
}
for (c = 1; c < argc; ++c) { for (c = 1; c < argc; ++c) {
int parse_error = 0; int parse_error = 0;
if (!strcmp(argv[c], "-dump_frames")) { if (!strcmp(argv[c], "-dump_frames")) {
@@ -247,6 +244,18 @@ int main(int argc, const char* argv[]) {
} else { } else {
parse_error = 1; parse_error = 1;
} }
} else if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) {
Help();
return 0;
} else if (!strcmp(argv[c], "-version")) {
int dec_version, demux_version;
GetAnimatedImageVersions(&dec_version, &demux_version);
printf("WebP Decoder version: %d.%d.%d\nWebP Demux version: %d.%d.%d\n",
(dec_version >> 16) & 0xff, (dec_version >> 8) & 0xff,
(dec_version >> 0) & 0xff,
(demux_version >> 16) & 0xff, (demux_version >> 8) & 0xff,
(demux_version >> 0) & 0xff);
return 0;
} else { } else {
if (!got_input1) { if (!got_input1) {
files[0] = argv[c]; files[0] = argv[c];
@@ -263,6 +272,12 @@ int main(int argc, const char* argv[]) {
return -1; return -1;
} }
} }
if (argc < 3) {
Help();
return -1;
}
if (!got_input2) { if (!got_input2) {
Help(); Help();
return -1; return -1;

View File

@@ -30,6 +30,8 @@ static void Help(void) {
"(default: 'dump_')\n"); "(default: 'dump_')\n");
printf(" -tiff ............... save frames as TIFF\n"); printf(" -tiff ............... save frames as TIFF\n");
printf(" -pam ................ save frames as PAM\n"); printf(" -pam ................ save frames as PAM\n");
printf(" -h .................. this help\n");
printf(" -version ............ print version number and exit\n");
} }
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
@@ -66,6 +68,18 @@ int main(int argc, const char* argv[]) {
} else if (!strcmp(argv[c], "-pam")) { } else if (!strcmp(argv[c], "-pam")) {
format = PAM; format = PAM;
suffix = "pam"; suffix = "pam";
} else if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) {
Help();
return 0;
} else if (!strcmp(argv[c], "-version")) {
int dec_version, demux_version;
GetAnimatedImageVersions(&dec_version, &demux_version);
printf("WebP Decoder version: %d.%d.%d\nWebP Demux version: %d.%d.%d\n",
(dec_version >> 16) & 0xff, (dec_version >> 8) & 0xff,
(dec_version >> 0) & 0xff,
(demux_version >> 16) & 0xff, (demux_version >> 8) & 0xff,
(demux_version >> 0) & 0xff);
return 0;
} else { } else {
uint32_t i; uint32_t i;
AnimatedImage image; AnimatedImage image;

View File

@@ -786,3 +786,9 @@ void GetDiffAndPSNR(const uint8_t rgba1[], const uint8_t rgba2[],
*psnr = 4.3429448 * log(255. * 255. / sse); *psnr = 4.3429448 * log(255. * 255. / sse);
} }
} }
void GetAnimatedImageVersions(int* const decoder_version,
int* const demux_version) {
*decoder_version = WebPGetDecoderVersion();
*demux_version = WebPGetDemuxVersion();
}

View File

@@ -56,6 +56,10 @@ void GetDiffAndPSNR(const uint8_t rgba1[], const uint8_t rgba2[],
uint32_t width, uint32_t height, int premultiply, uint32_t width, uint32_t height, int premultiply,
int* const max_diff, double* const psnr); int* const max_diff, double* const psnr);
// Return library versions used by anim_util.
void GetAnimatedImageVersions(int* const decoder_version,
int* const demux_version);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif

View File

@@ -188,7 +188,7 @@ static void PrintExtraInfoLossless(const WebPPicture* const pic,
fprintf(stderr, "File: %s\n", file_name); fprintf(stderr, "File: %s\n", file_name);
fprintf(stderr, "Dimension: %d x %d\n", pic->width, pic->height); fprintf(stderr, "Dimension: %d x %d\n", pic->width, pic->height);
fprintf(stderr, "Output: %d bytes (%.2f bpp)\n", stats->coded_size, fprintf(stderr, "Output: %d bytes (%.2f bpp)\n", stats->coded_size,
1.f * stats->coded_size / pic->width / pic->height); 8.f * stats->coded_size / pic->width / pic->height);
PrintFullLosslessInfo(stats, "ARGB"); PrintFullLosslessInfo(stats, "ARGB");
} }
} }
@@ -213,7 +213,7 @@ static void PrintExtraInfoLossy(const WebPPicture* const pic, int short_output,
" (%.2f bpp)\n", " (%.2f bpp)\n",
stats->coded_size, stats->coded_size,
stats->PSNR[0], stats->PSNR[1], stats->PSNR[2], stats->PSNR[3], stats->PSNR[0], stats->PSNR[1], stats->PSNR[2], stats->PSNR[3],
1.f * stats->coded_size / pic->width / pic->height); 8.f * stats->coded_size / pic->width / pic->height);
if (total > 0) { if (total > 0) {
int totals[4] = { 0, 0, 0, 0 }; int totals[4] = { 0, 0, 0, 0 };
fprintf(stderr, "block count: intra4: %6d (%.2f%%)\n" fprintf(stderr, "block count: intra4: %6d (%.2f%%)\n"

View File

@@ -48,6 +48,7 @@ static void Help(void) {
printf(" -mixed ............... use mixed lossy/lossless automatic mode\n"); printf(" -mixed ............... use mixed lossy/lossless automatic mode\n");
printf(" -v ................... verbose mode\n"); printf(" -v ................... verbose mode\n");
printf(" -h ................... this help\n"); printf(" -h ................... this help\n");
printf(" -version ............. print version number and exit\n");
printf("\n"); printf("\n");
printf("Per-frame options (only used for subsequent images input):\n"); printf("Per-frame options (only used for subsequent images input):\n");
@@ -177,6 +178,14 @@ int main(int argc, const char* argv[]) {
} else if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { } else if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) {
Help(); Help();
goto End; goto End;
} else if (!strcmp(argv[c], "-version")) {
const int enc_version = WebPGetEncoderVersion();
const int mux_version = WebPGetMuxVersion();
printf("WebP Encoder version: %d.%d.%d\nWebP Mux version: %d.%d.%d\n",
(enc_version >> 16) & 0xff, (enc_version >> 8) & 0xff,
enc_version & 0xff, (mux_version >> 16) & 0xff,
(mux_version >> 8) & 0xff, mux_version & 0xff);
goto End;
} else { } else {
continue; continue;
} }

View File

@@ -48,13 +48,14 @@ int WebPImportGray(const uint8_t* gray_data, WebPPicture* pic) {
int WebPImportRGB565(const uint8_t* rgb565, WebPPicture* pic) { int WebPImportRGB565(const uint8_t* rgb565, WebPPicture* pic) {
int x, y; int x, y;
uint32_t* dst;
if (pic == NULL || rgb565 == NULL) return 0; if (pic == NULL || rgb565 == NULL) return 0;
pic->colorspace = WEBP_YUV420; pic->colorspace = WEBP_YUV420;
pic->use_argb = 1; pic->use_argb = 1;
if (!WebPPictureAlloc(pic)) return 0; if (!WebPPictureAlloc(pic)) return 0;
dst = pic->argb;
for (y = 0; y < pic->height; ++y) { for (y = 0; y < pic->height; ++y) {
const int width = pic->width; const int width = pic->width;
uint32_t* dst = pic->argb + y * pic->argb_stride;
for (x = 0; x < width; ++x) { for (x = 0; x < width; ++x) {
#ifdef WEBP_SWAP_16BIT_CSP #ifdef WEBP_SWAP_16BIT_CSP
const uint32_t rg = rgb565[2 * x + 1]; const uint32_t rg = rgb565[2 * x + 1];
@@ -70,22 +71,24 @@ int WebPImportRGB565(const uint8_t* rgb565, WebPPicture* pic) {
r = r | (r >> 5); r = r | (r >> 5);
g = g | (g >> 6); g = g | (g >> 6);
b = b | (b >> 5); b = b | (b >> 5);
dst[x] = (r << 16) | (g << 8) | b; dst[x] = (0xffu << 24) | (r << 16) | (g << 8) | b;
} }
rgb565 += 2 * width; rgb565 += 2 * width;
dst += pic->argb_stride;
} }
return 1; return 1;
} }
int WebPImportRGB4444(const uint8_t* rgb4444, WebPPicture* pic) { int WebPImportRGB4444(const uint8_t* rgb4444, WebPPicture* pic) {
int x, y; int x, y;
uint32_t* dst;
if (pic == NULL || rgb4444 == NULL) return 0; if (pic == NULL || rgb4444 == NULL) return 0;
pic->colorspace = WEBP_YUV420; pic->colorspace = WEBP_YUV420;
pic->use_argb = 1; pic->use_argb = 1;
if (!WebPPictureAlloc(pic)) return 0; if (!WebPPictureAlloc(pic)) return 0;
dst = pic->argb;
for (y = 0; y < pic->height; ++y) { for (y = 0; y < pic->height; ++y) {
const int width = pic->width; const int width = pic->width;
uint32_t* dst = pic->argb + y * pic->argb_stride;
for (x = 0; x < width; ++x) { for (x = 0; x < width; ++x) {
#ifdef WEBP_SWAP_16BIT_CSP #ifdef WEBP_SWAP_16BIT_CSP
const uint32_t rg = rgb4444[2 * x + 1]; const uint32_t rg = rgb4444[2 * x + 1];
@@ -106,6 +109,7 @@ int WebPImportRGB4444(const uint8_t* rgb4444, WebPPicture* pic) {
dst[x] = (a << 24) | (r << 16) | (g << 8) | b; dst[x] = (a << 24) | (r << 16) | (g << 8) | b;
} }
rgb4444 += 2 * width; rgb4444 += 2 * width;
dst += pic->argb_stride;
} }
return 1; return 1;
} }

View File

@@ -293,7 +293,7 @@ int main(int argc, const char *argv[]) {
printf("%u %.2f %.2f %.2f %.2f %.2f [ %.2f bpp ]\n", printf("%u %.2f %.2f %.2f %.2f %.2f [ %.2f bpp ]\n",
(unsigned int)size1, (unsigned int)size1,
disto[4], disto[0], disto[1], disto[2], disto[3], disto[4], disto[0], disto[1], disto[2], disto[3],
1.f * size1 / pic1.width / pic1.height); 8.f * size1 / pic1.width / pic1.height);
if (output != NULL) { if (output != NULL) {
uint8_t* data = NULL; uint8_t* data = NULL;

View File

@@ -112,7 +112,12 @@ endif
AR = ar AR = ar
ARFLAGS = r ARFLAGS = r
CPPFLAGS = -I. -Isrc/ -Wall CPPFLAGS = -I. -Isrc/ -Wall
CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS) ifeq ($(DEBUG), 1)
CFLAGS = -g
else
CFLAGS = -O3 -DNDEBUG
endif
CFLAGS += $(EXTRA_FLAGS)
CC = gcc CC = gcc
INSTALL = install INSTALL = install
GROFF = /usr/bin/groff GROFF = /usr/bin/groff
@@ -474,7 +479,7 @@ dist: all
for m in man/[cdv]webp.1 man/gif2webp.1 man/webpmux.1 \ for m in man/[cdv]webp.1 man/gif2webp.1 man/webpmux.1 \
man/img2webp.1 man/webpinfo.1; do \ man/img2webp.1 man/webpinfo.1; do \
basenam=$$(basename $$m .1); \ basenam=$$(basename $$m .1); \
$(GROFF) -t -e -man -T utf8 $$m \ $(GROFF) -t -e -man -T ascii $$m \
| $(COL) -bx >$(DESTDIR)/doc/$${basenam}.txt; \ | $(COL) -bx >$(DESTDIR)/doc/$${basenam}.txt; \
$(GROFF) -t -e -man -T html $$m \ $(GROFF) -t -e -man -T html $$m \
| $(COL) -bx >$(DESTDIR)/doc/$${basenam}.html; \ | $(COL) -bx >$(DESTDIR)/doc/$${basenam}.html; \

View File

@@ -1,5 +1,5 @@
.\" Hey, EMACS: -*- nroff -*- .\" Hey, EMACS: -*- nroff -*-
.TH IMG2WEBP 1 "February 7, 2018" .TH IMG2WEBP 1 "April 3, 2018"
.SH NAME .SH NAME
img2webp \- create animated WebP file from a sequence of input images. img2webp \- create animated WebP file from a sequence of input images.
.SH SYNOPSIS .SH SYNOPSIS
@@ -53,6 +53,9 @@ Be more verbose.
.TP .TP
.B \-h, \-help .B \-h, \-help
A short usage summary. A short usage summary.
.TP
.B \-version
Print the version numbers of the relevant libraries used.
.SH PER-FRAME OPTIONS .SH PER-FRAME OPTIONS
The per-frame options are applied for the images following as arguments in the The per-frame options are applied for the images following as arguments in the

View File

@@ -5,9 +5,12 @@ libwebpdemux_la_SOURCES =
libwebpdemux_la_SOURCES += anim_decode.c demux.c libwebpdemux_la_SOURCES += anim_decode.c demux.c
libwebpdemuxinclude_HEADERS = libwebpdemuxinclude_HEADERS =
libwebpdemuxinclude_HEADERS += ../webp/decode.h
libwebpdemuxinclude_HEADERS += ../webp/demux.h libwebpdemuxinclude_HEADERS += ../webp/demux.h
libwebpdemuxinclude_HEADERS += ../webp/mux_types.h libwebpdemuxinclude_HEADERS += ../webp/mux_types.h
libwebpdemuxinclude_HEADERS += ../webp/types.h libwebpdemuxinclude_HEADERS += ../webp/types.h
noinst_HEADERS =
noinst_HEADERS += ../webp/format_constants.h
libwebpdemux_la_LIBADD = ../libwebp.la libwebpdemux_la_LIBADD = ../libwebp.la
libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:4:0 libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:4:0

View File

@@ -36,7 +36,7 @@ static void LoadTwoPixels_SSE2(const uint8_t* const src, __m128i* out) {
} }
// input: 8 bytes ABCDEFGH -> output: A0B0C0D0E0F0G0H0 // input: 8 bytes ABCDEFGH -> output: A0B0C0D0E0F0G0H0
static void LoadHeightPixels_SSE2(const uint8_t* const src, __m128i* out) { static void LoadEightPixels_SSE2(const uint8_t* const src, __m128i* out) {
const __m128i zero = _mm_setzero_si128(); const __m128i zero = _mm_setzero_si128();
const __m128i A = _mm_loadl_epi64((const __m128i*)(src)); // ABCDEFGH const __m128i A = _mm_loadl_epi64((const __m128i*)(src)); // ABCDEFGH
*out = _mm_unpacklo_epi8(A, zero); *out = _mm_unpacklo_epi8(A, zero);
@@ -50,13 +50,15 @@ static void RescalerImportRowExpand_SSE2(WebPRescaler* const wrk,
int accum = x_add; int accum = x_add;
__m128i cur_pixels; __m128i cur_pixels;
// SSE2 implementation only works with 16b signed arithmetic at max.
if (wrk->src_width < 8 || accum >= (1 << 15)) {
WebPRescalerImportRowExpand_C(wrk, src);
return;
}
assert(!WebPRescalerInputDone(wrk)); assert(!WebPRescalerInputDone(wrk));
assert(wrk->x_expand); assert(wrk->x_expand);
if (wrk->num_channels == 4) { if (wrk->num_channels == 4) {
if (wrk->src_width < 2) {
WebPRescalerImportRowExpand_C(wrk, src);
return;
}
LoadTwoPixels_SSE2(src, &cur_pixels); LoadTwoPixels_SSE2(src, &cur_pixels);
src += 4; src += 4;
while (1) { while (1) {
@@ -75,11 +77,7 @@ static void RescalerImportRowExpand_SSE2(WebPRescaler* const wrk,
} else { } else {
int left; int left;
const uint8_t* const src_limit = src + wrk->src_width - 8; const uint8_t* const src_limit = src + wrk->src_width - 8;
if (wrk->src_width < 8) { LoadEightPixels_SSE2(src, &cur_pixels);
WebPRescalerImportRowExpand_C(wrk, src);
return;
}
LoadHeightPixels_SSE2(src, &cur_pixels);
src += 7; src += 7;
left = 7; left = 7;
while (1) { while (1) {
@@ -94,7 +92,7 @@ static void RescalerImportRowExpand_SSE2(WebPRescaler* const wrk,
if (--left) { if (--left) {
cur_pixels = _mm_srli_si128(cur_pixels, 2); cur_pixels = _mm_srli_si128(cur_pixels, 2);
} else if (src <= src_limit) { } else if (src <= src_limit) {
LoadHeightPixels_SSE2(src, &cur_pixels); LoadEightPixels_SSE2(src, &cur_pixels);
src += 7; src += 7;
left = 7; left = 7;
} else { // tail } else { // tail

View File

@@ -1026,7 +1026,7 @@ int VP8LGetHistoImageSymbols(int xsize, int ysize,
} }
} }
// TODO(vikasa): Optimize HistogramRemap for low-effort compression mode also. // TODO(vrabaud): Optimize HistogramRemap for low-effort compression mode.
// Find the optimal map from original histograms to the final ones. // Find the optimal map from original histograms to the final ones.
HistogramRemap(orig_histo, image_histo, histogram_symbols); HistogramRemap(orig_histo, image_histo, histogram_symbols);

View File

@@ -382,8 +382,7 @@ static int EncoderAnalyze(VP8LEncoder* const enc,
AnalyzeAndCreatePalette(pic, low_effort, AnalyzeAndCreatePalette(pic, low_effort,
enc->palette_, &enc->palette_size_); enc->palette_, &enc->palette_size_);
// TODO(jyrki): replace the decision to be based on an actual estimate // Empirical bit sizes.
// of entropy, or even spatial variance of entropy.
enc->histo_bits_ = GetHistoBits(method, use_palette, enc->histo_bits_ = GetHistoBits(method, use_palette,
pic->width, pic->height); pic->width, pic->height);
enc->transform_bits_ = GetTransformBits(method, enc->histo_bits_); enc->transform_bits_ = GetTransformBits(method, enc->histo_bits_);
@@ -754,7 +753,6 @@ static WebPEncodingError StoreImageToBitMask(
// Don't write the distance with the extra bits code since // Don't write the distance with the extra bits code since
// the distance can be up to 18 bits of extra bits, and the prefix // the distance can be up to 18 bits of extra bits, and the prefix
// 15 bits, totaling to 33, and our PutBits only supports up to 32 bits. // 15 bits, totaling to 33, and our PutBits only supports up to 32 bits.
// TODO(jyrki): optimize this further.
VP8LPrefixEncode(distance, &code, &n_bits, &bits); VP8LPrefixEncode(distance, &code, &n_bits, &bits);
WriteHuffmanCode(bw, codes + 4, code); WriteHuffmanCode(bw, codes + 4, code);
VP8LPutBits(bw, bits, n_bits); VP8LPutBits(bw, bits, n_bits);
@@ -1876,7 +1874,6 @@ int VP8LEncodeImage(const WebPConfig* const config,
err = VP8LEncodeStream(config, picture, &bw, 1 /*use_cache*/); err = VP8LEncodeStream(config, picture, &bw, 1 /*use_cache*/);
if (err != VP8_ENC_OK) goto Error; if (err != VP8_ENC_OK) goto Error;
// TODO(skal): have a fine-grained progress report in VP8LEncodeStream().
if (!WebPReportProgress(picture, 90, &percent)) goto UserAbort; if (!WebPReportProgress(picture, 90, &percent)) goto UserAbort;
// Finish the RIFF chunk. // Finish the RIFF chunk.

View File

@@ -13,6 +13,8 @@ libwebpmuxinclude_HEADERS =
libwebpmuxinclude_HEADERS += ../webp/mux.h libwebpmuxinclude_HEADERS += ../webp/mux.h
libwebpmuxinclude_HEADERS += ../webp/mux_types.h libwebpmuxinclude_HEADERS += ../webp/mux_types.h
libwebpmuxinclude_HEADERS += ../webp/types.h libwebpmuxinclude_HEADERS += ../webp/types.h
noinst_HEADERS =
noinst_HEADERS += ../webp/format_constants.h
libwebpmux_la_LIBADD = ../libwebp.la libwebpmux_la_LIBADD = ../libwebp.la
libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:2:0 -lm libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:2:0 -lm