Commit Graph

3933 Commits

Author SHA1 Message Date
Vincent Rabaud
c0648ac2ae When compiling as C++, avoid narrowing warnings.
The gcc compilation warning was: narrowing conversion from ‘int’ to ‘int8_t’

Change-Id: I4803dd60ad04060cdb5d61a1aa98b25215b9d4eb
2017-01-12 13:39:22 +01:00
Pascal Massimino
0d55f60c91 40% faster ApplyAlphaMultiply_SSE2
process four pixels at a time

Change-Id: I1dee7f70772be4915654fc6638ef4729a1a239d4
2017-01-12 02:33:09 -08:00
Pascal Massimino
49d0280df1 NEON: implement several alpha-processing functions
- ApplyAlphaMultiply
 - DispatchAlpha
 - DispatchAlphaToGreen
 - ExtractAlpha

Decoding to Argb / rgbA / ... is 10-15% faster (measured on N4)

new file: alpha_processing_neon.c

Change-Id: I40f1a809e9885d1031ff0bc886d8d001efa66bca
2017-01-11 17:39:29 +01:00
Pascal Massimino
48b1e85fbe SSE2: 15% faster alpha-processing functions
ApplyAlphaMultiply / MultARGBRow / MultRow

we use now: x/255 = (x * 0x8081) >> (16 + 7)
and x/255 + .5 = ((x + 128) * 0x0101) >> 16

Change-Id: I8931091316ffc8bbf65aa3402f2e7d2b800e1971
2017-01-11 15:35:16 +01:00
Pascal Massimino
e3b8abbc9b fix warning from static analysis.
"-1 cannot be represented in type 'unsigned int'"

Change-Id: I05abcb44af68f702ead5a7f24dc14aab31a2e4d9
2017-01-10 22:59:47 -08:00
Pascal Massimino
28fe054e73 SSE2: 30% faster ApplyAlphaMultiply()
and 15% faster MultARGBRow()

by switching to formulae:
    X / 255 = (X + 1 + (X >> 8)) >> 8 for any 16bit value X.
   (X / 255 + .5) = (XX + (XX >> 8)) >> 8, with XX = X + 128

Change-Id: Ia4a7408aee74d7f61b58f5dff304d05546c04e81
2017-01-10 23:34:22 +01:00
Vincent Rabaud
f44acd253b Merge "Properly compute the optimal color cache size." 2017-01-10 21:14:16 +00:00
Vincent Rabaud
527844fee0 Properly compute the optimal color cache size.
The previous optimization was performing dichotomy on a function that
is anything in practice, hence a bit of randomness.
Also, two magic constants were used, one for an extra constant cost,
one for an extra linear cost. Both values/models were empirical.

A brute force search for the best cache size is now performed.

To have less CPU impact, a speed optimization is also made by not
inserting a value again and again.
This makes sense but it's also the most common case of when LZ77 is
useful hence an overall improvement sometimes.

Change-Id: I57de5750ad2313b2feecbcd15cd6e4feeb98e5c8
2017-01-10 21:44:53 +01:00
Pascal Massimino
be0ef6395f fix a comment typo
Change-Id: I0fabd08cd8abd3cea7ddfd2e498507adb0d3c67e
2017-01-10 21:17:13 +01:00
Vincent Rabaud
8874b16275 Fix a non-deterministic color cache size computation.
In case of impossible allocation, some value was returned while
computation should be stopped.

Change-Id: I5f85e264575be825e4261ab6fa63840c157cf5c2
2017-01-10 18:53:19 +01:00
Vincent Rabaud
d712e20de0 Do not allow a color cache size bigger than the number of colors.
This is purely for speed optimization.

Change-Id: Ie4b4380df8a5afa90574012bacdb1ddad03f320e
2017-01-10 09:25:02 +01:00
Vincent Rabaud
ecff04f625 re-introduce some comments in Huffman Cost.
Change-Id: I2396bbc58628dd12a2d36068f7193e2a6eb4d166
2017-01-06 13:17:14 +01:00
Pascal Massimino
259e98286a replace 'ptr + y * stride' by 'ptr += stride'
This is to prevent potential overflow.

Change-Id: I9d21cfe790ba975bd5e117b025ea4d9deaeae4ab
2017-01-04 00:54:23 -08:00
Pascal Massimino
00b08c88c0 Merge "NEON: 5% faster conversion to RGB565 and RGBA4444" 2016-12-22 08:39:01 +00:00
Pascal Massimino
0e7f444702 Merge "NEON: faster fancy upsampling" 2016-12-21 14:53:24 +00:00
Pascal Massimino
b016cb91c5 NEON: faster fancy upsampling
2-3% faster decoding overall

Change-Id: I2c53e50dc7e0ade5245cff8cc5d7b96a14062955
2016-12-21 15:23:54 +01:00
Vincent Rabaud
1cb638010c Call the C function to finish off lossless SSE loops only when necessary.
Change-Id: I4e221d80879dc9c90c24d69a40bc5811d73787ad
2016-12-21 14:25:54 +01:00
Vincent Rabaud
875fafc191 Implement BundleColorMap in SSE2.
Change-Id: I44cd23647bd0a49330b6b2b3ed08050a5500e58e
2016-12-21 10:44:31 +01:00
Vincent Rabaud
3674d49e63 Merge "remove Clang warnings with unused arch arguments." 2016-12-21 09:43:24 +00:00
James Zern
f04eb37603 libwebp-0.5.2
- 12/13/2016: version 0.5.2
   This is a binary compatible release.
   This release covers CVE-2016-8888 and CVE-2016-9085.
   * further security related hardening in the tools; fixes to
     gif2webp/AnimEncoder (issues #310, #314, #316, #322), cwebp/libwebp (issue
     #312)
   * full libwebp (encoder & decoder) iOS framework; libwebpdecoder
     WebP.framework renamed to WebPDecoder.framework (issue #307)
   * CMake support for Android Studio (2.2)
   * miscellaneous build related fixes (issue #306, #313)
   * miscellaneous documentation improvements (issue #225)
   * minor lossy encoder fixes and improvements
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYWfopAAoJEPnD1r24Iytd0gAQALhTSEjJVmKfHxyPNDduc3kn
 QeiVaVwPiOS/a266+ZnWHzCvkR3zgqZxNlyKzRty378gM8/P7r2dMCmfdnVFbF4O
 a7M1lld9yYldNpAxvHDnY9u2RzmRfVD1yYu27gv77uT7gR2IybQ81FHi1pn56tFA
 2g4yHdrC2tXud22ZUb9Bgqe7YW06gWND4EmeJgxF38S98gdrtJla5rmlUcuEhbIl
 SHpkbEgJX4nZxWggyCJ61/OxeEwwWBtI3kpSLkEqmCVSnFb7WBC7pITq59n8hg2U
 SaYCfWGRJ/oQQvxUxuPYYtzq26dYOxd2vT9S1mcE1be9jMGxKp9vgE8jNflvtza1
 wTPUajaPUjsTLAvFikQRo+34W9QxOKp9jCX9Be0V4wvBClfM13toBgKolzPGGUuo
 zlcZ0/GgzwfQ+sD7bs/p/7ToiH+GejBUK7FUR8ZB7EHZrDynszSzEevx5SUzPWV3
 1q4TyD5eclUOjb4S2yplcKp0kwkwtOA5ETboPzA+b8TQnfTFM3GP7fMoYvORbSZp
 39/H5hi1bjlOE4m3mp3qqfR2DMWZlla7YNZiuuTEeY3ztrlqeakC2ma1Fhi6ZmbG
 TrqmAaDTueRizry4E7Fr9sBw0mee14v/xcTFcDcSI1BRFclFc1KAw0ObzdaN2iEt
 L5tjlqzH0XEH4fl5OnD3
 =x+Y3
 -----END PGP SIGNATURE-----

Merge tag 'v0.5.2'

libwebp-0.5.2
- 12/13/2016: version 0.5.2
  This is a binary compatible release.
  This release covers CVE-2016-8888 and CVE-2016-9085.
  * further security related hardening in the tools; fixes to
    gif2webp/AnimEncoder (issues #310, #314, #316, #322), cwebp/libwebp (issue
    #312)
  * full libwebp (encoder & decoder) iOS framework; libwebpdecoder
    WebP.framework renamed to WebPDecoder.framework (issue #307)
  * CMake support for Android Studio (2.2)
  * miscellaneous build related fixes (issue #306, #313)
  * miscellaneous documentation improvements (issue #225)
  * minor lossy encoder fixes and improvements

* tag 'v0.5.2': (54 commits)
  update ChangeLog
  anim_util: quiet implicit conv warnings in 32-bit
  jpegdec: correct ContextFill signature
  Remove some errors when compiling the code as C++.
  vwebp: clear canvas during resize w/o animation
  tiffdec: restore libtiff 3.9.x compatibility
  update NEWS
  AnimEncoder: avoid freeing uninitialized memory pointer.
  WebPAnimEncoder: If 'minimize_size' and 'allow_mixed' on, try lossy + lossless.
  fix a potential overflow with MALLOC_LIMIT
  bump version to 0.5.2
  update AUTHORS & .mailmap
  iosbuild.sh: add WebPDecoder.framework + encoder
  AnimEncoder: Correctly skip a frame when sub-rectangle is empty.
  Fix assertions in WebPRescalerExportRow()
  fix a typo in WebPPictureYUVAToARGB's doc
  systematically call WebPDemuxReleaseIterator() on dec->prev_iter_
  doc: use two's complement explicitly for uint8->int8 conversion
  Anim_encoder: correctly handle enc->prev_candidate_undecided_
  WebPPictureDistortion(): free() -> WebPSafeFree()
  ...

Change-Id: I16bcf54af41ce8fad98d4fbc8aa1df58f338fc23
2016-12-20 20:14:55 -08:00
Pascal Massimino
341d711c43 NEON: 5% faster conversion to RGB565 and RGBA4444
We use the magic 'shift and insert' instruction instead of
the multiple shifts and or's.

Change-Id: I48df0320668b502a91792defc0423a9441669d19
2016-12-20 17:01:48 +01:00
Vincent Rabaud
abb5482731 remove Clang warnings with unused arch arguments.
This is duplicating code from compiler flag checking that was once
added (then reverted to CMake) as the problem seem to be on the
clang side as detailed in:
http://public.kitware.com/Bug/view.php?id=13194

I also tried to remove a similar warning with pthreads but there
is also an issue on the clang side:
https://llvm.org/bugs/show_bug.cgi?id=7798

Change-Id: I5b0061f0f71e49b493c5ee0c98f70533c28164bd
2016-12-20 10:03:55 +01:00
James Zern
ece9684f52 update ChangeLog
Change-Id: I0d8730f3f5fb0b54404666bc0088fe29a3e55fc4
2016-12-15 15:44:21 -08:00
James Zern
aa7744ca38 anim_util: quiet implicit conv warnings in 32-bit
the sizes are already validated by CheckSizeForOverflow(), add casts to
size_t to avoid -Wshorten-64-to-32

Change-Id: Ida9102c2104f4a334a0ad16d6e01a12bedfd4eec
(cherry picked from commit 1e2e25b0d4)
2016-12-15 11:51:44 -08:00
James Zern
d9120271e7 jpegdec: correct ContextFill signature
fill_input_buffer returns a boolean

Change-Id: I208a1a862fa6c57cb5b73568b84055f734c1c36f
(cherry picked from commit cec7201447)
2016-12-15 11:51:28 -08:00
Vincent Rabaud
24eb39401b Remove some errors when compiling the code as C++.
This fixes some cases from
https://bugs.chromium.org/p/webp/issues/detail?id=137

Change-Id: I58f3a617bf973dbe4c5794004a01e2aea39ba53a
(cherry picked from commit 28ce304344)
2016-12-15 11:50:44 -08:00
James Zern
a4a8e5f32c vwebp: clear canvas during resize w/o animation
this corrects the checkboard pattern displayed with transparent images

Change-Id: I5f46dbc9fa3893d61f5f1d4fda643ac030238f94
(cherry picked from commit 67c25ad5b4)
2016-12-14 11:26:24 -08:00
James Zern
67c25ad5b4 vwebp: clear canvas during resize w/o animation
this corrects the checkboard pattern displayed with transparent images

Change-Id: I5f46dbc9fa3893d61f5f1d4fda643ac030238f94
2016-12-13 23:21:33 -08:00
Pascal Massimino
a4bbe4b38b fix indentation
Change-Id: I5593fb2441f253c6b8cc43949c11909f19184b55
2016-12-13 22:50:29 -08:00
James Zern
31ca2a8098 tiffdec: restore libtiff 3.9.x compatibility
use tsize_t which is equivalent (for now) to tmsize_t added in version 4

Change-Id: I7489ef7b39d9a3692a4b952de22476b245240ed1
2016-12-13 22:50:28 -08:00
James Zern
b2f77b57a9 update NEWS
Change-Id: Ie74e9331378a254cc2265eaa1c94101db767e411
2016-12-13 18:51:20 -08:00
hui su
5ab6d9de1f AnimEncoder: avoid freeing uninitialized memory pointer.
In GenerateCandidates(), when candidate_ll->evaluate_ and
candidate_lossy->evaluate_ are both true, if lossless encoding
exits on error, candidate_ll->evaluate_ would not be correctly
reset. This will cause freeing uninitialized memory pointer in
SetFrame().

BUG=webp:322

Change-Id: I481b49a186e4fa3607ce71b4543a481083edf444
(cherry picked from commit 3ebe1c0003)
2016-12-13 18:18:57 -08:00
Urvang Joshi
f29bf582df WebPAnimEncoder: If 'minimize_size' and 'allow_mixed' on, try lossy + lossless.
This improves compression by ~5% at default quality.

If only 'allow_mixed' is on (but 'minimize_size' isn't), we continue to
use a heuristic to try one of the two or both.

Change-Id: Ia573a73ea26ad25f9debff759eed69d2b0449e82
(cherry picked from commit 3f4042b52a)
2016-12-13 18:18:48 -08:00
hui su
3ebe1c0003 AnimEncoder: avoid freeing uninitialized memory pointer.
In GenerateCandidates(), when candidate_ll->evaluate_ and
candidate_lossy->evaluate_ are both true, if lossless encoding
exits on error, candidate_ll->evaluate_ would not be correctly
reset. This will cause freeing uninitialized memory pointer in
SetFrame().

BUG=webp:322

Change-Id: I481b49a186e4fa3607ce71b4543a481083edf444
2016-12-13 17:39:16 -08:00
Pascal Massimino
df780e0eac fix a potential overflow with MALLOC_LIMIT
BUG=webp:321

Change-Id: Iab89dfe167fb394fcdffd3b2732d4ac9bef764b0
(cherry picked from commit 76bbcf2ed6)
2016-12-13 16:15:28 -08:00
Pascal Massimino
58fc507842 Merge "PredictorSub: implement fully-SSE2 version" 2016-12-13 11:03:13 +00:00
Pascal Massimino
9cc421675b PredictorSub: implement fully-SSE2 version
and inline the C-version too.

Predictor #13 is still a hard one.

Change-Id: Iedecfb5cbf216da4e28ccfdd0810286133f42331
2016-12-13 02:19:35 -08:00
Pascal Massimino
0aa1f35c0f remove dependency of imageio/ to stopwatch.h
Change-Id: I9b8e3909e97a26644b5ba6cbd9b29b8ef1727ba7
2016-12-12 22:49:19 -08:00
Pascal Massimino
cb9ec84b54 Merge "remove the dependency to stop_watch.[ch] in imageio" 2016-12-13 06:48:07 +00:00
Pascal Massimino
dc0c01fbd3 Merge "anim_util: quiet implicit conv warnings in 32-bit" 2016-12-13 06:14:56 +00:00
Pascal Massimino
827d3c5038 Merge "fix a potential overflow with MALLOC_LIMIT" 2016-12-13 06:10:56 +00:00
James Zern
1e2e25b0d4 anim_util: quiet implicit conv warnings in 32-bit
the sizes are already validated by CheckSizeForOverflow(), add casts to
size_t to avoid -Wshorten-64-to-32

Change-Id: Ida9102c2104f4a334a0ad16d6e01a12bedfd4eec
2016-12-12 19:06:14 -08:00
James Zern
218460cdd7 bump version to 0.5.2
libwebp{,decoder} - 0.5.2
libwebp libtool - 6.2.0
libwebpdecoder libtool - 2.2.0

mux - 0.3.2
libtool - 2.2.0

demux - 0.3.1
libtool - 2.1.0

Change-Id: Idf199415c325e6e9d157459a4e016ebba88c3f34
2016-12-12 17:36:12 -08:00
James Zern
de7d654d0d update AUTHORS & .mailmap
Change-Id: If4d71ede51f91959e4990f3455c781a8bcf4d373
2016-12-12 17:36:09 -08:00
Pascal Massimino
273367c130 Merge "dsp/lossless.c,cosmetics: fix indent" 2016-12-12 22:30:45 +00:00
Pascal Massimino
76bbcf2ed6 fix a potential overflow with MALLOC_LIMIT
BUG=webp:321

Change-Id: Iab89dfe167fb394fcdffd3b2732d4ac9bef764b0
2016-12-12 13:40:40 -08:00
Pascal Massimino
8ac1abfe13 Merge "jpegdec: correct ContextFill signature" 2016-12-12 21:07:18 +00:00
Pascal Massimino
cb215aed5c remove the dependency to stop_watch.[ch] in imageio
Passing the 'verbose' flag to DecodeWebP() wasn't mandated,
and was creating a forced dependency between imageio/ and examples/

Change-Id: Ib3d3f381a7b699df369a97cfb44360580422df11
2016-12-12 22:01:36 +01:00
James Zern
2423017a28 dsp/lossless.c,cosmetics: fix indent
after:
fbba5bc optimize predictor #1 in plain-C For some reason, gcc has hard
time inlining this one...

Change-Id: I2e2416593acd4c9d14958d8757bfd284d999100b
2016-12-12 12:53:23 -08:00
James Zern
74a12b10d9 iosbuild.sh: add WebPDecoder.framework + encoder
WebPDecoder.framework replaces WebP.framework as the decode-only
framework.
WebP.framework now includes the full library allowing for use of the
encoder.

BUG=webp:307

Change-Id: Ic8139f201576bf94b0d4a31cb7cad0655cd8ba97
(cherry picked from commit 1d5046d1f9)
2016-12-12 12:50:49 -08:00