Commit Graph

4739 Commits

Author SHA1 Message Date
Ozkan Sezer
cbe825e4cc cmake: fix sharpyuv simd files' build
Without this, when targeting x86, the compiler may not enable sse2
by default without -msse2 switch and therefore leaves WEBP_USE_SSE2
undefined and the SSE2 procedure won't be built.

Change-Id: If983df5cd12c962cf153094468fb549ec3f2c89b
2024-02-10 00:58:20 +03:00
James Zern
f99305e9e5 Makefile.vc: add ARM64 support
This enables the executables and the correct flags, it's a full desktop
platform. This is different from the old Windows mobile ARM target.

Change-Id: I610d1579e5dac7b0a6a50ab9194a5f1fef2fc907
2024-01-31 14:12:03 -08:00
James Zern
5efd6300dc mv SharpYuvEstimate420Risk to extras/
There's no need for this in libsharpyuv currently. This avoids an ABI
bump and library size increase.

Change-Id: I3e4c79052fdb4d628a2d36491547233dd0b6dc34
2024-01-12 15:25:27 -08:00
James Zern
e78e924f84 Makefile.vc: add sharpyuv_risk_table.obj
missed in:
d7a0506d Add YUV420 riskiness metric.

Change-Id: I5c3cfeaf6757792ac97902f587e04bf95fd4c5a1
2023-12-21 15:43:17 -08:00
Maryla
d7a0506dcc Add YUV420 riskiness metric.
Basic version for 8 bit only and C only (no simd).

Hidden behind a compile flag because the precompiled table is
fairly large (114kiB) and more than triples the size of the library.

Change-Id: I165c78e863df6a17b32f578bdbffe3adda9ac1d0
2023-12-05 10:17:15 +01:00
Vincent Rabaud
89c5b91746 Merge "BuildHuffmanTable check sorted[] array bounds before writing" into main 2023-11-22 15:45:18 +00:00
Vincent Rabaud
34c8074915 Remove alpha encoding pessimization.
This was created to have outputs readable with libwebp 0.4.x
Jelly-Bean and Kit-Kat are not supported anymore:
https://android-developers.googleblog.com/2021/07/google-play-services-discontinuing-jelly-bean.html
https://android-developers.googleblog.com/2023/07/google-play-services-discontinuing-updates-for-kitkat.html

Change-Id: I0b9ff3091412ce12eb50da301d7dacace9b54cc3
2023-11-14 14:18:12 +01:00
Vincent Rabaud
13d9c30b2b Add a WEBP_NODISCARD
Change-Id: Ice66f2aa6358474d728fb19c571edc86ed139a49
2023-11-10 13:57:07 +01:00
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
Jonathan Grant
0b56dedc98 BuildHuffmanTable check sorted[] array bounds before writing
Change-Id: I6a83f414e86311121451e9da26004dfc3ac9b21f
2023-10-27 00:17:27 +01: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