Commit Graph

4801 Commits

Author SHA1 Message Date
James Zern
50074930e3 oss-fuzz/build.sh,cosmetics: fix indent
Change-Id: I1b9ddb5a531fc829fc7374ecefe31a38ac27e02c
2024-06-06 10:28:13 -07:00
Vincent Rabaud
20e92f7d40 Limit the possible fuzz engines.
Change-Id: I8f2fd84bc7175e4e74c4fb418fcc4f5549018ac3
2024-06-06 13:21:09 +02:00
Vincent Rabaud
4f200de591 Switch public fuzz tests to fuzztest.
Change-Id: I75afb65058690585bbf2671c27d6a99a87bcaab7
2024-06-05 14:08:27 +02:00
wrv
64186bb36c Add huffman_fuzzer to .gitignore
Change-Id: I1ec33a29beb1a9111e57c85ef67e4c4616908c56
2024-06-01 10:21:54 -05:00
Vincent Rabaud
0905f61c85 Move build script from oss-fuzz repo to here.
This requires a change in the oss-fuzz repo similar to
https://github.com/AOMediaCodec/libavif/blob/main/tests/oss-fuzz/build.sh

Change-Id: I7bcdb52dcec7e6edd926aea93988cd758ef9a854
2024-05-31 22:02:17 +02:00
wrv
e86787586b Fix link to Javascript documentation
Change-Id: Ia65d307570a3dff1fc6894abb42dfaaaaa74f086
2024-05-30 17:06:57 -05:00
wrv
5e5b8f0c95 Fix SSE2 Transform_AC3 function name
Change-Id: I5fda3221612beafc3548d2abfa7c1e3f686aaaf0
2024-05-29 21:41:14 -05:00
James Zern
45129ee027 Revert "Check all the rows."
This reverts commit ee26766a89.

This change also reverts the parent.

Revert "Increase the transform bits if possible."

This reverts commit 7ec51c5916.

These changes result in non-lossless encodes.

Bug: oss-fuzz:69231, oss-fuzz:69109, oss-fuzz:69208
Bug: b:341475869, b:342743143
Change-Id: Ia28f558992e0aa6f024af1ff66da52e0a5e26fa3
2024-05-25 11:00:32 -07:00
Vincent Rabaud
ee26766a89 Check all the rows.
A 3 by 1 image would not have its 1st and 3rd lines compared at
the second iteration.

BUG=oss-fuzz:69208

Change-Id: I9213e73995d31907f358310a0b7d5ebb21c1f8b2
2024-05-24 23:11:20 +02:00
Vincent Rabaud
7ec51c5916 Increase the transform bits if possible.
This brings minor size improvements because repetitive values in
the transform images are easily explainable through LZ77. Still,
it makes an upcoming pull request a bit more stable.

This is 971a03d820 with a fix to
not forget to analyze the end of the line.
A const has also been added to match VP8LColorSpaceTransform's
signature.

Change-Id: Iae03216fef298c7abc96a766f8a799552b05ade5
2024-05-23 14:04:34 +02:00
James Zern
3cd16fd3e2 Revert "Increase the transform bits if possible."
This reverts commit 971a03d820.

Reason for revert:
This creates non-lossless encodes.

Original change's description:
> Increase the transform bits if possible.
>
> This brings minor size improvements because repetitive values in
> the transform images are easily explainable through LZ77. Still,
> it makes an upcoming pull request a bit more stable.
>
> Change-Id: I1c7135675cb59b5e27ca960738d74465f10d0deb

Bug: oss-fuzz:69109, b:341475869
Change-Id: I3b9f21a5498735eb3681e62fb35bf9f9c2ed4f9f
2024-05-20 22:25:57 +00:00
Vincent Rabaud
971a03d820 Increase the transform bits if possible.
This brings minor size improvements because repetitive values in
the transform images are easily explainable through LZ77. Still,
it makes an upcoming pull request a bit more stable.

Change-Id: I1c7135675cb59b5e27ca960738d74465f10d0deb
2024-05-17 15:19:03 +02:00
Vincent Rabaud
1bf198a22b Allow transform_bits to be different during encoding.
The spec allows it but it is currently forced to the same value for simplicity.

Change-Id: I26197dbf3342f7a72115cc7f7805c154313a2afb
2024-05-13 16:56:19 +02:00
Vincent Rabaud
1e462ca80e Define MAX_TRANSFORM_BITS according to the specification.
Change-Id: I0d575aa84e143bea56b55deb8f42b44e13dd5f1e
2024-05-07 09:16:02 +02:00
Vincent Rabaud
64d1ec23ac Use (MIN/NUM)_(TRANSFORM/HUFFMAN)_BITS where appropriate
Change-Id: I849ff8864f7abcc723dfe2b7ee0f290c8ee89c3f
2024-05-06 22:46:44 +02:00
Vincent Rabaud
a90160e11a Refactor histograms in predictors.
Replace the 2d histograms with uint32_t 1d versions (to avoid
pointer casting and to use the optimized VP8LAddVectorEq).

Change-Id: I90b0fe98390b49e3fd03e3484289571cf7ae6eca
2024-05-03 22:09:38 +02:00
Vincent Rabaud
a7aa7525b8 Fix some function declarations
- fix some function declarations to match the implementation
- fix some consts

Change-Id: I8c89f49ec68d3dd1db7f8ee5cac73777f52d2576
2024-05-03 20:10:46 +02:00
James Zern
68ff4e1efe Merge "jpegdec: add a hint for EOF/READ errors" into main 2024-05-02 20:53:54 +00:00
James Zern
79e7968ad0 jpegdec: add a hint for EOF/READ errors
`jpegtran -copy all` may be able to process the file into something
libjpeg can read.

Bug: webp:562
Change-Id: I27a8a7a841c1d8d54f47c7c52e289d9d8c549220
2024-05-01 12:32:47 -07:00
James Zern
d33455cd31 man/*: s/BUGS/REPORTING BUGS/
BUGS is described by the man-pages man page as:
A list of limitations, known defects or inconveniences, and other
questionable activities.

Change-Id: I2781d48d7a01c173fd24ac0b60af1a84aec31c3b
2024-05-01 10:39:00 -07:00
James Zern
a67ff735a2 normalize example exit status
Use EXIT_SUCCESS / EXIT_FAILURE in most cases as more granularity isn't
useful. For anim_diff, use 0 (success), 1 (image difference) and 2
(error) to align it with other diff utilities (diff, etc.).

Bug: webp:637
Change-Id: I52925de8622a5a4d2141883279d69a1d95ef9b12
2024-05-01 10:38:44 -07:00
James Zern
edc289092a upsampling_{neon,sse41}: fix int sanitizer warning
fixes warnings of the form:
/src/dsp/upsampling_sse41.c:170:1: runtime error: implicit conversion
  from type 'int' of value -16 (32-bit, signed) to type 'uintptr_t' (aka
  'unsigned long') changed the value to 18446744073709551600 (64-bit,
  unsigned)

this is the same change as was done previously in upsampling_sse2.c:
2ee786c7 upsampling_sse2.c: clear int sanitizer warnings

Change-Id: I36064d837ad1a7a118918c16a5551fc732dec2ff
2024-04-30 13:06:09 -07:00
James Zern
3cada4cef4 ImgIoUtilReadFile: check ftell() return
This avoids attempting to allocate 0 bytes if the call fails. (An
additional byte is added to the result to allow a '\0' to be appended.)

Bug: chromium:334120888
Change-Id: Ifcb8ff7744c567cbd08051aa04cc66acf936078d
2024-04-19 12:50:01 -07:00
James Zern
dc9505855e libwebp-1.4.0
- 4/12/2024: version 1.4.0
   This is a binary compatible release.
   * API changes:
     - libwebpmux: WebPAnimEncoderSetChunk, WebPAnimEncoderGetChunk,
                   WebPAnimEncoderDeleteChunk
     - libsharpyuv: SharpYuvOptionsInit, SharpYuvConvertWithOptions
     - extras: SharpYuvEstimate420Risk
   * further security related hardening in libwebp & examples
   * some minor optimizations in the lossless encoder
   * added WEBP_NODISCARD to report unused result warnings; enable with
     -DWEBP_ENABLE_NODISCARD=1
   * improvements and corrections in webp-container-spec.txt and
     webp-lossless-bitstream-spec.txt (#611)
   * miscellaneous warning, bug & build fixes (#615, #619, #632, #635)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmYZ5dsACgkQ+cPWvbgj
 K11+Lg//cTnfLXYUZYI3coork1BG6E+r3bCvF6oncgdyOpQGM/7dExsPM43dBHBp
 uMHqapnxECSaga3g05+13R0ouhS72j3cuWBVkwmhrad7nxX7SGrCHIhaauJEAuyh
 ZX/MuMWVynAw9aq4UyCSLEfJ8bzRn/BmBb87zY8yBQP5fxUjGZ/hzRw4+pEoy9XU
 FA6QHv28agiswM111iOwIHQcAsKlUKy7SyULjFV40Q+wkF3tWTkOA9ecnsjXdDAU
 q3x06lZ4StvjyD7xwoxLL7E+sUAl0DcTluP1IMfmhzXOIl80OR0ec5qzGthaHSQZ
 ReDd9F0YqrEQOj371KkBg1d+VyBmwQoqh6vzKiEfqcm+wSDEd5WoOk7FmDbUlwmx
 EyRWrlxrmF7MsvjPYfQxxYfMcojewoVFFm43xgGO7pYg1b8yGEZ69So/3NWBqv6x
 ANXJCIcLHikz2u+v4n5A6eg6mFSW3pdPq8HpELTmefveXfIAGoA/6zcACqfNN+sO
 bt4lh7fUHTTFJmW5EJYkZmY725eY0nH7IQc0Jpc0iKMgtISTg2bxGHFeCB+GUTd0
 BCKBCCeIHIP7n7HnFGfGkNeas70QkN5lG5kDSLw4KR0TT1/We2MVZEsWeFPhQeYq
 myrMjhSOBn2sPKtknCL9WilQtBdLDPFBUIB3yHVXcP+HGCs8d/w=
 =+gXF
 -----END PGP SIGNATURE-----

Merge tag 'v1.4.0'

libwebp-1.4.0

- 4/12/2024: version 1.4.0
  This is a binary compatible release.
  * API changes:
    - libwebpmux: WebPAnimEncoderSetChunk, WebPAnimEncoderGetChunk,
                  WebPAnimEncoderDeleteChunk
    - libsharpyuv: SharpYuvOptionsInit, SharpYuvConvertWithOptions
    - extras: SharpYuvEstimate420Risk
  * further security related hardening in libwebp & examples
  * some minor optimizations in the lossless encoder
  * added WEBP_NODISCARD to report unused result warnings; enable with
    -DWEBP_ENABLE_NODISCARD=1
  * improvements and corrections in webp-container-spec.txt and
    webp-lossless-bitstream-spec.txt (#611)
  * miscellaneous warning, bug & build fixes (#615, #619, #632, #635)

Bug: webp:627

* tag 'v1.4.0':
  update ChangeLog
  update NEWS
  provide a way to opt-out/override WEBP_NODISCARD
  update ChangeLog
  NEWS: fix date
  vwebp: fix window title when options are given
  update NEWS
  bump version to 1.4.0
  update AUTHORS

Change-Id: Ib09dee63d968b50166c9177f571d68082e50ca76
2024-04-12 19:05:47 -07:00
James Zern
845d5476a8 update ChangeLog
Bug: webp:627
Change-Id: I67a011b62087a8ad64df3b5eb0a1c051adeea60f
2024-04-12 13:48:48 -07:00
James Zern
8a6a55bba8 update NEWS
add a note about WEBP_NODISCARD / WEBP_ENABLE_NODISCARD

Bug: webp:627
Change-Id: I018848eaef33dd47b922d6c95fc2842248cc02df
2024-04-12 12:34:22 -07:00
James Zern
cf7c5a5de8 provide a way to opt-out/override WEBP_NODISCARD
Bug: webp:627
Change-Id: I95ef89f37e5b7bf0f806bcfc6a295f5168b1bf67
2024-04-11 12:34:46 -07:00
James Zern
cc34288aa3 update ChangeLog
Bug: webm:627
Change-Id: I63243ecb39aa73a04d06426828e10d3e419922f6
2024-04-02 18:25:23 -07:00
James Zern
f13c08868a NEWS: fix date
Bug: webp:627
Change-Id: Ia3c620c2a0857e32ed9d85f08a0ef3caeddf6796
2024-04-02 17:41:32 -07:00
James Zern
7455595072 Merge "vwebp: fix window title when options are given" into 1.4.0 2024-04-02 16:56:08 +00:00
James Zern
d781646c29 vwebp: fix window title when options are given
Options can precede the file name. This still won't be correct for
Unicode file names, but an approximation will be displayed (with '?'s)
rather than the first character if kParams.file_name were used.
glutCreateWindow() looks like it will prohibit correcting this as it
expects an ASCII string.

Change-Id: I96986a178a0bbce6971d2ac415222d4a456ce1a3
2024-04-01 19:34:17 -07:00
James Zern
c2e394de91 update NEWS
Bug: webp:627
Change-Id: I7deea5d982ea9967c4be6b945452b9361e02eb85
2024-04-01 15:46:40 -07:00
James Zern
f6d15cb747 bump version to 1.4.0
libwebp{,decoder} - 1.4.0
libwebp libtool - 8.9.1
libwebpdecoder libtool - 4.9.1

mux - 1.4.0
libtool - 4.0.1

demux - 1.4.0
libtool - 2.15.0

sharpyuv - 0.4.0
libtool - 1.0.1

Bug: webp:627
Change-Id: I9a61d83ee92809de1c2501d1b4fb68aa38f98850
2024-04-01 15:37:40 -07:00
James Zern
57c388b8ff update AUTHORS
Bug: webp:627
Change-Id: I517fdc5201a8a44f1cdc64ef16f68e0ed9677937
2024-04-01 15:37:40 -07:00
James Zern
b3d1b2cbf7 Merge changes I26f4aa22,I83386b6c,I320ed1a2 into main
* changes:
  webp_js/*.html: fix canvas mapping
  cmake,wasm: simplify SDL2 related flags
  cmake: fix vwebp_sdl compile w/libsdl-org release
2024-04-01 20:19:51 +00:00
James Zern
07216886a7 webp-container-spec: fix VP8 chunk ref ('VP8'->'VP8 ')
Change-Id: Iad8317660c6be7c8044421d7517c95c5034609d7
2024-03-29 19:28:52 -07:00
James Zern
f88666eb47 webp_js/*.html: fix canvas mapping
after:
24d7f9cb Switch code to SDL2.

fixes:
webp_wasm.js:1 Uncaught TypeError: Cannot read properties of null
    (reading 'addEventListener')
    at Object.registerOrRemoveHandler (webp_wasm.js:1:101330)
    at registerMouseEventCallback (webp_wasm.js:1:154227)
    at _emscripten_set_mousemove_callback_on_thread (webp_wasm.js:1:155015)
    ...

The SDL2 port forces the canvas id to '#canvas':
324df6865a/src/video/emscripten/SDL_emscriptenvideo.c (L210)

This change maps '#output_canvas' to this entry in specialHTMLTargets[]:
https://emscripten.org/docs/api_reference/html5.h.html

https://github.com/libsdl-org/SDL/issues/5260 &
https://github.com/emscripten-ports/SDL2/issues/130 may also be related.

Change-Id: I26f4aa22b9d68b0fc45b83edfe6fe074b59a82a7
Test: emscripten 3.1.16
2024-03-29 12:53:05 -07:00
James Zern
e2c8f233ef cmake,wasm: simplify SDL2 related flags
Use the result of find_package(SDL2); the cmake module is available
prior to downloading the port. Previously the result of this call was
ignored. This also updates the flags to use the results of
SDL2_LIBRARIES which may be more future proof than specifying them
manually.

SDL2_INCLUDE_DIRS do not appear to be necessary with -sUSE_SDL2.

Based in part on:
d0b3e8efe3/ports/libwebp/0008-sdl.patch

Bug: b:301040580
Change-Id: I83386b6c3d9628e3f0d9d17f20d47338d0db044a
2024-03-28 19:23:51 -07:00
James Zern
d537cd3704 cmake: fix vwebp_sdl compile w/libsdl-org release
Prebuilt SDL2 releases from https://github.com/libsdl-org/SDL/releases
provide include/SDL.h. Test for this and set WEBP_HAVE_JUST_SDL_H
accordingly.

This was inspired by:
d0b3e8efe3/ports/libwebp/0008-sdl.patch

Bug: b:301040580
Change-Id: I320ed1a23352fc4035d491399fdba184dc927554
Test: cmake .. -DCMAKE_PREFIX_PATH=<path-to-sdl2>/cmake
2024-03-28 14:11:46 -07:00
James Zern
6c484cbf92 CMakeLists.txt: add missing WEBP_BUILD_EXTRAS check
And include directories to imageenc/imagedec. This fixes the build with
`-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF
-DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF
-DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_LIBWEBPMUX=OFF
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF
-DWEBP_BUILD_WEBPMUX=OFF` and image dependencies outside of default
include locations (e.g., /usr/include).

Patch from:
d0b3e8efe3/ports/libwebp/0010-fix_build.patch

Bug: b:301040580
Change-Id: I2b9ad81dfe52316b102ca46ab8c60c42de3c0000
2024-03-27 18:55:20 -07:00
James Zern
7b0bc2352b man/cwebp.1: add more detail to -partition_limit
-m and -q can also affect the encoder's ability to satisfy the
partition limit.

Bug: webp:634
Change-Id: I89ea2b037c0cf1e109c251f45c09378ce501862b
2024-03-26 13:00:35 -07:00
James Zern
3c0011bbd1 WebPMuxGetChunk: add an assert
assert idx != IDX_LAST_CHUNK to quiet a static analysis warning
(reported by Coverity):
  overrun-local: Overrunning array kChunks of 11 12-byte elements at
    element index 11 (byte offset 143) using index idx (which evaluates
    to 11).

Change-Id: I85ae159e338d5670c007f76277ffe94e7a1dcafc
2024-03-21 18:32:55 -07:00
James Zern
955a3d14ae Merge "muxread,MuxGet: add an assert" into main 2024-03-22 01:01:04 +00:00
James Zern
00abc0007c muxread,MuxGet: add an assert
assert idx != IDX_LAST_CHUNK to quiet a static analysis warning
(reported by Coverity):
  Indexing array kChunks of size 11 with idx.

Change-Id: I5e54b5c09d23c26abbd1a7919b6f828b35fe4f75
2024-03-20 12:36:37 -07:00
Vincent Rabaud
40e85a0b56 Have the window title reflect the filename.
This is from https://github.com/webmproject/libwebp/pull/3

Change-Id: Ia54f9b6a2ac0d078e931c088694924ed914c18fd
2024-03-20 14:33:54 +01:00
James Zern
1bf46358c4 man/cwebp.1: clarify -pass > 1 behavior w/o -size/-psnr
A PSNR value of 40dB will be used in this case.

Bug: webp:635
Change-Id: I74964a08a1f0a6b92ecfa482753a171ce6f3ae18
2024-03-14 19:34:39 -07:00
James Zern
eba03acb05 webp-container-spec: replace 'above' with 'earlier'
https://developers.google.com/style/word-list#above

Change-Id: Ib20395c00289d0e37f532b383dec0bf14d4bec73
2024-03-12 16:22:31 -07:00
James Zern
a16d30cb57 webp-container-spec: clarify chunk order requirements
based on comments from:
https://datatracker.ietf.org/doc/draft-zern-webp/ballot/#draft-zern-webp_robert-wilton

Change-Id: If2cd956b607c51b714e82e8eee7a1c4375c3c632
2024-03-11 14:01:40 -07:00
James Zern
8a7e911231 Merge "CMakeLists.txt: apply cmake-format" into main 2024-03-07 19:21:20 +00:00
Vincent Rabaud
7fac6c1bf2 Merge "Copy C code to not have multiplication overflow" into main 2024-03-07 12:14:57 +00:00