Commit Graph

4768 Commits

Author SHA1 Message Date
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
Vincent Rabaud
e2922e4390 Merge "Check for the presence of the ANDROID_ABI variable" into main 2024-03-07 08:54:42 +00:00
Vincent Rabaud
501d9274a7 Copy C code to not have multiplication overflow
Change-Id: I9375170ce1217921a334c5b93dc3e0084f976688
2024-03-07 09:22:20 +01:00
James Zern
fba7d62ee5 CMakeLists.txt: apply cmake-format
Change-Id: I23b848d6936e5dd3b6a56f1e3218da5ed6f2539b
2024-03-06 15:56:36 -08:00
James Zern
661c1b6641 Merge "windows exports: use dllexport attribute, instead of visibility." into main 2024-03-06 23:54:57 +00:00
Ozkan Sezer
8487860a8c windows exports: use dllexport attribute, instead of visibility.
With older toolchains, at the least, visibility attributes don't
work and all symbols are exported along with lots of unsupported
warnings.

Change-Id: I6ffe220b7589a6bda00f42c17ead35592de7cc5a
2024-03-07 01:14:37 +03:00
James Zern
8ea678b990 webp/mux.h: data lifetime note w/copy_data=0
The data mostly must persist until a call to Assemble() is made. If the
data is discarded and subsequent calls are made the behavior is
undefined.

Change-Id: I64b39034ae4663e9ca25b85040b6068d09dfac04
2024-03-06 11:11:24 -08:00
Vincent Rabaud
79e05c7f9f Check for the presence of the ANDROID_ABI variable
BUG=webp:632

Change-Id: I8169be37d7b739b206ffb6555d58ff79a34c3605
2024-03-06 14:50:30 +01:00
natewood
45f995a37e Expose functions for managing non-image chunks on WebPAnimEncoder
Change-Id: Ie6376267eee6df3517417b6cadafcdf6112bd854
2024-02-27 16:55:24 -08:00
James Zern
1fb9f3dcf1 gifdec: fix ErrorGIFNotAvailable() declaration
A void parameter list should be (void), not (). Fixes a
-Wstrict-prototypes warning.

Change-Id: I180efbf7c58956695359320072cce1171d79e377
2024-02-22 13:58:19 -08:00
James Zern
4723db65bc cosmetics: s/SANITY_CHECK/DCHECK/
'sanity' is not an inclusive term. This is a debug check so DCHECK
better shows the intent.

https://source.android.com/docs/setup/contribute/respectful-code

Change-Id: I4cdad3ef9ddf0404d26e46b8430e3ad1d715c5b2
2024-02-16 11:57:16 -08:00
James Zern
f4b9bc9ea1 clear -Wextra-semi-stmt warnings
This is available with clang. Clears warnings of the form:
  warning: empty expression statement has no effect; remove unnecessary
    ';' to silence this warning [-Wextra-semi-stmt]

As a side-effect it also clear a few -Wpedantic warnings with gcc:
  warning: ISO C does not allow extra ';' outside of a function
    [-Wpedantic]

Change-Id: I9295c767aad475c68b1fbbdff855b0d6650a25f5
2024-02-15 18:55:22 -08:00
Yannis Guyon
713982b883 Limit animdecoder_fuzzer to 320MB
Change-Id: Ic139ea870b98c58a2ecf46e81844f647fa0d2aba
2024-02-15 10:16:54 +00:00
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