Commit Graph

4146 Commits

Author SHA1 Message Date
James Zern
2690782292 pngdec: check version before using png_get_chunk_malloc_max
png_get_chunk_malloc_max / png_set_chunk_malloc_max were added in 1.4.1.

Bug: webp:505, webp:497
Change-Id: Id4e0643a7734563fec7779f7943ec760da8d276d
2021-02-10 13:41:54 -08:00
James Zern
8f0d41aac0 Merge changes Id135bbf4,I99e59797
* changes:
  cmake: add WEBP_USE_THREAD option
  cmake: don't install binaries from extras/
2021-02-09 21:25:12 +00:00
Pascal Massimino
373eb170f1 gif2webp: don't store loop-count if there's only 1 frame
BUG=webp:504

Change-Id: Iacea11a861096ae950379c872d9840bdbec42a21
2021-02-08 22:00:48 +00:00
James Zern
759b9d5a06 cmake: add WEBP_USE_THREAD option
this controls the config.h define of the same name and matches the
behavior of configure's --disable-threading

Bug: webp:502
Change-Id: Id135bbf4e6b3c9900e2b4f4f7ab744b3457ce41c
2021-02-05 15:32:41 -08:00
James Zern
926ce921f3 cmake: don't install binaries from extras/
this matches the behavior of configure

Bug: webp:502
Change-Id: I99e597971636bdc2b9a9465ba13bb24c70ce87c0
2021-02-05 15:30:06 -08:00
James Zern
9c367bc602 WebPAnimDecoderNewInternal: validate bitstream before alloc
this avoids large allocations with corrupt files due to the canvas size

BUG=oss-fuzz:28658

Change-Id: Idd1957e5447a2dadaef1fadaf68820fcb29f045a
2021-02-05 13:01:27 -08:00
James Zern
47f64f6edd filters_sse2: import Chromium change
VerticalUnfilter_SSE2 has long been disabled due to a crash in an
Android emulator that hasn't reproduced elsewhere (crbug.com/654974).
this synchronizes the code for now to avoid needing to locally edit the
file on import.

Bug: 1141126
Change-Id: Ib61aeab93caaff1759606566b9e499eaac1576cf
2021-01-30 11:44:07 -08:00
James Zern
cc3577e9b9 fuzzer/*: use src/ based include paths
this synchronizes the code with chrome, where this format allows the
code to pass buildtools/checkdeps/checkdeps.py

Bug: 1141126
Change-Id: I25361b1a43cd95730814302f02aa16af8fdb5fd2
2021-01-29 20:04:08 -08:00
James Zern
004d77ffab libwebp-1.2.0
- 12/23/2020: version 1.2.0
   * API changes:
     - libwebp:
       encode.h: add a qmin / qmax range for quality factor (cwebp adds -qrange)
   * lossless encoder improvements
   * SIMD support for Wasm builds
   * add xcframeworkbuild.sh, supports Mac Catalyst builds
   * import fuzzers from oss-fuzz & chromium (#409)
   * webpmux: add an '-set loop <value>' option (#494)
   * toolchain updates and bug fixes (#449, #463, #470, #475, #477, #478, #479,
     #488, #491)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmAUzc8ACgkQ+cPWvbgj
 K10fxg//cM6DotPh3VGZQR2ToWffrMuseK5pxPkeoGu4f3VF7UA0g6qVSmjKMPsL
 Dqm2zdpHftEcpNUVAfKD9oSv8Hp/wpfmIR30qkBN0a/a66gjasWmskdYU2Ms06c8
 lyaewTfUf/P0B5vcnDeqNNkBJjmGUi3HDXsxI/gVAZjqVIIDG3i3dDx435+ojxIJ
 Lda03jHhk+klpPz35IwC7BeSdD1A01u+Z6qRB3mqrAK3c9Ox45j4jzljUOVx3gto
 T06cwFL/cES1d4tyQKe9layM39F3hguKryQlCvfv4cFHYjOX4NDTuVxbcC4zyFRv
 MM3ZYRAlshXVrKhqS9SDJNIJEvI+cZmxOHvfmSh7Qw+ge3maiL3LRKkiiq9tIuzf
 6cUYix2i/uDrNkPyek2hXXIF5Xltu07coJqGtqdYn3kaRwXbkQ0hUJRS+0tj2qfi
 07SRCtV6PmEwplcB8qRVV5PSrr/gr0/Jg3U8Ru2vkVhN/wl0+7kcR4xMJzExCWtC
 q7Rdlda6HApLRYb/TIa2M/sKojNQ7usDfKpnwaYB901m0sfNmcUS53DR/5bHi+VV
 Ag35dK/0GsrwEbN11N0LnJ05AiXxN3bzJiie7SdXmoLcSVltJn7bkEDEhaKw94cU
 zMr93Xgei5JhV1Ean3rkF2b5mgpSwN7/NasMwFTC2fyXji3X6iA=
 =AInA
 -----END PGP SIGNATURE-----

Merge tag 'v1.2.0'

libwebp-1.2.0

- 12/23/2020: version 1.2.0
  * API changes:
    - libwebp:
      encode.h: add a qmin / qmax range for quality factor (cwebp adds -qrange)
  * lossless encoder improvements
  * SIMD support for Wasm builds
  * add xcframeworkbuild.sh, supports Mac Catalyst builds
  * import fuzzers from oss-fuzz & chromium (#409)
  * webpmux: add an '-set loop <value>' option (#494)
  * toolchain updates and bug fixes (#449, #463, #470, #475, #477, #478, #479,
    #488, #491)

* tag 'v1.2.0':
  update ChangeLog
  Fix check_c_source_compiles with pthread.
  disable CombinedShannonEntropy_SSE2 on x86
  pngdec: raise memory limit if needed
  {ios,xcframework}build.sh: make min version(s) more visible
  animdecoder_fuzzer: fix memory leak
  update gradle to 6.1.1
  update NEWS
  bump version to 1.2.0
  webp/encode.h: restore WEBP_ENCODER_ABI_VERSION to v1.1.0
  update AUTHORS

Bug: webp:484
Change-Id: I8f716a0e0438537e674092c1bfb60d27d738f69f
2021-01-29 19:24:01 -08:00
James Zern
fedac6cc69 update ChangeLog
Bug: webp:484
Change-Id: I071715469d10d590f7a65f9fa8e766f9c7bbf25f
2021-01-20 19:43:45 -08:00
Vincent Rabaud
170a871202 Fix check_c_source_compiles with pthread.
Also fix the variables: we need to check for PTHREAD_PRIO_INHERIT
and PTHREAD_CREATE_JOINABLE (not PTHREAD_CREATE_UNDETACHED) and
internally use HAVE_PTHREAD_PRIO_INHERIT and PTHREAD_CREATE_JOINABLE
(and not HAVE_PTHREAD_CREATE_JOINABLE).
cmake/config.h.in actually had the right variables.

BUG=webp:498

Change-Id: Ibf6cf854337cea5781a74316024f8ff4960366d7
(cherry picked from commit ceddb5fc8d)
2021-01-20 19:19:32 -08:00
Vincent Rabaud
ceddb5fc8d Fix check_c_source_compiles with pthread.
Also fix the variables: we need to check for PTHREAD_PRIO_INHERIT
and PTHREAD_CREATE_JOINABLE (not PTHREAD_CREATE_UNDETACHED) and
internally use HAVE_PTHREAD_PRIO_INHERIT and PTHREAD_CREATE_JOINABLE
(and not HAVE_PTHREAD_CREATE_JOINABLE).
cmake/config.h.in actually had the right variables.

BUG=webp:498

Change-Id: Ibf6cf854337cea5781a74316024f8ff4960366d7
2021-01-19 23:15:16 +01:00
James Zern
8599571935 disable CombinedShannonEntropy_SSE2 on x86
this function produces different results from the C code due to
use of double/float resulting in output differences when compared to
-noasm.

Bug: webp:499
Change-Id: Ia039b168c0a66da723fb434656657ba1948db8ae
2021-01-18 16:41:44 -08:00
Skal
289757fe1e TiffDec: enforce stricter mem/dimension limit on tiles
Tile can be even larger than image dimensions.

Change-Id: I80518e815bb11d7a07c8189d0493b3cc60e29815
2021-01-12 10:57:27 +01:00
James Zern
8af7436f10 Merge "{ios,xcframework}build.sh: make min version(s) more visible" into 1.2.0 2021-01-09 18:33:41 +00:00
Pascal Massimino
e56c3c5be3 pngdec: raise memory limit if needed
Some PNG input contain chunks larger than libpng's default
memory-alloc limit (8M).
Raise this limit reasonably if it looks like the input bitstream
is larger than libpng's default limit.

BUG=webp:497

Change-Id: I2c9fbed727424042444b82cbf15e0781cefb38dc
(cherry picked from commit 8696147da4)
2021-01-08 20:30:13 -08:00
Pascal Massimino
8696147da4 pngdec: raise memory limit if needed
Some PNG input contain chunks larger than libpng's default
memory-alloc limit (8M).
Raise this limit reasonably if it looks like the input bitstream
is larger than libpng's default limit.

BUG=webp:497

Change-Id: I2c9fbed727424042444b82cbf15e0781cefb38dc
2021-01-08 08:48:39 +01:00
James Zern
13b8e9fe16 {ios,xcframework}build.sh: make min version(s) more visible
add IOS_MIN_VERSION, MACOSX_MIN_VERSION and MACOSX_CATALYST_MIN_VERSION
to allow control of the minimum versions supported based on the
deployment target; based on feedback from:
e8e8db98 add xcframeworkbuild.sh
e8e8db985a

Change-Id: I9fbca072bf00c4cb8e59143371a2d3522d22808b
2021-01-05 10:52:44 -08:00
Pascal Massimino
a92254107e animdecoder_fuzzer: fix memory leak
BUG=oss-fuzz:28978

Change-Id: I7b3a495c02b4b03f367d732af5acb02856f8bead
(cherry picked from commit 8df77fb1b1)
2021-01-02 15:52:07 -08:00
James Zern
d6c2285d7c update gradle to 6.1.1
somewhat arbitrary version selection, but this matches what's currently
in use in ExoPlayer in the dev-v2 branch

fixes:
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '11.0.9.1'.

and removes the wrapper task as this is predefined in later versions:
Build file '/home/jzern/external/libwebp/build.gradle' line: 437

* What went wrong:
A problem occurred evaluating root project 'libwebp'.
> Cannot add task 'wrapper' as a task with that name already exists.

Change-Id: Ib9ef757d874cd6d4b08da3e7cef3ac5316935966
2021-01-02 15:51:55 -08:00
Pascal Massimino
8df77fb1b1 animdecoder_fuzzer: fix memory leak
BUG=oss-fuzz:28978

Change-Id: I7b3a495c02b4b03f367d732af5acb02856f8bead
2020-12-26 12:26:41 +01:00
James Zern
52ce633388 update NEWS
Bug: webp:484
Change-Id: Idd2ffc1c0a61f5442adea1ac751c57bd4cc2fced
2020-12-24 10:09:03 -08:00
James Zern
28c4982064 bump version to 1.2.0
libwebp{,decoder} - 1.2.0
libwebp libtool - 8.1.1
libwebpdecoder libtool - 4.1.1

mux - 1.2.0
libtool - 3.6.0

demux - 1.1.0
libtool - 2.7.0

Bug: webp:484
Change-Id: I458940f407515e0d95d20bbfd670ee29255c12eb
2020-12-23 19:54:29 -08:00
James Zern
7363dff25c webp/encode.h: restore WEBP_ENCODER_ABI_VERSION to v1.1.0
this was missed in:
f9b30586 fix ABI breakage introduced by 6a0ff358

Bug: webp:484
Change-Id: I64c9e5d1113209727f1ede467316549b4f2ad116
2020-12-23 19:50:03 -08:00
James Zern
826aafa570 update AUTHORS
Bug: webp:484
Change-Id: I62c722eec267ecd961e66f714beec4a8feafd724
2020-12-23 19:32:04 -08:00
James Zern
6325882327 animdecoder_fuzzer: validate canvas size
avoids some OOMs due to extreme resolutions

BUG=oss-fuzz:28658

Change-Id: I60b5fb3d7a7d17694a89237d521b851b0897e9fb
2020-12-18 11:18:11 -08:00
Skal
9eb2638119 CMake: remove duplicate "include(GNUInstallDirs)"
+ add missing copyright header

Change-Id: I2b61ab56a14d38360ac5beaebab4d2acf165dd46
2020-12-17 08:00:06 +01:00
Pascal Massimino
2e7bed7925 WebPPicture: clarify the ownership of user-owned data.
It's explicitly safe (and recommended!) to plug external data into
the pic->y/u/v/argb fields. They are guaranteed to be preserved
by the encoding process if no conversion is needed.

Change-Id: I325ca41a6a834f7f028431c605dddef67e9542cc
2020-12-14 12:28:52 +01:00
Pascal Massimino
cccf5e337a webpmux: add an '-set loop <value>' option
This allows to change the loop count option on animated files.

BUG=webp:494

Change-Id: I6849f56d7bff8b33a94f14b409e40f99789009ad
2020-12-12 19:05:11 +00:00
James Zern
c9a3f6a1d0 Merge changes Ie29f9867,I289c54c4
* changes:
  iosbuild.sh: sync some aspects of xcframeworkbuild.sh
  add xcframeworkbuild.sh
2020-12-10 20:23:39 +00:00
James Zern
319f56f1a1 iosbuild.sh: sync some aspects of xcframeworkbuild.sh
Change-Id: Ie29f986767132fe980d71e43f6b8d367a9e2e6a9
2020-12-08 19:20:53 -08:00
James Zern
e8e8db985a add xcframeworkbuild.sh
this is similar to iosbuild.sh, but will create .xcframework variants to
support Catalyst targets. currently it includes libs for:
  ios-arm64_armv7_armv7s
  ios-arm64_x86_64-maccatalyst
  ios-i386_x86_64-simulator
  macos-arm64_x86_64

this script requires Xcode 12+ to target arm64 for mac/catalyst, Xcode
11 builds will create x86_64 libraries only. iosbuild.sh remains for
compatibility purposes

Change-Id: I289c54c4b85848392a99bea698d45d54a9781f49
2020-12-08 19:20:46 -08:00
James Zern
ae54553461 dsp.h: allow config.h to override MSVC SIMD autodetection
this fixes builds with cmake targeting visual studio that set
-DWEBP_ENABLE_SIMD=0

BUG=webp:478

Change-Id: I21b61b112c79ff9cbab9e4502a25d3f1fa096c8b
2020-12-03 10:22:04 -08:00
James Zern
fef789f366 Merge "cmake: fix per-file assembly flags" 2020-12-02 19:29:21 +00:00
Vincent Rabaud
fc14fc038b Have C encoding predictors use decoding predictors.
libwebp.a in Release mode with no symbols size in bytes:
986430 -> 975114  (-1.1%)

Change-Id: Ia96192a6be2911779e359b72132bdba60b60a13d
2020-12-02 11:54:59 +01:00
James Zern
7656f0b335 README,cosmetics: fix a couple typos
Change-Id: I326db8e04877eeeb52f9f5fba104d8c20938f0e3
2020-11-25 12:55:23 -08:00
James Zern
d2e245ea9e cmake: disable webp.js if WEBP_ENABLE_SIMD=1
wasm2js doesn't support SIMD, fixes link error

Change-Id: I3d9d3cb5f29434bf6c0c0029c07540a9768f9b95
2020-11-23 18:53:20 -08:00
James Zern
96099a79a8 cmake: fix per-file assembly flags
Since
a376e7b9 Fix compilation on windows and clang-cl+ninja.
the highest level assembly flag (/arch:AVX / -msse4.1) would be applied
to all assembly files. This could result in higher level instructions
being used which would defeat the runtime cpu detection check and could
result in a crash.

With this change -m style flags are used with clang-cl as it supports
them and allows the correct level to be set. With at least Visual
Studio 12 (2013)+ /arch is not necessary to build SSE2 or SSE4 code
unless a lesser /arch is forced so these flags are avoided. This matches
the nmake build.

For emscripten only sse2 and sse4.1 are tested (NEON will succeed in
being enabled, but fail to build). This is consistent with
the current behavior added in:
commit 36c81ff6a9

    WASM-SIMD: port 2 patches from rreverser@'s tree

    * Stop on first found SIMD version
    * Imply lower SSE version when higher is found

Bug: webp:488
Change-Id: I34d01274e5204a477b6b9f35ed566048a62b4c57
Tested: msvc 2013-2019 debug win32/x64 builds; clang-cl under 2019
2020-11-23 17:31:48 -08:00
James Zern
5abb55823b Merge "cmake: fix compilation w/Xcode generator" 2020-11-24 01:31:26 +00:00
James Zern
8484a1204c cmake: fix compilation w/Xcode generator
Add a stub file to object only library targets.

https://cmake.org/cmake/help/v3.18/command/add_library.html#object-libraries
Some native build systems (such as Xcode) may not like targets that have
only object files, so consider adding at least one real source file to
any target that references $<TARGET_OBJECTS:objlib>.

Bug: webp:477
Change-Id: I5d404c921d84433c7a0b22e0736ab0dbe699d264
2020-11-20 13:21:17 -08:00
James Zern
d7bf01c954 Merge changes Ifcae0f38,Iee2d7401
* changes:
  wicdec: fail with animated images
  [cd]webp: document lack of animated webp support
2020-11-20 19:29:43 +00:00
Ingvar Stepanyan
36c81ff6a9 WASM-SIMD: port 2 patches from rreverser@'s tree
* Stop on first found SIMD version
* Imply lower SSE version when higher is found

Change-Id: I9a4bf24eeebf6c87b6b50f5c969e7e36429b691d
2020-11-20 11:58:39 +01:00
Pascal Massimino
988b02abfd Merge "Couple of fixes to allow SIMD on Emscripten" 2020-11-20 08:18:41 +00:00
James Zern
26faf7706b wicdec: fail with animated images
this matches the behavior of other decoders (WebP) in imageio.

Bug: webp:479
Change-Id: Ifcae0f38d7eebde31cd294070a6dd1f80cb30043
2020-11-19 19:49:11 -08:00
James Zern
ab2d08a842 [cd]webp: document lack of animated webp support
Bug: webp:479
Change-Id: Iee2d7401400a5ff0a11682028194e561b365ab78
2020-11-19 19:17:32 -08:00
Ingvar Stepanyan
52273943c6 Couple of fixes to allow SIMD on Emscripten
- Add `-msimd128` to flags to actually enable WebAssembly SIMD
   when performing SIMD detection. It's currently required in
   addition to `-msse*` / `-mfpu=neon` flags which only perform
   translation of corresponding intrinsics to Wasm SIMD ones.
   See a discussion at emscripten-core/emscripten#12714 for
   automating this and making easier in the future.
 - Remove compilation branch that prevented definitions of
   `WEBP_USE_SSE` and `WEBP_USE_NEON` on Emscripten even when
   SIMD support was detected at compile-time.
 - Add an implementation of `VP8GetCPUInfo` for Emscripten which
   uses static `WEBP_USE_*` flags to determine if a corresponding
   SIMD instruction is supported. This is because Wasm doesn't
   have proper feature detection (yet) and requires making separate
   build for SIMD version anyway.

Change-Id: I77592081b91fd0e4cbc9242f5600ce905184f506
2020-11-18 21:51:41 +00:00
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