Commit graph

61658 commits

Author SHA1 Message Date
Timothy Flynn fe3fde2411 AK+LibUnicode: Implement a case-insensitive variant of find_byte_offset
The existing String::find_byte_offset is case-sensitive. This variant
allows performing searches using Unicode-aware case folding.
2024-06-01 07:37:54 +02:00
Diego cf6aa77816 LibWasm: Fix memory limits validator discrepancy
The spec allows the maximum size of the linear memory to be 2^16.
However, we previously only allowed 2^16-1, which caused a spec
compliance issue.
2024-06-01 00:28:48 +02:00
Andrew Kaster a9fdd819c3 LibCore: Don't leak EventLoopImplementationUnix's ThreadData
The ThreadData still has a lifetime a longer than the thread it was
created for, but at least now it's not leaked at process exit.
2024-05-31 15:24:46 -06:00
Nico Weber d8103247d9 Tests: Check that color indexing reduces file size 2024-05-31 22:39:25 +02:00
Nico Weber 8a21992030 image: Add a --webp-allowed-transforms switch
This is mainly useful for testing.
2024-05-31 22:39:25 +02:00
Nico Weber 533b29dde7 LibGfx/WebPWriter: Add a toggle for disabling individual transforms 2024-05-31 22:39:25 +02:00
Nico Weber 4a327d98a4 Tests: Add a test that triggers the webp color indexing saving path 2024-05-31 22:39:25 +02:00
Nico Weber 47d3245ea7 LibGfx/WebPWriter: Do not convert -inf to unsigned
Else UBSan complains about the color indexing test in this PR.
2024-05-31 22:39:25 +02:00
Nico Weber 9e61912f64 LibGfx/WebPWriter: Fix bug computing max_symbol bit length
Storing a number n needs floor(log2(n) + 1) bits, not ceil(log2(n)).
(The two expressions are identical except for when n is a power of 2.)

Serendipitously covered by the indexed color transform tests in this PR.
2024-05-31 22:39:25 +02:00
Nico Weber 5c990e87f4 LibGfx/WebPWriter: Add a dbgln_if() 2024-05-31 22:39:25 +02:00
Nico Weber e212c20228 LibGfx/WebPWriter: Implement pixel bundling for color indexing
If an image has <= 16 colors, WebP lossless files pack multiple
color table indexes into a single pixel's green channel, further
reducing file size. This adds support for that.

My current test files all have more than 16 colors. For a 16x16
black-and-white bitmap that contains a little smiley face in the
middle, this reduces the output size from 128B to 54B.
2024-05-31 22:39:25 +02:00
Nico Weber cae672e1f9 LibGfx/WebPWriter: Implement color indexing transform
If an image has 256 or fewer colors, WebP/Lossless allows storing
the colors in a helper image, and then storing just indexes into that
helper image in the main image's green channel, while setting
r, b, and a of the main image to 0.

Since constant-color channels need to space to store in WebP,
this reduces storage needed to 1/4th (if alpha is used) or 1/3rd
(if alpha is constant across the image).

If an image has <= 16 colors, WebP lossless files pack multiple
color table indexes into a single pixel's green channel, further
reducing file size. This pixel packing is not yet implemented in
this commit.

GIFs can store at most 256 colors per frame, so animated gifs
often have 256 or fewer colors, making this effective when
transcoding gifs.

(WebP also has a "subtract green" transform, which can be used
to need to store just a single channel for grayscale images, without
having to store a color table. That's not yet implemented -- for now,
we'll now store grayscale images using this color indexing transform
instead, which wastes to storage for the color table.)

(If an image has <= 256 colors but all these colors use only a single
channel, then storing a color table for these colors is also wasteful,
at least if the image has > 16 colors too. That's rare in practice,
but maybe we can add code for it later on.)

(WebP also has a "color cache" feature where the last few used colors
can be referenced using very few bits. This is what the webp spec says
is similar to palettes as well. We don't implement color cache writing
support yet either; maybe it's better than using a color indexing
transform for some inputs.)

Some numbers on my test files:

sunset-retro.png: No performance or binary size impact. The input
quickly uses more than 256 colors.

giphy.gif (184k): 4.1M -> 3.9M, 95.5 ms ± 4.9 ms -> 106.4 ms ± 5.3 ms
Most frames use more than 256 colors, but just barely. So fairly
expensive runtime wise, with just a small win.

(See comment on #24454 for the previous 4.9 MiB -> 4.1 MiB drop.)

7z7c.gif (11K): 118K -> 40K
Every frame has less than 256 colors (but more than 16, so no packing),
and so we can cut filesize roughly to 1/3rd: We only need to store an
index per channel. From 10.7x as large as the input to 3.6x as large.
2024-05-31 22:39:25 +02:00
Nico Weber 633f509eb4 LibGfx/WebP: Move TransformType to WebPSharedLossless.h 2024-05-31 22:39:25 +02:00
Nico Weber 804e85265e LibGfx/WebPWriter: Use an IsOpaque struct for tracking opacity
No behavior change, but this makes it easy to correctly set this
flag when adding an indexing transform: Opacity then needs to be
determined based on if colors in the color table have opacity,
not if the indexes into the color table do.

With this struct, only the first time something sets opacity is
honored, giving us those semantics.
2024-05-31 22:39:25 +02:00
Nico Weber c5dedbc54a LibGfx/WebPWriter: Give write_VP8L_coded_image() a kind parameter
This way, it can be used to write entropy-coded-images too,
which will be used when writing transforms.
2024-05-31 22:39:25 +02:00
Nico Weber b50702f490 LibGfx/WebP: Move ImageKind to WebPSharedLossless.h 2024-05-31 22:39:25 +02:00
Nico Weber 9dfb254c73 LibGfx/WebPWriter: Extract write_VP8L_coded_image() 2024-05-31 22:39:25 +02:00
Nico Weber d9aa594e86 LibGfx/WebPWriter: Add comment for image-stream production 2024-05-31 22:39:25 +02:00
Nico Weber 286cc6f905 LibGfx/WebPLoader: Prefix a few dbgln_if()s with chunk name 2024-05-31 22:39:25 +02:00
Nico Weber a2ddf054f2 LibGfx/WebPWriter: Remove two obsolete comments
In an early version of the huffman writing code, we always used 8 bits
here, and the comments still reflected that. Since we're now always
writing only as many bits as we need (in practice, still almost always
8), the comments are misleading.
2024-05-31 22:39:25 +02:00
Liav A. 925bea444b Base: Add a manual page for the shred utility 2024-05-31 17:39:59 +02:00
Andreas Kling 391c53025e Revert "LibProtocol: Retry reading if read errors with EAGAIN"
This reverts commit d0f88d4958.

This made us hang when loading GitHub repo pages.
2024-05-31 17:17:24 +02:00
Timothy Flynn ac15c1cc01 Meta: Port recent changes to the GN build
2ce61fe6ea
2024-05-31 10:44:00 -04:00
Andreas Kling a48fc971c6 LibJS: Rearrange ExecutionContext members to shrink the class
Just a minor tweak to make the class 8 bytes smaller.
2024-05-31 16:31:33 +02:00
Andreas Kling a3782782fa LibJS: Remove two unused members from ExecutionContext 2024-05-31 16:31:33 +02:00
Romain Chardiny f5cacf25e1 Utilities: Add shred utility 2024-05-31 13:49:34 +01:00
Romain Chardiny 892da127d0 LibCore: Add wrapper for fsync() 2024-05-31 13:49:34 +01:00
Timothy Flynn d6732e5906 Ladybird/AppKit: Implement a basic find-in-page panel 2024-05-31 06:30:39 -04:00
Timothy Flynn 8d4cd15cb1 Ladybird/AppKit: Change "Select All" text to be titlecase
Matches the rest of the menu items and Safari.
2024-05-31 06:30:39 -04:00
Timothy Flynn a73ac6aa3f Ladybird/Qt: Find the previous search match when the shift key is held 2024-05-31 06:30:39 -04:00
Timothy Flynn b5d80013ea Ladybird/Qt: Add tooltips to the find-in-page widget 2024-05-31 06:30:39 -04:00
Timothy Flynn 903078e4d1 Meta: Fix detection of QtMultimedia usage on macOS
We use Audio Unit for audio on macOS.
2024-05-31 06:30:39 -04:00
Timothy Flynn 5912df5e42 Meta: Port recent changes to the GN build
389a55fe36
2024-05-31 06:30:39 -04:00
Simon Wanner 11bb216912 LibTextCodec: Add replacement decoder 2024-05-31 07:56:26 +02:00
Simon Wanner 7f3b457e62 LibTextCodec: Add EUC-KR decoder 2024-05-31 07:56:26 +02:00
Simon Wanner ded6512ca8 LibTextCodec: Add Shift_JIS decoder 2024-05-31 07:56:26 +02:00
Simon Wanner 06f7c393b2 LibTextCodec: Add ISO-2022-JP decoder 2024-05-31 07:56:26 +02:00
Simon Wanner 45f0ae52be LibTextCodec: Add EUC-JP decoder 2024-05-31 07:56:26 +02:00
Simon Wanner 9943bb1d8e LibTextCodec: Add Big5 decoder 2024-05-31 07:56:26 +02:00
Simon Wanner 2ce61fe6ea LibTextCodec: Add GBK/GB18030 decoder
Includes changes from GB-18030-2022, which are not yet included in the
Encoding Specification, but WebKit, Blink and WPT are already updated.
2024-05-31 07:56:26 +02:00
Simon Wanner 9ed52504ab LibTextCodec: Delegate to process() in default validate() implementation 2024-05-31 07:56:26 +02:00
Simon Wanner 88c2586f25 LibTextCodec: Remove unused decoder classes 2024-05-31 07:56:26 +02:00
Andrew Kaster c4f2ff44a5 Ladybird: Respect window.open() features in Qt chrome 2024-05-30 16:16:33 -04:00
Andrew Kaster 46e00a8f5e LibWeb: Parse TokenizedFeatures from window.open 2024-05-30 16:16:33 -04:00
Andrew Kaster e2d50dc5dd LibWeb: Move window.open TokenizedFeature parsing into its own file 2024-05-30 16:16:33 -04:00
Tim Ledbetter 79143833b6 LibWeb/WebDriver: Ensure error responses are serialized correctly 2024-05-30 13:53:24 -04:00
Tim Ledbetter 4f0d6559f6 WPT: Update test expectations to match current test results 2024-05-30 11:03:56 -06:00
Tim Ledbetter d7ea308664 WPT: Update to latest master
Previously, it was not possible to run `wpt` locally with a python
version >= 3.12.
2024-05-30 11:03:56 -06:00
stelar7 a4e97c1598 WebDriver: Dont assume the pageLoad is an i64 2024-05-30 11:46:02 -04:00
stelar7 fa9c234976 WebDriver: Parse webSocketUrl capability 2024-05-30 11:46:02 -04:00