Compare commits

...

10 Commits

Author SHA1 Message Date
James Zern
86c756929c rescaler_mips32: disable ImportRowShrink
this function is failing the 'accum == 0' assert on skia bots for
rescaling to 13x13

BUG=skia:6682

Change-Id: I9f9f3adf28cec63ad6e38ed3128f18825d5b70cc
2017-06-02 19:58:33 -07:00
James Zern
50d1a848bc update ChangeLog
Change-Id: Ibaa88480519114b8f36f96c51d44b5c3b8a6433d
2017-01-30 12:23:57 -08:00
James Zern
20a7fea064 extras/Makefile.am: fix libwebpextras.la reference
drop './' from the reference in webp_quality_LDADD.. this form is used
in the other makefiles. this fixes a parallel build failure seen under
freebsd:
make[1]: don't know how to make ./libwebpextras.la. Stop

Change-Id: I59635a0c747d402cd990f6379eb1948c3e40f278
2017-01-28 13:33:07 -08:00
James Zern
415f3ffe3d update ChangeLog
Change-Id: Id1788367319e8476b79a5221af32c8068bba78e4
2017-01-26 23:09:25 -08:00
James Zern
3c6d1224b4 update NEWS
Change-Id: Id0ecf4abd657c2e0c97abe28fc3cca4ab7bc625b
2017-01-26 22:47:46 -08:00
James Zern
ee4a4141f5 update AUTHORS
Change-Id: I86b80411f50f5b112da54236aedd4d9ac005f8a5
2017-01-26 22:41:09 -08:00
Jehan
32ed856f60 Fix "all|no frames are keyframes" settings.
Documentation says: "if kmin == 0, then key-frame insertion is disabled;
and if kmax == 0, then all frames will be key-frames."
Reading this, you'd expect that if kmax == 0, then with any kmin <= 0
all frames will be key-frames. But actually the kmin <= 0 test is caught
first and you get the opposite (no keyframes but the first). You'd have
instead to set kmax == 0 and any value kmin > 0, which is absolutely
counter-intuitive (reversing order).
Moreover kmax == 1 has no valid kmin (kmin == 1 conflicts with the
`kmax > kmin` rule and kmin == 0 conflicts with `kmin >= kmax / 2 + 1`).
So it should be considered an exception too.

Instead I propose this new logic:
- kmax == 1 means that all frames are keyframes (you are explicitly
  requesting a keyframe every 1 frame at most, i.e. all frames).
- kmax == 0 means no keyframes (you ask for a keyframe every 0 frames,
  i.e. never).
This is more "logical" language-wise, and also does not involve any
conflicts about what if both kmax and kmin are 0, since now a single
property value is meaningful for the 2 exceptional cases.

Change-Id: Ia90fb963bc26904ff078d2e4ef9f74b22b13a0fd
(cherry picked from commit 2dc0bdcaee)
2017-01-26 22:31:16 -08:00
Pascal Massimino
f4dc56fd77 disable GradientUnfilter_NEON
Compile with XCode, it appears quite slower than the C-version,
especially for arm64.

Change-Id: Ic46dba184a36be454fef674129d2f909003788fc
(cherry picked from commit 4f3e3bbd44)
2017-01-25 20:30:15 -08:00
James Zern
0d8e05880c img2webp: treat -loop as a no-op w/single images
or in cases where duplicates have been reduced to one

Change-Id: I145cd61b6792b021617f1234f0ba36e2a3128d84
2017-01-25 08:17:39 +00:00
Pascal Massimino
b045013970 ReadImage(): restore size reporting
That was useful for printing rd-curves.

Change-Id: Idd641d94633f1f88bad2e29494b3d99c4c02fa30
2017-01-24 23:05:33 -08:00
11 changed files with 62 additions and 31 deletions

View File

@@ -5,6 +5,7 @@ Contributors:
- Hui Su (huisu at google dot com)
- James Zern (jzern at google dot com)
- Jan Engelhardt (jengelh at medozas dot de)
- Jehan (jehan at girinstud dot io)
- Johann (johann dot koenig at duck dot com)
- Jovan Zelincevic (jovan dot zelincevic at imgtec dot com)
- Jyrki Alakuijala (jyrki at google dot com)

View File

@@ -1,3 +1,12 @@
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.
f4dc56fd disable GradientUnfilter_NEON
0d8e0588 img2webp: treat -loop as a no-op w/single images
b0450139 ReadImage(): restore size reporting
0ad3b4ef update ChangeLog (tag: v0.6.0-rc2)
6451709e img2webp,get_disto: fix image decode w/WIC builds
92504d21 get_disto: make ReadPicture() return a bool
c3e4b3a9 update NEWS

6
NEWS
View File

@@ -1,4 +1,4 @@
- 1/23/2017: version 0.6.0
- 1/26/2017: version 0.6.0
* lossless performance and compression improvements
* miscellaneous performance improvements (SSE2, NEON, MSA)
* webpmux gained a -duration option allowing for frame timing modification
@@ -8,6 +8,10 @@
- libwebp:
WebPPictureSharpARGBToYUVA
WebPPlaneDistortion
- libwebpmux / gif2webp:
WebPAnimEncoderOptions: kmax <= 0 now disables keyframes, kmax == 1
forces all keyframes. See mux.h and the gif2webp
manpage for details.
- 12/13/2016: version 0.5.2
This is a binary compatible release.

View File

@@ -85,10 +85,15 @@ static int ReadImage(const char filename[], WebPPicture* const pic) {
static int SetLoopCount(int loop_count, WebPData* const webp_data) {
int ok = 1;
WebPMuxError err;
uint32_t features;
WebPMuxAnimParams new_params;
WebPMux* const mux = WebPMuxCreate(webp_data, 1);
if (mux == NULL) return 0;
err = WebPMuxGetFeatures(mux, &features);
ok = (err == WEBP_MUX_OK);
if (!ok || !(features & ANIMATION_FLAG)) goto End;
err = WebPMuxGetAnimationParams(mux, &new_params);
ok = (err == WEBP_MUX_OK);
if (ok) {
@@ -101,6 +106,8 @@ static int SetLoopCount(int loop_count, WebPData* const webp_data) {
err = WebPMuxAssemble(mux, webp_data);
ok = (err == WEBP_MUX_OK);
}
End:
WebPMuxDelete(mux);
if (!ok) {
fprintf(stderr, "Error during loop-count setting\n");

View File

@@ -22,5 +22,5 @@ get_disto_LDADD += $(PNG_LIBS) $(JPEG_LIBS) $(TIFF_LIBS)
webp_quality_SOURCES = webp_quality.c
webp_quality_CPPFLAGS = $(AM_CPPFLAGS) $(USE_EXPERIMENTAL_CODE)
webp_quality_LDADD = ../imageio/libimageio_util.la
webp_quality_LDADD += ./libwebpextras.la
webp_quality_LDADD += libwebpextras.la
webp_quality_LDADD += ../src/libwebp.la

View File

@@ -27,12 +27,13 @@
#include "../imageio/image_dec.h"
#include "../imageio/imageio_util.h"
static int ReadPicture(const char* const filename, WebPPicture* const pic,
static size_t ReadPicture(const char* const filename, WebPPicture* const pic,
int keep_alpha) {
const uint8_t* data = NULL;
size_t data_size = 0;
WebPImageReader reader = NULL;
int ok;
int ok = ImgIoUtilReadFile(filename, &data, &data_size);
if (!ok) goto End;
pic->use_argb = 1; // force ARGB
@@ -40,20 +41,17 @@ static int ReadPicture(const char* const filename, WebPPicture* const pic,
// Try to decode the file using WIC falling back to the other readers for
// e.g., WebP.
ok = ReadPictureWithWIC(filename, pic, keep_alpha, NULL);
if (ok) return 1;
if (ok) goto End;
#endif
ok = ImgIoUtilReadFile(filename, &data, &data_size);
if (!ok) goto Error;
reader = WebPGuessImageReader(data, data_size);
ok = reader(data, data_size, pic, keep_alpha, NULL);
Error:
End:
if (!ok) {
fprintf(stderr, "Error! Could not process file %s\n", filename);
}
free((void*)data);
return ok;
return ok ? data_size : 0;
}
static void RescalePlane(uint8_t* plane, int width, int height,
@@ -228,6 +226,7 @@ static void Help(void) {
int main(int argc, const char *argv[]) {
WebPPicture pic1, pic2;
size_t size1 = 0, size2 = 0;
int ret = 1;
float disto[5];
int type = 0;
@@ -278,12 +277,10 @@ int main(int argc, const char *argv[]) {
Help();
goto End;
}
if (!ReadPicture(name1, &pic1, 1)) {
goto End;
}
if (!ReadPicture(name2, &pic2, 1)) {
goto End;
}
size1 = ReadPicture(name1, &pic1, 1);
size2 = ReadPicture(name1, &pic2, 1);
if (size1 == 0 || size2 == 0) goto End;
if (!keep_alpha) {
WebPBlendAlpha(&pic1, 0x00000000);
WebPBlendAlpha(&pic2, 0x00000000);
@@ -293,7 +290,8 @@ int main(int argc, const char *argv[]) {
fprintf(stderr, "Error while computing the distortion.\n");
goto End;
}
printf("%.2f %.2f %.2f %.2f %.2f\n",
printf("%u %.2f %.2f %.2f %.2f %.2f\n",
(unsigned int)size1,
disto[4], disto[0], disto[1], disto[2], disto[3]);
if (output != NULL) {

View File

@@ -1,5 +1,5 @@
.\" Hey, EMACS: -*- nroff -*-
.TH GIF2WEBP 1 "June 23, 2016"
.TH GIF2WEBP 1 "January 25, 2017"
.SH NAME
gif2webp \- Convert a GIF image to WebP
.SH SYNOPSIS
@@ -68,8 +68,9 @@ Specify the minimum and maximum distance between consecutive key frames
some key frames into the output animation as needed so that this criteria is
satisfied.
.br
A 'kmin' value of 0 will turn off insertion of key frames. A 'kmax' value of 0
will result in all frames being key frames.
A 'kmax' value of 0 will turn off insertion of key frames. A 'kmax' value of 1
will result in all frames being key frames. 'kmin' value is not taken into
account in both these special cases.
Typical values are in the range 3 to 30. Default values are kmin = 9,
kmax = 17 for lossless compression and kmin = 3, kmax = 5 for lossy compression.
.br

View File

@@ -248,6 +248,12 @@ static void VerticalUnfilter_NEON(const uint8_t* prev, const uint8_t* in,
}
}
// GradientUnfilter_NEON is correct but slower than the C-version,
// at least on ARM64. For armv7, it's a wash.
// So best is to disable it for now, but keep the idea around...
// #define USE_GRADIENT_UNFILTER
#if defined(USE_GRADIENT_UNFILTER)
#define GRAD_PROCESS_LANE(L) do { \
const uint8x8_t tmp1 = ROTATE_RIGHT_N(pred, 1); /* rotate predictor in */ \
const int16x8_t tmp2 = vaddq_s16(BC, U8_TO_S16(tmp1)); \
@@ -295,6 +301,8 @@ static void GradientUnfilter_NEON(const uint8_t* prev, const uint8_t* in,
}
}
#endif // USE_GRADIENT_UNFILTER
//------------------------------------------------------------------------------
// Entry point
@@ -303,7 +311,9 @@ extern void VP8FiltersInitNEON(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInitNEON(void) {
WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_NEON;
WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter_NEON;
#if defined(USE_GRADIENT_UNFILTER)
WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter_NEON;
#endif
WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter_NEON;
WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter_NEON;

View File

@@ -279,7 +279,8 @@ extern void WebPRescalerDspInitMIPS32(void);
WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMIPS32(void) {
WebPRescalerImportRowExpand = ImportRowExpand;
WebPRescalerImportRowShrink = ImportRowShrink;
// WebPRescalerImportRowShrink = ImportRowShrink;
(void)ImportRowShrink;
WebPRescalerExportRowExpand = ExportRowExpand;
WebPRescalerExportRowShrink = ExportRowShrink;
}

View File

@@ -129,14 +129,13 @@ static void SanitizeEncoderOptions(WebPAnimEncoderOptions* const enc_options) {
DisableKeyframes(enc_options);
}
if (enc_options->kmin <= 0) {
DisableKeyframes(enc_options);
print_warning = 0;
}
if (enc_options->kmax <= 0) { // All frames will be key-frames.
if (enc_options->kmax == 1) { // All frames will be key-frames.
enc_options->kmin = 0;
enc_options->kmax = 0;
return;
} else if (enc_options->kmax <= 0) {
DisableKeyframes(enc_options);
print_warning = 0;
}
if (enc_options->kmin >= enc_options->kmax) {

View File

@@ -21,7 +21,7 @@
extern "C" {
#endif
#define WEBP_MUX_ABI_VERSION 0x0107 // MAJOR(8b) + MINOR(8b)
#define WEBP_MUX_ABI_VERSION 0x0108 // MAJOR(8b) + MINOR(8b)
//------------------------------------------------------------------------------
// Mux API
@@ -430,9 +430,10 @@ struct WebPAnimEncoderOptions {
// frames in the output. The library may insert some key
// frames as needed to satisfy this criteria.
// Note that these conditions should hold: kmax > kmin
// and kmin >= kmax / 2 + 1. Also, if kmin == 0, then
// key-frame insertion is disabled; and if kmax == 0,
// then all frames will be key-frames.
// and kmin >= kmax / 2 + 1. Also, if kmax <= 0, then
// key-frame insertion is disabled; and if kmax == 1,
// then all frames will be key-frames (kmin value does
// not matter for these special cases).
int allow_mixed; // If true, use mixed compression mode; may choose
// either lossy and lossless for each frame.
int verbose; // If true, print info and warning messages to stderr.