Commit Graph

4899 Commits

Author SHA1 Message Date
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
James Zern
6b1c722a5b lossless_common.h,cosmetics: fix a typo
Change-Id: I22d2f96fa1fd2e3c9f059c26996fb11d998159a9
2023-06-22 18:31:36 -07:00
James Zern
08d60d6006 webp-lossless-bitstream-spec: split code length section
Make Simple / Normal Code Length Code their own section for ease of
reference.

Bug: webp:611
Change-Id: I1e6ed50d98f9258cacb163d2059716b5356e8b6f
2023-06-21 19:20:12 -07:00
James Zern
7a12afcc54 webp-lossless-bitstream-spec: rm unused anchor
The last use of #decoding-the-code-lengths was removed in:
86f94ee0 Update lossless spec with Huffman codes.

Also remove the redundant section header associated with it.

Bug: webp:611
Change-Id: I7f6bb1a1b75255324f185f4591313d9e6d49d1e9
2023-06-21 19:16:39 -07:00
James Zern
4339332038 enc/*: normalize WebPEncodingSetError() calls
return WebPEncodingSetError() directly where possible (it returns 0 /
failure for convenience).

Change-Id: I89a937778886c15ecbbe078af5b4c8c89ef0f9af
2023-06-21 16:43:00 -07:00
James Zern
287fdefe95 enc/*: add missing WebPEncodingSetError() calls
Users of the encoder (including anim_encode.c) and areas of the encoder
itself rely on the status returned via WebPPicture.

Change-Id: Id786176b8ac3b2329d1e41b9dacbb8dcc5d822e4
2023-06-21 16:43:00 -07:00
James Zern
c3bd7cff2e EncodeAlphaInternal: add missing error check
VP8LBitWriterFinish() may cause the VP8LBitWriter's buffer to be grown.
If that allocation fails, VP8LBitWriterNumBytes() will return a size
larger than the current allocation resulting in a heap overwrite of the
missing bytes.

==13==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x61900005b880 at pc 0x00000049ffc1 bp 0x7fff144f5b40 sp 0x7fff144f5310
READ of size 1028 at 0x61900005b880 thread T0
    #0 0x49ffc0 in __asan_memcpy
    #1 0x695861 in VP8BitWriterAppend src/utils/bit_writer_utils.c:186:3
    #2 0x65acf9 in EncodeAlphaInternal src/enc/alpha_enc.c:169:14

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

This is the same issue that was fixed in the non-alpha lossless path in:
d49cfbb3 vp8l_enc,WriteImage: add missing error check

Bug: chromium:1455619
Change-Id: I6bd10de213707d3d6b7ce3d0d2b3942af45d317f
2023-06-21 16:43:00 -07:00
James Zern
14a9dbfba0 webp-lossless-bitstream-spec: refine single node text
Remove the ambiguous 'should' which in other contexts might result in
questions as to whether it is a SHOULD or a MUST.

Change-Id: I9b396187ebde5ea5a0dbaf42daee6acf541258cd
2023-06-20 19:30:20 -07:00
Vincent Rabaud
64819c7cf3 Implement ExtractGreen_SSE2
Change-Id: I74f50e0c01603a640aa8cf7c9658d477e696ea8a
2023-06-19 13:31:46 +02:00
James Zern
d49cfbb348 vp8l_enc,WriteImage: add missing error check
VP8LBitWriterFinish() may cause the VP8LBitWriter's buffer to be grown.
If that allocation fails, VP8LBitWriterNumBytes() will return a size
larger than the current allocation resulting in a heap overwrite of the
missing bytes.

==3531848==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x61d000000880 at pc 0x556eddfa1007 bp 0x7ffe434c7a90 sp 0x7ffe434c7260
READ of size 2052 at 0x61d000000880 thread T0
    #0 0x556eddfa1006 in __asan_memcpy
    #1 0x556eddfeeccf in WebPMemoryWrite src/enc/picture_enc.c:220:5
    #2 0x556ede0f9f87 in WriteImage src/enc/vp8l_enc.c:1454:8

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

Change-Id: Ib1c9454c2c51849b0ba58c5347e6bd5b02a12fbe
2023-06-15 15:09:10 -07:00
James Zern
2e5a9ec3b6 muxread,MuxImageParse: add missing error checks
This prevents leaks should an allocation fail.

Spotted by Philippe Antoine (p dot antoine at catenacyber dot fr)
and https://github.com/catenacyber/nallocfuzz.

Change-Id: I07a8a475a282b18bf2f9015cc5b1120772babd48
2023-06-14 13:53:59 -07:00
James Zern
ebb6f949f4 cmake,emscripten: explicitly set stack size
The default was changed from 5MB to 64KB in 3.1.27 [1] causing image
decodes to fail. This restores the old default. In testing, 1536KB was
enough for the sample image, 1024KB was not.

[1]: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#3127---112922

Bug: webp:614
Change-Id: I1ff7afc72fa49d88d2efe88d2a04dfadbea3b1a5
Fixed: webp:614
Test: emcc 3.1.18 & 3.1.41
2023-06-13 21:47:52 -07:00
James Zern
59a2b1f9e3 WebPDecodeYUV: check u/v/stride/uv_stride ptrs
The buffers are made mandatory to match WebPDecodeYUVInto(), though this
conflicts with WebPIDecGetYUVA().

spotted by Oliver Kunz (okunz at google dot com)

Change-Id: Ic4740c53b75da6b93d4f3462303fb9be0ebfbd48
2023-06-13 17:39:45 -07:00
Wan-Teh Chang
8e965ccb0f Call png_get_channels() to see if image has alpha
After the png_read_update_info() call, call png_get_channels() to find
out if the image has alpha.

Change-Id: I6fa709418744b4de90d10ff96eaeefe454ffa290
2023-06-13 17:35:31 -07:00
James Zern
fe80fbbd6b webp-container-spec: add some missing commas
The serial comma change is based on the Chicago Manual of Style
(CMOS), 17th edition.

Change-Id: I642d6eb87492bb671869b25415c59b96b749c798
2023-06-12 22:03:01 -07:00
Pascal Massimino
e8ed317609 Merge "treat FILTER_NONE as a regular Unfilter[] call" into main 2023-06-12 14:19:04 +00:00
James Zern
03a7a04892 webp-lossless-bitstream-spec: rm redundant statement
Within the 'Entropy image' subsection, its clear this is what is being
described in the following paragraphs. Remove 'as described below' from
the first sentence.

Bug: webp:611
Change-Id: I365d69c8f6963cd826849ebdd96e46206d38b55d
2023-06-08 11:22:10 -07:00
James Zern
c437c7aace webp-lossless-bitstream-spec: mv up prefix code group def
Move this to the top-level of the "Details" section as prefix codes are
discussed in both "Decoding and Building the Prefix Codes" and "Decoding
of Meta Prefix Codes"

Bug: webp:611
Change-Id: Ide2dfedf081d6c94122ac16ecded968ed760f90c
2023-06-08 11:22:10 -07:00
James Zern
e4f17a31a7 webp-lossless-bitstream-spec: fix section reference
in the Transformations section describing decoding of the transform
data followed by the image data. The section numbers were adjusted by 1
in:
337cf69f webp-lossless-bitstream-spec: mv Nomenclature after Intro

Bug: webp:611
Change-Id: I4eede0d068fabdef51a140a0268436ab6629e8bb
2023-06-08 11:22:10 -07:00
James Zern
e2ecd5e937 webp-lossless-bitstream-spec: clarify ABNF syntax
Give some examples of repetition and binary value notation to limit the
need to follow the ABNF reference.

Bug: webp:611
Change-Id: I5b5a7632f011e1523b4a528653fe3630afba3e3e
2023-06-08 11:22:10 -07:00
James Zern
8b55425a56 webp-lossless-bitstream-spec: refine pixel copy text
in 6.2.3 Decoding Entropy-Coded Image Data.

The copying of distance code pixels cause some confusion during the
AUTH48 portion of the RFC review process.

Bug: webp:611
Change-Id: I78f547ae10c95f180355a4c93ec6d48acdc09141
2023-06-08 11:22:10 -07:00
James Zern
29c9f2d410 webp-lossless-bitstream-spec: minor wording updates
Mostly grammatical and addition/subtraction of commas from the AUTH48
portion of the RFC review process.

The serial comma changes are based on the Chicago Manual of Style
(CMOS), 17th edition.

Bug: webp:611
Change-Id: I5ae2d1cc0196009dbf3a4c2195cc73c2ef809b49
2023-06-08 11:21:55 -07:00
skal
6b02f66015 treat FILTER_NONE as a regular Unfilter[] call
Removes the hard-coded memcpy() in alpha-decoding.

Change-Id: I1dfd98db206893d7715a79d05a1bd9272690471a
2023-06-07 15:42:16 +02:00
James Zern
7f75c91ced webp-container-spec: fix location of informative msg
preprocessing bits are informative, not the filtering bits.

since:
391f9db9 Ordering of description of bits in container spec

Change-Id: I1c0da963074ce9cf4d33a13b4b36c9421b3e3b9d
2023-06-06 22:09:41 -07:00
James Zern
f6499943c4 webp-container-spec: consistently quote FourCCs
from the AUTH48 portion of the RFC review process

Change-Id: I3aad4b32c95517735e98ffa0120228ee24be6a4d
2023-06-06 18:47:20 -07:00
James Zern
49918af32b webp-container-spec: minor wording updates
Mostly grammatical and addition/subtraction of commas from the AUTH48
portion of the RFC review process.

The serial comma changes are based on the Chicago Manual of Style
(CMOS), 17th edition.

Change-Id: Ic75abf2e53e09c8a849e28e9c40e16c127515287
2023-06-05 18:26:34 -07:00
James Zern
7f0a341943 update ChangeLog
Bug: webp:608
Change-Id: Ic2188807076eee4c311ea20b999ba66265df9003
2023-06-02 09:37:51 -07:00
James Zern
bab7efbe73 update NEWS
Bug: webp:608
Change-Id: I96245759d1f0d7ccb42de47e10e18677a509feaa
2023-06-02 09:31:46 -07:00
James Zern
7138bf8fc3 bump version to 1.3.1
libwebp{,decoder} - 1.3.1
libwebp libtool - 8.7.1
libwebpdecoder libtool - 4.7.1

mux - 1.3.1
libtool - 3.12.0

demux - 1.3.1
libtool - 2.13.0

sharpyuv - 0.2.1
libtool - 0.1.0

Bug: webp:608
Change-Id: Ia80c54651a45caa1baa595f66820a3c1091d05c4
2023-06-01 18:56:12 -07:00
James Zern
435b4ded42 update AUTHORS
Bug: webp:608
Change-Id: I84f5ea6a9de352cfb216198aee9f6fd204cd1c46
2023-06-01 17:13:22 -07:00
James Zern
473512298a update .mailmap
Bug: webp:608
Change-Id: Ib7d6fd5d9537770f7e4c6a3290a5071f617f9b91
2023-06-01 17:13:21 -07:00
Vincent Rabaud
46bc4fc9d9 Merge "Switch ExtraCost to ints and implement it in SSE." into main 2023-06-01 11:05:12 +00:00
Vincent Rabaud
828b4ce062 Switch ExtraCost to ints and implement it in SSE.
The histograms count the occurrences of len/dist in entropy images.
Those (at most (1<<14) by (1<<14)) are sub-sampled by at least
MIN_HUFFMAN_BITS == 2, hence at most 24 bits in a histogram value.
At most, we multiply by 19 (because the longest histogram is of
size 40 and we do 40>>1, cf code) for the bit cost. So it all fits
in 32 bits.

Change-Id: Ife24b035f54794851ff31f2fac07901f724c6d7f
2023-06-01 10:17:13 +02:00
James Zern
ff6c7f4e71 CONTRIBUTING.md: add C style / cmake-format notes
Change-Id: I54ad0e27341025a6385a736d5a79ab8b6556a6ec
2023-05-30 13:54:12 -07:00
James Zern
dd530437f6 add .cmake-format.py
Created with cmake-format 0.6.13 using:
--dump-config --max-subgroups-hwrap 3 --first-comment-is-literal true

Change-Id: Ica8ca81086dcf466d4ea9693ffcb4e31aa0af002
2023-05-30 13:54:06 -07:00
James Zern
adbe2cb17e cmake,cosmetics: apply cmake-format
using the defaults present in 0.6.13 and setting
--first-comment-is-literal to avoid reflowing the copyright block and
--max-subgroups-hwrap 3 (default is 2) to avoid making some short set()
statements multi-line.

Change-Id: I3d90c025b5b2bb353046f4da19b8e442a044b902
2023-05-30 12:14:28 -07:00
James Zern
15b365083d doc/webp-container-spec: rm future codec comment
From the compression standpoint the file format is fixed at this point.

Change-Id: I788fcf7106e4840bf2f9950dfb099a7bab88b3bf
2023-05-26 15:48:31 -07:00
James Zern
c369c4bf0b doc/webp-lossless-bitstream-spec: improve link text
Reference the section by number, rather than 'this section'. Fixes a
lint warning:

Style notice: Write unique, descriptive link text that makes sense
without the surrounding text. Don't use phrases such as this document,
this article, or click here.
https://developers.google.com/style/link-text?hl=en#write-link-text

Change-Id: Iab33e4980528dddb5eed4404d25a4a746705131a
2023-05-26 15:48:28 -07:00
James Zern
1de35f476b doc/webp-container-spec: don't use 'currently'
Provide examples of formats that WebP performs better than.

https://developers.google.com/style/timeless-documentation

Change-Id: I4ead60be349d8650478788484989bde9ff18f6b6
2023-05-26 15:48:26 -07:00
James Zern
bb06a16ed1 doc/webp-container-spec: prefer present tense
https://developers.google.com/style/tense

Change-Id: I0cd4e1431cddc340adf5634c07f0c60635b3d4f2
2023-05-26 15:48:23 -07:00
James Zern
9f38b71e01 doc/webp-lossless-bitstream-spec: prefer present tense
https://developers.google.com/style/tense

Change-Id: I1151ad0f585afd388920e6910a30aca4c2d0cc32
2023-05-26 15:48:17 -07:00
James Zern
7acb6b829a doc/webp-container-spec: avoid i.e. & e.g.
Using 'that is' or 'for example' is recommended:
https://developers.google.com/style/abbreviations#dont-use

Change-Id: I25b45f5b41687dfbd25a0fbea4978d6bc8e44ad2
2023-05-26 15:48:12 -07:00