Commit Graph

4730 Commits

Author SHA1 Message Date
Vincent Rabaud
24d7f9cb6e Switch code to SDL2.
Also simplify wasm html (now that it is suppported by all browsers).

Change-Id: I352b08594b93d3dd7d44832d4328b3546ccc1b90
2023-10-28 23:36:35 +02:00
James Zern
a429c0de64 sharpyuv: convert some for() to do/while
With loops that don't use an immediate value in the conditional, this
can produce fewer tests.

Change-Id: I75401c51f7f7653be2f8c04d5f3c4ce04aefc3fc
2023-10-25 12:25:16 -07:00
James Zern
f0cd786125 DoSharpArgbToYuv: remove constant from loop
pre-calculating rgb_bit_depth + GetPrecisionShift(rgb_bit_depth)
produces better assembly with clang.

Change-Id: Ic4c3a620c1634fb5ea7001fa709d28c547769f79
2023-10-25 12:25:12 -07:00
James Zern
339231cc37 SharpYuvConvertWithOptions,cosmetics: fix formatting
Change-Id: Ieffe5877c6d715d168b0e9526d8fa1a946860771
2023-10-25 12:25:08 -07:00
Arthur Eubanks
307071f144 Remove medium/large code model-specific inline asm
Initially added to workaround gcc implementation issues that clang
does not have. (gcc hardcodes rbx as the PIC register, clang uses a
virtual register)

Change-Id: I1a3277abf02b1ff437b4aea4d28f4cb1c0176b80
2023-10-24 09:48:12 +02:00
Maryla
deadc339d5 Fix transfer functions where toGamma and toLinear are swapped.
Change-Id: I2f7ef84d227009181dad1c17883741bd98bf92b6
2023-10-12 16:57:32 +02:00
Maryla Ustarroz-Calonge
e7b78d4375 Merge "Fix bug in FromLinearLog100." into main 2023-10-12 08:28:34 +00:00
James Zern
15a1309efc Merge "webp-lossless-bitstream-spec: delete extra blank line" into main 2023-10-11 18:31:37 +00:00
Maryla
54ca975245 Fix bug in FromLinearLog100.
Change-Id: Iddfa7d16fe44e375a93deae9636eadc8bef42767
2023-10-11 15:08:24 +02:00
Vincent Rabaud
d2cb2d8cfc Dereference after NULL check.
Change-Id: Ia592affff075b2e00c150b89febcf676c7dcbbd2
2023-10-11 14:21:54 +02:00
James Zern
e9d5010718 webp-lossless-bitstream-spec: delete extra blank line
This clears a lint warning.

Change-Id: I87926cb6e2448332d7bbf7a3fe064e7aaf791a72
2023-10-10 15:55:16 -07:00
James Zern
786579711f Merge changes Ief442c90,Ie6e9c9a5 into main
* changes:
  webp-lossless-bitstream-spec: update variable names
  webp-lossless-bitstream-spec: simplify abstract
2023-10-10 18:16:58 +00:00
James Zern
e30a588456 webp-lossless-bitstream-spec: update variable names
This syncs the document with the draft RFC.

block_xsize -> transform_width
i -> distance_code
x/ysize -> image_width/height

Change-Id: Ief442c90157e82c518e8cb175a522c519b16ac69
2023-10-09 21:24:01 -07:00
James Zern
09ca136801 Merge "webp-container-spec: change assert to MUST be TRUE" into main 2023-10-10 00:26:53 +00:00
James Zern
38cb4fc0ea iosbuild,xcframeworkbuild: add SharpYuv framework
Provides the missing symbols in WebP.framework & WebP.xcframework:
Undefined symbols for architecture arm64:
  "_SharpYuvConvert", referenced from:
      _ImportYUVAFromRGBA in libwebp.a(libwebpencode_la-picture_csp_enc.o)
  "_SharpYuvGetConversionMatrix", referenced from:
      _ImportYUVAFromRGBA in libwebp.a(libwebpencode_la-picture_csp_enc.o)
  "_SharpYuvInit", referenced from:
      _ImportYUVAFromRGBA in libwebp.a(libwebpencode_la-picture_csp_enc.o)

This was missed in:
  c3d0c2d7 fix ios build scripts after sharpyuv dep added

Bug: webp:623
Change-Id: I1c4582ec2cee801b52867674d553900d6028bea8
Fixed: webp:623
2023-10-06 18:41:03 -07:00
James Zern
40afa9269b webp-lossless-bitstream-spec: simplify abstract
This syncs the document with the draft RFC.

Change-Id: Ie6e9c9a50527378cb1b24e2c130a0a09855fe96e
2023-10-06 11:46:24 -07:00
James Zern
9db21143d0 webp-container-spec: change assert to MUST be TRUE
in the 'Canvas Assembly from Frames' section. This matches the format in
the RFC draft; assert was not defined

Change-Id: Ib943b42f75fd1b4c281848f14e0626df9c868f59
2023-10-06 11:33:23 -07:00
Anuraag Agrawal
cdbf88aed2 Fix typo in API docs for incremental decoding
Change-Id: I410450a9d2c5192086da9fceaeaabefb7b0f5e57
2023-10-02 10:51:49 +02:00
Vincent Rabaud
05c469843c Reformat vcpkg build instructions.
Change-Id: I2ca7bd2feb85103c2377cc48daf3453dc5d859e4
2023-09-20 13:03:30 +02:00
Vincent Rabaud
8534f53960 Merge "Never send VP8_STATUS_SUSPENDED back in non-incremental." into main 2023-09-19 09:23:01 +00:00
Vincent Rabaud
35e197bdb7 Never send VP8_STATUS_SUSPENDED back in non-incremental.
Add the incremental_ member to the internal VP8Decoder,
to mimic VP8LDecoder

Change-Id: I34842e473bb566f51c18fe42afda63e66c0185b6
2023-09-19 10:28:02 +02:00
Jonliu1993
61441425fe Add vcpkg installation instructions
Change-Id: Id6396a9c31cb47bb7b1d743da7d5554505cd81a8
2023-09-15 13:59:30 +02:00
Masahiro Hanada
dce8397fec Fix next is invalid pointer when WebPSafeMalloc fails
When WebPSafeMalloc fails on VP8LHuffmanTablesAllocate,
next is not initialized to NULL.
VP8LHuffmanTablesDeallocate uses next to know the following nodes.
A patch fixes this issue.

Change-Id: I144ae84cd97e5bca227018ef1afa95361267902c
2023-09-15 13:59:30 +02:00
Frank
57c58105f3 Cmake: wrong public macro WEBP_INCLUDE_DIRS
Change-Id: I2220e5a094fe7ca6274e654bcedb6cca194663eb
2023-09-15 13:59:30 +02:00
Vincent Rabaud
c1ffd9ac75 Merge "vp8l_enc: fix non-C90 code" into main 2023-09-15 06:45:52 +00:00
Vincent Rabaud
a3965948e0 Merge changes If628bb93,Ic79f6309,I45f0db23 into main
* changes:
  Update lossless spec for two simple codes.
  Fix non-C90 code.
  Fix static analyzer warnings.
2023-09-15 06:44:42 +00:00
James Zern
f80e9b7e4c vp8l_enc: fix non-C90 code
Change-Id: I14b5288c1b9392dcb64db09b9852f1d7d47b3200
2023-09-14 16:21:04 -07:00
Vincent Rabaud
accd141da3 Update lossless spec for two simple codes.
Bug: webp:611
Change-Id: If628bb9332ebca6dd11b3561c3458e0f43ed54a3
2023-09-14 22:43:45 +02:00
Vincent Rabaud
ac17ffffcb Fix non-C90 code.
Thank you OpenCV: https://github.com/opencv/opencv/blob/
1e54e5657927996e86b155d89f51c7b5a73461d2/3rdparty/libwebp/
CMakeLists.txt#L24

Change-Id: Ic79f6309951f96c380e44b3167c1a36aae6d8903
2023-09-14 22:43:45 +02:00
Vincent Rabaud
433c7dca11 Fix static analyzer warnings.
Change-Id: I45f0db2310b1188809963af93240e3d438f807b8
2023-09-14 22:43:45 +02:00
James Zern
5fac76cf8d libwebp-1.3.2
- 9/13/2023: version 1.3.2
   This is a binary compatible release.
   * security fix for lossless decoder (chromium: #1479274, CVE-2023-4863)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmUCZrcACgkQ+cPWvbgj
 K12xQBAAoR6PIMHsttDUvgrCmgM19HbDVYmN3fK1VSL2yhT2Nj71hloIBQ46j+pJ
 aLyOhLX92yvvDEORDvm12LO7e7VwbPxc66Lwh5q0AjgsliMD1sR0yFJHVnZTOrJ/
 ndF0G1dNkrwYYYLWPIDtxrfr2eyB0+el8zjUCkWuKn5WSeaiV3FNfjHmNjQsgf1K
 dyy4DHcmZb5N2eJ6OvsiGvp7JwOjTpoHmYB2TbqfzqbV3Wq/aWgLsuGffpcNiEgP
 i/GCTapAFTdYW7StqXUGWML0IV3E3CrcBYjlWJqR499/DTfX1jrNcyWbuR0iaM9e
 yKlYS4PeylB6xdyEGVNM+8j3Trt3YYxvTGO/ydh9D4CtjaJPzlLfs2646AaV6TFW
 34t9mUDm1ZqQP8yJNqpSF00iwH0LA5/dKTd9Xr/MSifB/nvF3aqQjEDHLeTgD6pS
 D0Kf6OkhBtRuDbw7bTMwTGOZ5Z/VLG9JFni9JPt/KylBANUXQAI8vn0jjZRmpAki
 ketic0AgoDtH1TmPA+AzbiPWxKuFHfH3CpoECsgbpJjuMjbJ7EuXDfiG6cUIqTrD
 Lk+r1jgkCTWikB0KnGxDaNnDx+U0iatH4XfuAqp0o3pEHdgH0p4Gk3Kb8oraSZNv
 Y9AM9TaUaGPZxdyXfyR8glvHSu3li15DF1l1Ewml9qSxuqs/4Ls=
 =Rv7k
 -----END PGP SIGNATURE-----

Merge tag 'v1.3.2'

libwebp-1.3.2

- 9/13/2023: version 1.3.2
  This is a binary compatible release.
  * security fix for lossless decoder (chromium: #1479274, CVE-2023-4863)

* tag 'v1.3.2':
  update ChangeLog
  update NEWS
  bump version to 1.3.2
  Fix OOB write in BuildHuffmanTable.

Bug: webp:620
Change-Id: I094a4fe6ab4f3f8ada6fb662ba9cc6ec0f3bdd87
2023-09-13 19:08:16 -07:00
James Zern
ca332209cb update ChangeLog
Bug: webp:620
Change-Id: I5703f222de7262736339dbfd6ba82f2039dfc850
2023-09-13 15:11:07 -07:00
James Zern
1ace578c91 update NEWS
Bug: webp:620
Change-Id: I393c58cc23ccf98fa3c5d1568f0689a36e64575b
2023-09-13 13:33:58 -07:00
James Zern
63234c4296 bump version to 1.3.2
libwebp{,decoder} - 1.3.2
libwebp libtool - 8.8.1
libwebpdecoder libtool - 4.8.1

mux - 1.3.2
libtool - 3.13.0

demux - 1.3.2
libtool - 2.14.0

sharpyuv - 0.2.1 (no change)
libtool - 0.1.0 (no change)

Bug: webp:620
Change-Id: I9a61d83ee92809de1c2501d1b4fb68aa38f98850
2023-09-13 13:24:49 -07:00
Vincent Rabaud
a35ea50de4 Add a fuzzer for ReadHuffmanCodes
Change-Id: If8c30aaa87c34007ae455a03daa7b3c0f22fc8c3
2023-09-12 23:41:29 +02:00
Vincent Rabaud
95ea5226c8 Fix invalid incremental decoding check.
The first condition is only necessary if we have not read enough
(enough being defined by src_last, not src_end which is the end
of the image).
The second condition now fits the comment below: "if not
incremental, and we are past the end of buffer".

BUG=oss-fuzz:62136

Change-Id: I0700f67c62db8e1c02c2e429a069a71e606a5e4f
2023-09-12 09:22:53 +02:00
Vincent Rabaud
2af26267cd Fix OOB write in BuildHuffmanTable.
First, BuildHuffmanTable is called to check if the data is valid.
If it is and the table is not big enough, more memory is allocated.

This will make sure that valid (but unoptimized because of unbalanced
codes) streams are still decodable.

Bug: chromium:1479274
Change-Id: I31c36dbf3aa78d35ecf38706b50464fd3d375741
(cherry picked from commit 902bc91903)
2023-09-07 15:14:39 -07:00
Vincent Rabaud
902bc91903 Fix OOB write in BuildHuffmanTable.
First, BuildHuffmanTable is called to check if the data is valid.
If it is and the table is not big enough, more memory is allocated.

This will make sure that valid (but unoptimized because of unbalanced
codes) streams are still decodable.

Bug: chromium:1479274
Change-Id: I31c36dbf3aa78d35ecf38706b50464fd3d375741
2023-09-07 21:16:03 +02:00
Vincent Rabaud
7ba44f80f3 Homogenize "__asm__ volatile" vs "asm volatile"
According to https://gcc.gnu.org/onlinedocs/gcc/extensions-to-the-c-language-family/how-to-use-inline-assembly-language-in-c-code.html

For the C language, the asm keyword is a GNU extension. When
writing C code that can be compiled with -ansi and the -std options
that select C dialects without GNU extensions, use __asm__ instead
of asm (see Alternate Keywords). For the C++ language, asm is a
standard keyword, but __asm__ can be used for code compiled with
-fno-asm.

Change-Id: I4af950e67c857c890290c1e3d9cc886da0748784
2023-09-06 17:15:05 +02:00
James Zern
68e271354e webp-container-spec: reorder example chunk layout
place the unknown 'XYZW' chunk at the end of the file to agree with the
order given by the 'Extended File Format' section.

Change-Id: I5cec5a61069a03f3487f5f9ff9209f5ead6de24c
2023-09-01 15:00:53 -07:00
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