Commit Graph

4690 Commits

Author SHA1 Message Date
James Zern
943b932a7e Merge changes I6a4d0a04,Ibc37b91e into main
* changes:
  decode.h: wrap idec example in /* */
  decode.h: fix decode example
2023-08-18 00:38:04 +00:00
James Zern
1cc94f9521 decode.h: wrap idec example in /* */
This makes it easier to read and copy/paste, though this is just rough
pseudo-code. It also matches the formatting of the advanced decoder
example.

Change-Id: I6a4d0a04a12bfc1f1956ac965ff4869cefc4f3df
2023-08-15 19:11:50 -07:00
James Zern
63acdd1e06 decode.h: fix decode example
spotted by tsutsui123 at gmail

Bug: webp:615
Change-Id: Ibc37b91e85427b2424b698043a40cce98bae356d
Fixed: webp:615
2023-08-15 19:07:11 -07:00
James Zern
aac5c5d0df ReadHuffmanCode: rm redundant num code lengths check
4 bits are read ([0, 15]) with 4 added to the result. The check that the
result is not > NUM_CODE_LENGTH_CODES (19) is redundant. This makes the
check an assert for documentation purposes.

webp-lossless-bitstream-spec.txt is updated accordingly.

Bug: webp:611
Change-Id: Ie461017dc9de3da4cfe6856543d3dcf58f53a180
2023-08-14 18:07:17 -07:00
James Zern
a2de25f6b6 webp-lossless-bitstream-spec: normalize list item case
In Section 6.2 Details, use uppercase after a :. This is more consistent
with the rest of the doc.

Bug: webp:611
Change-Id: I7ac862c90fd8e5fe0bad0dd5e3515d3095a6dc9a
2023-08-14 17:38:06 -07:00
James Zern
68820f0e53 webp-lossless-bitstream-spec: normalize pixel ref
x, y -> (x, y)

Bug: webp:611
Change-Id: Ic25ae76a9978156e7cd67ad17432ee1a1e172641
2023-08-14 17:38:03 -07:00
James Zern
cdb31aa806 webp-lossless-bitstream-spec: add missing periods
in ordered list in "6.2. Details". This is more consistent with the rest
of the document.

Bug: webp:611
Change-Id: Ie467c771afd5813a30855b24c80cf92673a5281c
2023-08-14 17:37:57 -07:00
James Zern
0535a8cf88 webp-lossless-bitstream-spec: fix grammar
...in same row... -> in the same row

Bug: webp:611
Change-Id: I837ab571084b206cc1a57c534c05cdcd0dfff0fa
2023-08-14 17:37:39 -07:00
James Zern
b6c4ce2635 normalize numbered list item format
from edits made during the RFC AUTH48 process

Change-Id: I82a5d78c0ea611e71927ffb13aa78ccdddfd6dd0
2023-08-09 13:51:38 -07:00
James Zern
dd7364c3ce Merge "palette.c: fix msvc warnings" into main 2023-07-28 20:05:58 +00:00
James Zern
c63c5df618 palette.c: fix msvc warnings
after:
1432ebba Refactor palette sorting computation.

fixes:
src\utils\palette.c(384): warning C4028: formal parameter 2 different
  from declaration
src\utils\palette.c(384): warning C4028: formal parameter 3 different
  from declaration
src\utils\palette.c(384): warning C4028: formal parameter 5 different
  from declaration

Change-Id: If29205f346e674108646045b7a3d90f078fed9b0
2023-07-28 09:07:11 -07:00
James Zern
0a2cad5115 webp-container-spec: move terms from intro section
to 'Terminology & Basics'

Change-Id: Iec9923086a2d339f12025c55da53b1e8a6919380
2023-07-27 16:18:57 -07:00
James Zern
dd88d2ff3e webp-lossless-bitstream-spec: color_cache -> color cache
The text is referring to the color cache, not a variable.

Bug: webp:611
Change-Id: Ife7e8246817ea0831993702bc050ed79998a0ee4
2023-07-27 12:41:04 -07:00
James Zern
6e75054736 Merge changes I644d7d39,Icf05491e,Ic02e6652,I63b11258 into main
* changes:
  webp-lossless-bitstream-spec: fix code blocks
  webp-lossless-bitstream-spec: block -> chunk
  webp-lossless-bitstream-spec: add some missing commas
  webp-lossless-bitstream-spec: normalize item text in 5.1
2023-07-27 19:34:20 +00:00
James Zern
67a7cc2b07 webp-lossless-bitstream-spec: fix code blocks
+ change "> 19" to "greater than 19" as it's referred to in prose

Bug: webp:611
Change-Id: I644d7d39f9c4a19050ff0256114873057aee95ef
2023-07-26 09:42:00 -07:00
Vincent Rabaud
1432ebbadb Refactor palette sorting computation.
This will ease the integration of new methods.

Change-Id: Icec3eddaa4ab9030d28ccfe579eb6dc13ded2f02
2023-07-26 10:25:14 +02:00
James Zern
cd436142f6 webp-lossless-bitstream-spec: block -> chunk
when referring to the RIFF chunk size; this is more consistent with
other documentation.

Bug: webp:611
Change-Id: Icf05491ee79f5c48fab0b4935da397b4e4e45a71
2023-07-25 22:10:06 -07:00
James Zern
3cb66f64b0 webp-lossless-bitstream-spec: add some missing commas
The serial comma change is based on the Chicago Manual of Style
(CMOS), 17th edition.

Bug: webp:611
Change-Id: Ic02e6652662608414c16e0fead2912781a47633d
2023-07-25 22:09:59 -07:00
James Zern
56471a53cf webp-lossless-bitstream-spec: normalize item text in 5.1
Makes references to earlier sections consistent. Based on RFC editor
update.

Bug: webp:611
Change-Id: I63b1125810a3d8afa957d392e98c68a632749d76
2023-07-25 22:08:51 -07:00
James Zern
af7fbfd2d9 vp8l_dec,ReadTransform: improve error status reporting
ExpandColorMap() can fail due to a memory allocation failure.

Found by Nallocfuzz (https://github.com/catenacyber/nallocfuzz).

Change-Id: I868c5db2fee18e876f4aa3b63e744d7297d1a91b
2023-07-21 16:30:50 -07:00
James Zern
7d8e0896e9 vp8l_dec: add VP8LSetError()
similar to VP8SetError(); the first error set takes precedence

Change-Id: Id00eb134cac328f72142a2ec0909e72768a6be0e
2023-07-21 16:30:49 -07:00
James Zern
a71ce1cf74 animencoder_fuzzer: fix error check w/Nallocfuzz
WebPAnimEncoderAdd() may fail due to muxer errors that are reported as
booleans. When running under the nallocfuzz engine, ignore all failures.

Found by Nallocfuzz (https://github.com/catenacyber/nallocfuzz).

Change-Id: I36589545d20ac30a67f7e09264146db085dee6ca
2023-07-21 16:30:48 -07:00
James Zern
e94b36d66d webp-lossless-bitstream-spec: relocate details from 5.1
Move the details given for meta prefix codes and the transforms from
"5.1. Roles of Image Data" to their corresponding sections.

Bug: webp:611
Change-Id: I750a3f45956d0a3928a22113180a2590ac1a36db
2023-07-21 15:50:38 -07:00
James Zern
84628e5611 webp-lossless-bitstream-spec: clarify image width changes
After processing the Color Indexing Transform the image width is
subsampled by the transform's width_bits.

Bug: webp:611
Change-Id: If8d2d47dbe05e5c8085fb3fb4c1b63552be9028b
2023-07-20 17:54:20 -07:00
James Zern
ee72299796 alpha_dec: add missing VP8SetError()
in AllocateAlphaPlane() and VP8DecompressAlphaRows().

Found by Nallocfuzz (https://github.com/catenacyber/nallocfuzz).

Change-Id: I39eb305abfe9f4d7915cce5d91e72917f482bc20
2023-07-18 16:25:29 -07:00
James Zern
0081693d61 enc_dec_fuzzer: use WebPDecode()
rather than WebPDecodeRGBA(). This allows finer grained error detection
and avoids an abort() when running under the nallocfuzz engine.

Change-Id: I8ff37f2fe7e1c8b39bd4a8bfe7b26ac41149ba42
2023-07-18 16:24:11 -07:00
James Zern
0fcb311cfc enc_dec_fuzzer: fix WebPEncode/pic.error_code check
pic.error_code may be set to VP8_ENC_ERROR_BAD_WRITE if the writer fails
due to a memory allocation failure.

Found by Nallocfuzz (https://github.com/catenacyber/nallocfuzz).

Change-Id: I912c9e5f9a37b78832c52d9ab6f0710967fbadac
2023-07-18 16:24:09 -07:00
James Zern
982c177c8a webp-lossless-bitstream-spec: fix struct member refs
remove trailing '_' to match the definition of ColorTransformElement

Bug: webp:611
Change-Id: I741213b389fc88473c72c64090a4733f51d87925
2023-07-14 15:13:27 -07:00
James Zern
56cf562570 webp-lossless-bitstream-spec: use RFC 7405 for ABNF
This allows for case sensitive literals.

Bug: webp:611
Change-Id: I5258c67ab12c48593d433449328fd85d461a05d2
2023-07-14 15:13:27 -07:00
James Zern
6c6b3fd317 webp-lossless-bitstream-spec,cosmetics: delete blank lines
This normalizes the spacing between sections and quiets some lint
warnings.

Bug: webp:611
Change-Id: Ic36eb08d55a566def74f746e2ec225c67ff8aecf
2023-07-14 15:12:35 -07:00
James Zern
29b9eb1517 Merge changes Id56ca4fd,I662bd1d7 into main
* changes:
  webp-lossless-bitstream-spec: add validity note for max_symbol
  webp-lossless-bitstream-spec: fix max_symbol definition
2023-07-13 20:43:51 +00:00
James Zern
47c0af8daf ReadHuffmanCodes: rm max_alphabet_size calc
This is unnecessary as green will have the largest value; the sizes are
currently: 256 + 24 + color_cache_size, 256, 40, in that order.

Change-Id: Ib9ce3292285a7b9c6089557b68a87184b68d17a5
2023-07-12 12:04:57 -07:00
James Zern
b92deba353 animencoder_fuzzer: no WebPAnimEncoderAssemble check w/nallocfuzz
This function may fail due to allocation failures. Use the
NALLOC_FUZZ_VERSION environment variable to detect the engine. This was
added in:
9c9a9883cc

Change-Id: Ia5b6fd9458ffa1f810152a10ab49a48c75d17687
2023-07-10 15:10:00 -07:00
James Zern
6be9bf8bae animencoder_fuzzer: fix leak on alloc failure
Change-Id: Id626145a336fc33c4a4158719957f3c96db156c8
2023-07-10 15:09:17 -07:00
James Zern
5c965e55dd vp8l_dec,cosmetics: add some /*param=*/ comments
Change-Id: I8912a5d8a8f550517e644e1af6b468b49505247f
2023-07-07 19:57:47 -07:00
James Zern
e4fc2f78c7 webp-lossless-bitstream-spec: add validity note for max_symbol
Bug: webp:611
Change-Id: Id56ca4fd0ad3cfc17c9c971281ccfb8ce7eaa2f4
2023-07-07 15:54:34 -07:00
James Zern
71916726b6 webp-lossless-bitstream-spec: fix max_symbol definition
If ReadBits(0) == 0, the value of max_symbol is set to the alphabet size
for each symbol type.

See vp8l_dec.c, ReadHuffmanCode(), which passes alphabet_size to
ReadHuffmanCodeLengths() as num_symbols, and ReadHuffmanCodeLengths()
then sets max_symbol to that.

Bug: webp:611
Change-Id: I662bd1d7f372e7f2e9c71cc86f87aefd02f36647
2023-07-07 15:54:34 -07:00
Vincent Rabaud
eac3bd5c53 Have the palette code be in its own file.
Change-Id: I099a342effedd9f451c94d00a14aead27079e6cc
2023-07-06 22:09:24 +02:00
Vincent Rabaud
e2c85878f6 Add an initializer for the SharpYuvOptions struct.
Change-Id: I36510bc361b040d3d3e7d261ab67b24ffc3013a6
2023-07-01 21:15:37 +02:00
James Zern
4222b00679 libwebp-1.3.1
- 6/23/2023: version 1.3.1
   This is a binary compatible release.
   * security fixes for lossless encoder (#603, chromium: #1420107, #1455619,
     CVE-2023-1999)
   * improve error reporting through WebPPicture error codes
   * fix upsampling for RGB565 and RGBA4444 in NEON builds
   * img2webp: add -sharp_yuv & -near_lossless
   * Windows builds:
     - fix compatibility with clang-cl (#607)
     - improve Arm64 performance with cl.exe
     - add Arm64EC support
   * fix webp_js with emcc >= 3.1.27 (stack size change, #614)
   * CMake fixes (#592, #610, #612)
   * further updates to the container and lossless bitstream docs (#581, #611)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmSc53oACgkQ+cPWvbgj
 K120Fg//f0JkK3oKnO8P4B5XSAK26/5845xBPU8D06UuUqhct+mjfF5kM1CFxxex
 49W4rT7RJCpgGlwmRFFgRB3a9j7cW4C+Kt5MAfM++vudVrxnpnX6o3rdVDQ60PEZ
 C4T5u2jio/HuZAkPWYwwmIAz1vfqTjYpi0D12hn7yoBoketGcISlMuTgmwfjyQKg
 bn3JcjcjKtERfXSH36aCtnGAXJdf0Ok2WJtwS4kAcZiMByi5wf0AdEK0pnhmE3Y6
 YFPc0/RM50RXITnsDxmLZVRqpsAYr4l3RZvHwDDWVFMELWBsGWNF/kgzWlZ3/KjO
 4CUPE+810P4oVGJuRZ8++0hMSD0L1qh17awElpqLoBlDXfS1fEIw5QodbmoJzi0H
 mhiLH7fIZlpjoZyWuwNCzlkhykRLO4cEIaxxq28p5eoC70LXsv77rWqomfAja/6/
 88BQz6wrxHr0k4MmdOa+G8B5sMOBRVXXeW4bP1XCVGUfk8FN2rz0vlhbHk8sx/6/
 jqW19Bk3t2QnUZschBi1GKHKa0KkefFhTezTm/CV4fPmT50Z4k/+TTjJ6snSxAAX
 oYabJDtVARLgPxOcN64Hbsy1t5L9pWGLTfwbYBTVipX4lmofL9SHhgyg6oYVnZd5
 qbCVdqpYOOrbXXT/AByOuzo3tuaLMd8Ytas0I5/HHnI6QCTthg0=
 =/atT
 -----END PGP SIGNATURE-----

Merge tag 'v1.3.1'

libwebp-1.3.1

- 6/23/2023: version 1.3.1
  This is a binary compatible release.
  * security fixes for lossless encoder (#603, chromium: #1420107, #1455619,
    CVE-2023-1999)
  * improve error reporting through WebPPicture error codes
  * fix upsampling for RGB565 and RGBA4444 in NEON builds
  * img2webp: add -sharp_yuv & -near_lossless
  * Windows builds:
    - fix compatibility with clang-cl (#607)
    - improve Arm64 performance with cl.exe
    - add Arm64EC support
  * fix webp_js with emcc >= 3.1.27 (stack size change, #614)
  * CMake fixes (#592, #610, #612)
  * further updates to the container and lossless bitstream docs (#581, #611)

* tag 'v1.3.1':
  update ChangeLog
  update NEWS
  enc/*: normalize WebPEncodingSetError() calls
  enc/*: add missing WebPEncodingSetError() calls
  EncodeAlphaInternal: add missing error check
  vp8l_enc,WriteImage: add missing error check
  muxread,MuxImageParse: add missing error checks
  cmake,emscripten: explicitly set stack size
  WebPDecodeYUV: check u/v/stride/uv_stride ptrs
  Call png_get_channels() to see if image has alpha
  update ChangeLog
  update NEWS
  bump version to 1.3.1
  update AUTHORS
  update .mailmap

Bug: webp:608
Bug: b/281615350
Change-Id: Ic3e1956c92fef0ae22040bbc3e81b297c65008af
2023-06-28 19:34:13 -07:00
Vincent Rabaud
25d94f473b Implement more transfer functions in libsharpyuv
This is inspired by https://github.com/AOMediaCodec/libavif/pull/444/files

Change-Id: I98fae61696b3b8bbc1b5941e7950810d3ac3d588
2023-06-28 11:43:37 +02:00
James Zern
2153a6797c Merge changes Id0300937,I5dba5ccf,I57bb68e0,I2dba7b4e,I172aca36, ... into main
* changes:
  webp-lossless-bitstream-spec: add PredictorTransformOutput
  webp-lossless-bitstream-spec: fix RIFF-header ABNF
  webp-lossless-bitstream-spec: split LZ77 Backward Ref section
  webp-lossless-bitstream-spec: split Meta Prefix Codes section
  webp-lossless-bitstream-spec: note transform order
  webp-lossless-bitstream-spec: update transformations text
2023-06-27 21:56:43 +00:00
James Zern
4298e9765c webp-lossless-bitstream-spec: add PredictorTransformOutput
Describe the addition of the residual value to the predicted value.

Bug: webp:611
Change-Id: Id0300937eeebbafec3b2cd15376c56418c98a3bf
2023-06-26 12:51:36 -07:00
James Zern
cd7e02bece webp-lossless-bitstream-spec: fix RIFF-header ABNF
0x2f is a part of the image header, not RIFF header

Bug: webp:611
Change-Id: I5dba5ccfebeb25586723a1f3e00eebc317806928
2023-06-26 12:51:36 -07:00
James Zern
6c3845f9e0 webp-lossless-bitstream-spec: split LZ77 Backward Ref section
Make Distance Mapping its section for ease of reference.

Bug: webp:611
Change-Id: I57bb68e0fcf4d23ce0013f327adce93c6377be3a
2023-06-26 12:51:36 -07:00
James Zern
7f1b6799db webp-lossless-bitstream-spec: split Meta Prefix Codes section
Make Entropy Image and Interpretation of Meta Prefix Codes their own
section for ease of reference.

Bug: webp:611
Change-Id: I2dba7b4efd02d8bb250810ebff42ac1687262804
2023-06-26 12:51:36 -07:00
James Zern
7b634d8f0c webp-lossless-bitstream-spec: note transform order
transforms are applied in reverse bitstream order.

Bug: webp:611
Change-Id: I172aca36bbd5c3358a71b0acb49c5704ceee63d7
2023-06-26 12:51:36 -07:00
James Zern
6d6d4915ce webp-lossless-bitstream-spec: update transformations text
follow up to:
29c9f2d4 webp-lossless-bitstream-spec: minor wording updates

Universally use 'transform' over 'transformation'. The doc generally
uses 'transform' to talk about the individual transforms themselves as
well as their related data.

Bug: webp:611
Change-Id: I097701873bbc440bd399ab5440a914a14f7c62f6
2023-06-26 12:50:39 -07:00
James Zern
fd7bb21c0c update ChangeLog
Bug: webp:608
Change-Id: Id619a5e39a71d1372fd2209774f4f57d87712aa7
2023-06-23 11:52:38 -07:00
James Zern
e1adea50ed update NEWS
Bug: webp:608
Change-Id: I8c09742daa8502e7a1fdc626afa3b747e03569bf
2023-06-23 10:16:35 -07:00