Commit Graph

4386 Commits

Author SHA1 Message Date
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
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