Commit Graph

4100 Commits

Author SHA1 Message Date
Pascal Massimino
8870ba7f06 Fix skia bug #10952
The offset *can* be negative, but the sanitizer reports strange
address behaviour when row_offset is unsigned size_t.

For safety, use int64_t instead (probably overkill. int32_t is probably ok).

Change-Id: I1bd424bfdb5447b3839f40679581d6bdea075320
2020-11-18 14:59:34 +01:00
Wan-Teh Chang
4b3c6953ef Detect if StoreFrame read more than anmf_payload_size bytes
After ParseAnimationFrame() calls StoreFrame(), check if StoreFrame() reads
more than anmf_payload_size bytes from dmux->mem_. Treat that as PARSE_ERROR.

Change-Id: I0d03885c19d32792af78de7bed1a944ca01f1dc6
2020-11-17 07:57:24 +01:00
James Zern
17fd4ba820 webp/decode.h,cosmetics: normalize 'flip' comment
have it match the other boolean options with 'if true...'

Change-Id: I5a3e7c17b35a21fc5146ecaf10e226486a2dc740
2020-10-29 16:00:44 -07:00
James Zern
411d3677ca remove some unreachable break statements
following a goto.
+ enable -Wunreachable-code-aggressive if available

Change-Id: I0312800d84d8984dbc51925600ed5d7d438413fd
2020-10-26 18:45:24 -07:00
James Zern
3700ffd7e1 WebPPictureHasTransparency: remove unreachable return
Change-Id: Ia8077918b5110fb7fc74f326d4d16b38d9ed1b38
2020-10-26 15:52:20 -07:00
James Zern
83604bf3ac {animencoder,enc_dec}_fuzzer: convert some abort()s to returns
with functions that can legitimately fail when under memory pressure the
fuzzer should exit gracefully rather than abort().

+ add some more error detail to output

Bug: chromium:1140448
Change-Id: I1a8582a939e0a5b2b8631c95c0464658c99063e2
2020-10-21 10:48:05 -07:00
James Zern
eb44119c3d Merge changes I8ae09473,I678c8b1e
* changes:
  fuzz_utils.h: rename max() to Max()
  fuzz_utils.h: make functions WEBP_INLINE
2020-10-19 21:56:35 +00:00
James Zern
9f6055fcb2 fuzz_utils.h: rename max() to Max()
avoids conflict with windows.h define

Bug: webp:409
Change-Id: I8ae0947365e7071d8ebe1d682c9211882cc2fd89
2020-10-17 16:40:58 -07:00
James Zern
695788e7f5 fuzz_utils.h: make functions WEBP_INLINE
+ add some warnings and avoid overriding implicit %.c, %.cc patterns in
makefile.unix

Bug: webp:409
Change-Id: I678c8b1ed630ebb9114208c20b794d2eefdca5a1
2020-10-17 10:49:26 -07:00
Pascal Massimino
906c1fcd61 make ImgIoUtilReadFile use WebPMalloc instead of malloc
This is a minor technical change in API in case a special allocator
was used in WebPMalloc.

Change-Id: Idb78a9150d006f158c1a9538525097749e42e7f7
2020-10-16 15:40:13 +02:00
James Zern
8cb7e536d2 rename demux_api_fuzzer.c -> mux_demux_api_fuzzer.c
this better matches the file's contents

Bug: webp:409
Change-Id: I693795370c0d1af198971693b4ff15a57d996c4b
2020-10-15 16:50:25 -07:00
James Zern
443db47d91 add animdecoder_fuzzer.cc
Bug: webp:409
Change-Id: Iade1e6b1288faad9076f72c21c1bde5a6bbfc7e0
2020-10-14 19:44:19 -07:00
James Zern
36a6eea3bc Merge "import fuzzers from oss-fuzz/chromium" 2020-10-14 22:12:27 +00:00
James Zern
ec5f12c11a Makefile.vc: remove deprecated /Gm option
this was only used in debug builds, the build should be fast enough in
either case.

https://docs.microsoft.com/en-us/cpp/build/reference/gm-enable-minimal-rebuild?view=vs-2019
/Gm is deprecated. It may not trigger a build for certain kinds of
header file changes. You may safely remove this option from your
projects. To improve build times, we recommend you use precompiled
headers and incremental and parallel build options instead.

Change-Id: I8e3c0e7cc82e10bd1d2b0904d290fe4e050ebe8b
2020-10-14 13:22:23 -07:00
James Zern
64425a0884 picture_tools_enc: fix windows build warning
with WebPReplaceTransparentPixels() function signature:

src\enc\picture_tools_enc.c(86): warning C4028: formal parameter 1
different from declaration

Change-Id: I0140d61b0dfebcbb4189707e8f2f4b1af802a4d7
2020-10-14 13:13:53 -07:00
James Zern
bd94090a11 import fuzzers from oss-fuzz/chromium
+ a simple makefile + README

these were mostly equivalent, chromium added support for
WEBP_REDUCE_CSP.

the file names were normalized as follows:

fuzz_advanced_api.{c,cc} -> advanced_api_fuzzer.c
fuzz_animation_api.{c,cc} -> animation_api_fuzzer.c
fuzz_webp_animencoder.cc -> animencoder_fuzzer.cc
fuzz_demux_api.{c,cc} -> demux_api_fuzzer.c
fuzz_webp_enc_dec.cc -> enc_dec_fuzzer.cc
fuzz.h -> fuzz_utils.h
fuzz_simple_api.{c,cc} -> simple_api_fuzzer.c

Bug: webp:409
Change-Id: Ib997f0c92f25f8a1f91da83790298cd848b61a5d
2020-10-13 18:31:08 -07:00
James Zern
cf847cba58 use WEBP_DSP_INIT_FUNC for Init{GammaTables*,GetCoeffs}
this provides stronger synchronization when pthreads are available as
was done in 'd77bf512 add WEBP_DSP_INIT / WEBP_DSP_INIT_FUNC' for the
other init functions.

Change-Id: I2ffe4e24454d276c2411ece34dca38d23d4756d5
2020-09-11 11:57:51 -07:00
Skal
55a080e50a Add WebPReplaceTransparentPixels() in dsp
with SSE2 implementation.

(Extracted from side experiment)

Change-Id: I62d457fb6643645291cffd6d2d205d4a5ffa4517
2020-09-09 08:15:22 +02:00
James Zern
84739717d6 GetBackgroundColorGIF: promote to uint32_t before << 24
quiets a signed integer overflow warning

Change-Id: Ie4dd957e9fa7c6e639c2e887c448ecbba7d50a9e
2020-09-03 15:45:05 -07:00
Yannis Guyon
def64e920f cwebp: Fix -print_psnr for near_lossless
The output was always 99dB because the lossless pipeline is not
modifying the 'picture'. Changing that is not that simple because
near_lossless impacts both VP8ApplyNearLossless() and
ApplyPredictFilter(); the latter cannot be applied as is to the input
and thus the final modified 'picture' cannot be easily retrieved
without decoding the encoded bitstream. Hence ReadWebP() is called in
cwebp.c on the encoded bitstream kept in memory to get the correct
distortion.

However -get_psnr returns a different distortion than get_disto for
lossy encoding configurations because cwebp loads the source as YUV
while get_disto directly reads it as RGB without conversion loss.

Change-Id: I5c32cf8f89eb137973dc7eebda747682d921b8e2
2020-08-17 11:37:37 +02:00
Vincent Rabaud
cf2f88b38f Add palette and spatial for q >= 75 and -m 5
Change-Id: I12198b7eb82a4247e606bc60342595abf4d6eee0
2020-06-17 12:51:40 +02:00
Vincent Rabaud
f0110baec0 Add no-color cache configuration to the cruncher
Fix another pessimization found by the pingo image compressor.

Refactoring is necessary to make LZ77 computation
common to cache or no-cache analysis.
Slower by 1.7x instead of 2x

Change-Id: I396701ea6e88543dbfe9471eb552877f6c8ce1e3
2020-06-09 19:04:44 +02:00
Vincent Rabaud
749a8b99f7 Better estimate of the cache cost.
Change-Id: I171a8f80f1597bbdeb724957e789b947df3c2885
2020-06-05 16:07:58 +02:00
Vincent Rabaud
4f9f00ccf4 Use spatial predictors on top of palette no matter what.
This is fixing another inefficiency found by the pingo image optimizer.

Change-Id: Icecb0d39fcbd17b403667e8e2095c7705b1dd493
2020-06-04 18:03:57 +02:00
Vincent Rabaud
7658c68613 Add spatial prediction on top of palette in cruncher.
Change-Id: I3765ab628ef915eedf2e541a80c65ce9880dff36
2020-06-04 14:38:08 +02:00
Vincent Rabaud
133ff0e374 webp_js: force WASM=0 option explicitly
It's apparently no longer the default.

BUG=webp:470

Change-Id: Ic3219f2df2f19783ccea116e87bbefee29fe5edc
2020-05-29 14:56:34 +02:00
Vincent Rabaud
e3c259a278 Fix integer overflow in EmitFancyRGB.
+ enhance the assert in WebPCopyPlane()

Change-Id: Id9b01d00a8dce6caf0d4721a6fbe8def40b8bb85
2020-05-05 14:57:19 +02:00
James Zern
b3ff0bdec1 man/{gif2,img2}webp,webpmux: normalize some wording
Change-Id: Iced9d3dfdaff0356499d4e872c20255edea7bd0b
2020-05-01 10:31:39 -07:00
Pascal Massimino
f9b30586eb fix ABI breakage introduced by 6a0ff358
qmin / qmax are now using the pad[] spot at the end of the struct,
 and we don't need to bump the ABI major number.

Change-Id: I41adcaf1600b29a5a05c9fe380bfd977cf425124
2020-04-21 19:17:56 +00:00
James Zern
1d58dcfc17 README.webp_js: update note about emscripten version
keep the minimum, but recommend the latest so we don't need to update
this in the future.

BUG=webp:463

Change-Id: I0615039323d3c77684c6be2e890514f6973cf535
2020-04-16 17:58:26 -07:00
James Zern
4407026621 README.webp_js: s/fastcomp/upstream/
the fastcomp backend is deprecated:
https://emscripten.org/docs/compiling/WebAssembly.html?highlight=fastcomp#backends

Change-Id: Ib1ea46ff97f24f5115555c76980cf837461208ba
2020-04-15 19:59:45 -07:00
James Zern
2565fa8ffb README.webp_js: update cmake command
remove EMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES, this option is only
supported with the deprecated fastcomp backend; the wasm version will
begin to throw an error if it's used. 1.39.12 already fails to build when
using this option.

+ fix a typo

BUG=webp:463

Change-Id: I7175df4d5b2b6cb6aaf20eb41063c09c03b9b69a
2020-04-15 19:53:12 -07:00
Yannis Guyon
47309ef52d webp: WEBP_OFFSET_PTR()
Removes undefined behavior of offsetting NULL.

Change-Id: I7c83d0c913c631c091a5fb128f6d6b46b1d116db
2020-03-20 11:39:06 +01:00
James Zern
687ab00e6e DC{4,8,16}_NEON: replace vmovl w/vaddl
4/8/16 fewer instructions

Change-Id: I38fe08722e7b839e3f3e0bf4df7e0fa8e7a0138f
2020-03-05 09:41:14 -08:00
James Zern
1b92fe75a1 DC16_NEON,aarch64: use vaddlv
saves 3 instructions, neutral to mildly faster on a pixel 3a

Change-Id: I6ae57e8e38d4149167ea14e27cd2b32113b4f8e7
2020-03-04 23:12:20 -08:00
James Zern
53f3d8cf7e dec_neon,DC8_NEON: use vaddlv instead of movl+vaddv
one fewer instruction

Change-Id: I2f599fd6f9eebbb0cab81ae9855244fc401d4323
2020-03-04 15:46:38 -08:00
Yannis Guyon
27d082403c Fix integer overflow in WebPAnimDecoderGetNext()
Change-Id: Ic53263b6125ca125d5fb3791474eab78043fec18
2020-02-27 20:23:37 +01:00
Pascal Massimino
69776e3832 Merge "remove call to MBAnalyzeBestIntra4Mode for method >= 5" 2020-02-08 16:15:27 +00:00
Skal
a99078c1cf remove call to MBAnalyzeBestIntra4Mode for method >= 5
this was not giving a good alpha value, making the method 5/6 a little
blurrier than method 4 (!).

Change-Id: I69b9890dea21499c1af1753e87d9f7adf8b433de
2020-02-07 14:38:13 +01:00
James Zern
22e404ccbd CMakeLists.txt: fix set(CACHE) argument order
<type> comes before <docstring>

Change-Id: Iad8cfbbab452381969a7b36aaf244b6abc4fc974
2020-02-06 20:27:01 -08:00
Skal
71690b524e fix MSVC warning
"warning C4244: '=': conversion from 'const int' to 'float', possible loss of data"

Change-Id: Ie0769e50c19efd48332ffeadb026d4538fec9919
2020-01-30 09:25:26 +01:00
Skal
6a0ff35872 Enc: add a qmin / qmax range for quality factor
This is particularly useful for multi-pass search (but not only),
to prevent the search from going over or below a reasonable threshold.
E.g.: 'cwebp -qrange 50 80 ...' will prevent any unreasonable degradation.

new cwebp option: -qrange min max

Change-Id: I59f394533535fc20b6996bc0895f4301476d5eff
2020-01-29 14:52:02 +01:00
James Zern
0fa56f307f libwebp-1.1.0
- 12/18/2019: version 1.1.0
   * API changes:
     - libwebp:
       WebPMalloc (issue #442)
     - extras:
       WebPUnmultiplyARGB
   * alpha decode fix (issue #439)
   * toolchain updates and bug fixes
     (chromium: #1026858, #1027136, #1027409, #1028620, #1028716, #995200)
     (oss-fuzz: #19430, #19447)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAl4TyZcACgkQ+cPWvbgj
 K104/hAAilifYCn1sUdoCShS2/trJiRr1RywfRQdlpCDcZcrJpNJhCMRXSPveXtB
 qzVjxj5b1YB5z3Ungp2qvfzCl9zWkpoSvliZdsp7XBgtmXTA5Sac68E4QW7dfPOP
 C0YxG8m3hnJ7pFFZFMgXA3v8UXGUKSMNclZPSwGILKHR0txd8FLt1t/VW4z9+9Yw
 78eU+Wbl2sE2QgNRhatYPWB/M2iFmTnMOylR9lAzynf4BFEbBO+gp2liQuQqElkn
 dzJWCm3OCdp8fyNWzYd0tw/X4/3wqdbrlueXny+y+98lY1Q0zWXYSvexJrsSAt/B
 oKaaG/6NfgikWEcS6hfwcbjG6J1mbYPRZqnjk4yRVijYIAEVJXgKoCrFF5qIp7tl
 F35rAQ/ml3JVSUxk200HeKIvWtVlhM6ID9pwa+CRUdEgLffqZ2/Usuxec6mTqELY
 18U5DTBM7r302lMsjaUTIuzA/QkEjPC+G+Lm2lmMMkjBNfU3amG3dKWqsKL+Dfcj
 5AELdL4H8IPftMj4yhrNiywc7Imr0SItQpwglh9vSBeFo6+IFf/jkKu/UwcMn1O6
 5irTNnnJX/cAT9pIx2KERs1HhZO8/bHlpiaO7umHWeD97zTbPF+NJzcBe23CN5vj
 an9pkMo7o0l8sq/QMyqWxic9Luzql/a7B1M9k9uLIM5t9YCwxg4=
 =cVn5
 -----END PGP SIGNATURE-----

Merge tag 'v1.1.0'

libwebp-1.1.0

- 12/18/2019: version 1.1.0
  * API changes:
    - libwebp:
      WebPMalloc (issue #442)
    - extras:
      WebPUnmultiplyARGB
  * alpha decode fix (issue #439)
  * toolchain updates and bug fixes
    (chromium: #1026858, #1027136, #1027409, #1028620, #1028716, #995200)
    (oss-fuzz: #19430, #19447)

* tag 'v1.1.0':
  update ChangeLog
  Makefile.vc: fix webp_quality.exe link
  update NEWS
  bump version to 1.1.0
  update AUTHORS

BUG=webp:441

Change-Id: Ie4ae80a736c795549e7f0fc8942a293fa724d475
2020-01-06 16:31:09 -08:00
Pascal Massimino
6cf504d018 PNM decoding: handle max_value != 255
also add support for PAM's GRAYSCALE_ALPHA tuple (with depth = 2)

BUG=webp:449

Change-Id: I0fe4825cd1d5487b9f7af332c7d3d56c1b35c3fb
2020-01-06 23:48:40 +01:00
James Zern
d7844e9762 update ChangeLog
BUG=webp:441

Change-Id: Ib401d468c677b9e598ffcec6535a846bf2456a4f
2019-12-21 05:37:43 -08:00
James Zern
7f0064361a Makefile.vc: fix webp_quality.exe link
when building a dll based libwebp include the dsp private symbols that
WebPUnmultiplyARGB requires

Change-Id: I7cf7da0b20d6cf6740219c8562380926a0abd93c
(cherry picked from commit cf047e8347)
2019-12-20 16:29:22 -05:00
James Zern
cf047e8347 Makefile.vc: fix webp_quality.exe link
when building a dll based libwebp include the dsp private symbols that
WebPUnmultiplyARGB requires

Change-Id: I7cf7da0b20d6cf6740219c8562380926a0abd93c
2019-12-20 08:55:37 -08:00
James Zern
c074c65368 update NEWS
BUG=webp:441

Change-Id: I8586b004e28b92d8c3c146f681bc9765f8a1f361
2019-12-18 00:06:50 -08:00
James Zern
30f0955160 bump version to 1.1.0
libwebp{,decoder} - 1.1.0
libwebp libtool - 8.0.1
libwebpdecoder libtool - 4.0.1

mux - 1.1.0
libtool - 3.5.0

demux - 1.1.0
libtool - 2.6.0 (no code change)

BUG=webp:441

Change-Id: I458940f407515e0d95d20bbfd670ee29255c12eb
2019-12-18 00:06:50 -08:00
James Zern
a76694a1d6 update AUTHORS
BUG=webp:441

Change-Id: I844f1e4b5c32219a1e54de0c57a73822f93c7755
2019-12-18 00:06:50 -08:00