Commit Graph

41845 Commits

Author SHA1 Message Date
Zaggy1024
1dc4652683 LibVideo: Rename MV to MotionVector for clarity 2022-10-09 20:32:40 -06:00
Zaggy1024
85fd56cf48 VideoPlayer: Display frames from the VP9 decoder
For testing purposes, the output buffer is taken directly from the
decoder and displayed in an image widget.

The first keyframe can be displayed, but the second will not decode
so VideoPlayer will stop at frame 0 for now.

This implements a BT.709 YCbCr to RGB conversion in VideoPlayer, but
that should be moved to a library for handling color space conversion.
2022-10-09 20:32:40 -06:00
Zaggy1024
1514004cd5 LibVideo: Implement VP9 intra-predicted frame decoding
The first keyframe of the test video can be decoded with these changes.

Raw memory allocations in the Parser have been replaced with Vector or
Array to avoid memory leaks and OOBs.
2022-10-09 20:32:40 -06:00
Zaggy1024
da9ff31166 LibVideo: Make new DecoderError class to report useful errors
This allows runtime strings, so we can format the errors to make them
more helpful. Errors in the VP9 decoder will now print out a function,
filename and line number for where a read or bitstream requirement
has failed.

The DecoderErrorCategory enum will classify the errors so library users
can show general user-friendly error messages, while providing the
debug information separately.

Any non-DecoderErrorOr<> results can be wrapped by DECODER_TRY to
return from decoder functions. This will also add the extra information
mentioned above to the error message.
2022-10-09 20:32:40 -06:00
Zaggy1024
72efd9a5ff LibVideo: Change decode_term_subexp read to the correct number of bits
This allows parsing of the implemented functions from the VP9 spec in
the test video included in /home/anon/Videos.
2022-10-09 20:32:40 -06:00
Zaggy1024
647472b716 LibVideo: Read multiple raw bits at once to refill the range decoder
This will allow BitStream::read_bool() to read more than one bit from
the range-coded bitstream at a time if needed.
2022-10-09 20:32:40 -06:00
Zaggy1024
13ccde8637 LibVideo: Improve error reporting for VP9 range decoder
init_bool will now check whether there is enough data in the bitstream
for the range coding size to be fully read.

exit_bool will now read the entire padding element regardless of size,
which the spec does not specify a limit on.
2022-10-09 20:32:40 -06:00
Zaggy1024
7f46033c01 LibVideo: Cache 64 bits at a time for reading in BitStream
Reads will now be done in larger chunks at a time.

The public read_byte() function was removed in favor of a private
fill_reservoir() function which will be used to fill the 64-bit
reservoir field which will then be bit-shifted and masked as necessary
for subsequent arbitrary bit-sized reads.

read_f(n) was renamed to read_bits to be clearer about its use.
2022-10-09 20:32:40 -06:00
Zaggy1024
b37ea6b414 LibVideo: Allow bit stream reads to throw errors
Errors are propagated to the user of the decoder so that they can be
aware of specific places where a read failed.
2022-10-09 20:32:40 -06:00
Zaggy1024
af0584ea53 LibVideo: Remove MV class's copy assignment overload
This was unnecessary, as the implicit one works correctly.
2022-10-09 20:32:40 -06:00
Zaggy1024
3ffbe20067 LibVideo: Remove printing of the interpolation filter in VP9 dump_info
The interpolation filter value is not set when reading an intra-only
frame, so printing this for the first keyframe of the file was printing
"220", which is invalid.
2022-10-09 20:32:40 -06:00
Zaggy1024
caee37ef9c LibVideo: Remove headers from CMakeLists.txt 2022-10-09 20:32:40 -06:00
Zaggy1024
b4c7375119 VideoPlayer: Remove unused #include <LibAudio/ConnectionToServer.h> 2022-10-09 20:32:40 -06:00
Ben Wiederhake
dc71e1e264 AK: Fix 'constexpr' attribute on non-constexpr function
is_url_code_point invokes StringView::contains, which never was and
cannot become constexpr.
2022-10-09 10:37:20 -06:00
Ben Wiederhake
ff8f3814cc AK+Tests: Avoid creating invalid code points from malformed UTF-8
Instead of doing anything reasonable, Utf8CodePointIterator returned
invalid code points, for example U+123456. However, many callers of this
iterator assume that a code point is always at most 0x10FFFF.

In fact, this is one of two reasons for the following OSS Fuzz issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49184
This is probably a very old bug.

In the particular case of URLParser, AK::is_url_code_point got confused:
    return /* ... */ || code_point >= 0xA0;
If code_point is a "code point" beyond 0x10FFFF, this violates the
condition given in the preceding comment, but satisfies the given
condition, which eventually causes URLParser to crash.

This commit fixes *only* the erroneous UTF-8 decoding, and does not
fully resolve OSS-Fuzz#49184.
2022-10-09 10:37:20 -06:00
Ben Wiederhake
3aeb57ed09 AK+Everywhere: Fix data corruption due to code-point-to-char conversion
In particular, StringView::contains(char) is often used with a u32
code point. When this is done, the compiler will for some reason allow
data corruption to occur silently.

In fact, this is one of two reasons for the following OSS Fuzz issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49184
This is probably a very old bug.

In the particular case of URLParser, AK::is_url_code_point got confused:
    return /* ... */ || "!$&'()*+,-./:;=?@_~"sv.contains(code_point);
If code_point is a large code point that happens to have the correct
lower bytes, AK::is_url_code_point is then convinced that the given
code point is okay, even if it is actually problematic.

This commit fixes *only* the silent data corruption due to the erroneous
conversion, and does not fully resolve OSS-Fuzz#49184.
2022-10-09 10:37:20 -06:00
Liav A
f07e0180d6 Kernel: Don't truncate physical memory space PDE pointers
For some odd reason we used to return PhysicalPtr for a page_table_base
result, but when setting it we accepted only a 32 bit value, so we
truncated valid 64 bit addresses into 32 bit addresses by doing that.
With this commit being applied, now PageDirectories can be located
beyond the 4 GiB barrier.

This was found by sin-ack, therefore he should be credited with this fix
appropriately with Co-authored-by sign.

Co-authored-by: sin-ack <sin-ack@users.noreply.github.com>
2022-10-09 09:58:08 -06:00
Liav A
9cbae2b607 Ports: Add dtc utility suite
This includes the known dtc utility as well with other bundled utilities
with it.
2022-10-09 09:51:57 -06:00
Andreas Kling
e5a353902d Meta: Add Andrew Kaster to list of project maintainers :^) 2022-10-09 15:16:06 +02:00
martinfalisse
f538dc2fae LibWeb+Base: Add grid repeat() functionality
Add ability to use values passed to grid-template-columns and
grid-template-rows for CSS Grid layout within a repeat() function.

E.g. grid-template-columns: repeat(2, 50px); means to have two columns
of 50px width each.
2022-10-09 12:40:18 +01:00
implicitfield
0b72d237c1 Taskbar: Display an icon for removing a widget 2022-10-09 10:20:47 +02:00
Tim Schumacher
d72a3b5959 Kernel: Do not mark .ro_after_init as NOLOAD
There is no particular reason why this section should be marked as
`NOBITS` (as it might very well include initialized values), and it
resolves 90% of the mismatches between the input and output sections,
which LLD now warns about when linking.
2022-10-09 10:20:19 +02:00
Andrew Kaster
07b950d8a6 LibWeb: Make HostDefined and Intrinsics free functions [[nodiscard]]
Hopefully no one else will forget to call set_prototype with the cached
prototype they just retrieved from a realm and spend a long time
wondering why their object has no properties...
2022-10-09 10:14:57 +02:00
Andrew Kaster
2d5bee256e LibWeb: Re-implement HTML::Navigator using IDL
Get rid of the bespoke NavigatorObject class and use the modern IDL
strategies for creating platform objects to re-implement Navigator and
its associcated mixin interfaces. While we're here, implement it in a
way that brings WorkerNavigator up to spec :^)
2022-10-09 10:14:57 +02:00
Andrew Kaster
14e1513077 LibWeb: Remove the workaround "Worker Window" from Workers
We can now properly add the prototypes and constructors to the global
object of the Worker's inner realm, so we don't need this window for
anything anymore.
2022-10-09 10:14:57 +02:00
Andrew Kaster
a74251ca91 Documentation: Update AddNewIDLFile for GC and Exposed changes 2022-10-09 10:14:57 +02:00
Andrew Kaster
a838cf2725 LibWeb: Delete WindowObjectHelper and use new generated helper instead
There's still some yaks to shave here as Window, Location and Navigator
don't have idl files yet.
2022-10-09 10:14:57 +02:00
Andrew Kaster
2acff8d853 LibWeb: Add new code generator for creating exposed interface helpers
This new code generator takes all the .idl files in LibWeb, looks for
each top level interface in there with an [Exposed=Foo] attribute, and
adds code to add the constructor and prototype for each of those exposed
interfaces to the realm of the relevant global object we're initialzing.

It will soon replace WindowObjectHelper as the way that web interfaces
are added to the Window object, and will be used in the future for
creating proper WorkerGlobalScope objects for dedicated and shared
workers.
2022-10-09 10:14:57 +02:00
Andrew Kaster
067a53b7e7 LibIDL: Remove static maps for interfaces and resolved imports
Instead, create a tree of Parsers all pointing to a top-level Parser.

All module imports and interfaces are stored at the top level, instead
of in a static map. This allows creating multiple IDL::Parsers in the
same process without them stepping on each others toes.
2022-10-09 10:14:57 +02:00
Andrew Kaster
2341294c20 LibIDL: Parse extended attributes that have () wrapped expressions
This includes things like Exposed and LegacyFactoryFunction.
2022-10-09 10:14:57 +02:00
Andrew Kaster
67ceba2e6a LibWeb: Add Exposed attribute and IDL spec links where missing
The intent is to use these to autogenerate prototype declarations for
Window and WorkerGlobalScope classes.

And the spec links are just nice to have :^)
2022-10-09 10:14:57 +02:00
MacDue
0265041d44 LibWeb: Fix ::-webkit-progress-bar/value pseudo elements
Recent changes to layout and display broke these pseudo elements
leading to crashes on a few websites such as https://rpcs3.net/.
2022-10-09 10:11:37 +02:00
MacDue
72605e854f Meta: Remove unused variables in CMakeLists.txt
Both USB_IDS_PATH and PCI_IDS_PATH are now unused so can be safely
removed.
2022-10-08 18:01:52 +01:00
MacDue
2ba3229ac6 Meta: Fix install path of usb.ids 2022-10-08 18:01:52 +01:00
Liav A
8edde0709a Ports: Update dmidecode version to 3.4
Also, let's stop use the signature file and instead just compare sha256
checksums.
2022-10-08 17:27:42 +02:00
Liav A
33ce7c939a Ports: Apply the known hygiene rules on the dmidecode port 2022-10-08 17:27:42 +02:00
Liav A
71647871f9 Ports: Update lz4 port to version 1.9.4 2022-10-08 17:27:27 +02:00
martinfalisse
e537035cc6 LibWeb+Base: Deal with column-spans greater than implicit grid
When the indicated column-span is greater than the implicit grid (like
in cases when the grid has the default size of 1x1, and the column is
supposed to span any number greater than that), then previously were
crashing.
2022-10-08 17:26:41 +02:00
martinfalisse
994d996ab2 LibWeb: Fix bug in maybe_add_column()
Fixes a bug in the maybe_add_column() implementation of the
OccupationGrid. Previously were checking for the width of the grid based
off of the first row, and so when augmenting the column count row-by-row
the latter rows would have differing column counts.

Also, were doing an unnecessary + 1 which I imagine comes from before
when I wasn't quite clear on whether I was referring to columns by
index or by the css-value of the column (column 1 in the css is
column index 0).
2022-10-08 17:26:41 +02:00
Andreas Kling
829186af7d LibWeb+WebContent: Add EventLoopPlugin::quit() virtual
This allows you to customize breaking out of the system event loop.
2022-10-08 10:54:52 +02:00
Andrew Kaster
a0d5724a58 LibWeb: Add initial implementation of Element.blur()
This implementation includes a first cut at run the unfocusing steps
from the spec, with many things left unimplemented.

The viewport related spec steps in particular don't seem to map to
LibWeb concepts, which makes figuring out if things are properly focused
much more difficult.
2022-10-07 21:17:50 +01:00
Timothy Flynn
f08a979b96 LibUnicode: Remove GCC codegen workaround
Reverts commits:
ffbf5596cd
f190e394b3
2022-10-07 18:21:40 +01:00
Timothy Flynn
e897008449 AK: Change ErrorOr to contain a Variant rather than inherit from it
GCC seems to get tripped up over this inheritance when converting from
an ErrorOr<StringView> to the partially specialized ErrorOr<void>. See
the following snippet:

    NEVER_INLINE ErrorOr<StringView> foo()
    {
        auto string = "abc"sv;
        outln("{:p}", string.characters_without_null_termination());
        return string;
    }

    NEVER_INLINE ErrorOr<void> bar()
    {
        auto string = TRY(foo());
        outln("{:p}", string.characters_without_null_termination());

        VERIFY(!string.starts_with('#'));
        return {};
    }

    int main()
    {
        MUST(bar());
    }

On some machines, bar() will contain a StringView whose pointer has had
its upper bits set to 0:

    0x000000010cafd6f8
    0x000000000cafd6f8

I'm not 100% clear on what's happening in the default-generated Variant
destructor that causes this. Probably worth investigating further.

The error would also be alleviated by making the Variant destructor
virtual, but rather than that, let's make ErrorOr simply contain a
Variant rather than inherit from it.

Fixes #15449.
2022-10-07 18:21:40 +01:00
Timothy Flynn
f38c68177b LibUnicode: Update code point ideographic replacements for Unicode 15 2022-10-07 18:17:40 +01:00
Gunnar Beutner
400cc41176 LibCore: Make Core::System::{send,recv}fd work on macOS
All the required bits were already there. Also, this would probably
work on FreeBSD without modification but I don't currently have
a system to test this on.
2022-10-07 18:14:48 +01:00
MacDue
35809ef400 LibGfx: Remove unnecessary divides in MatrixFilter 2022-10-07 13:08:24 +01:00
MacDue
b877d71db7 LibWeb: Add missing hue-rotate() filter spec comment 2022-10-07 13:08:24 +01:00
MacDue
5a832c0326 Base: Add example backdrop-filter using saturate() 2022-10-07 13:08:24 +01:00
MacDue
60cc96d243 LibWeb: Support painting the saturate() filter effect 2022-10-07 13:08:24 +01:00
MacDue
f77a84a5f6 LibGfx: Implement SaturateFilter
This implements the saturate operation as defined in the SVG filter
specification.

(https://drafts.fxtf.org/filter-effects-1/#feColorMatrixElement)
2022-10-07 13:08:24 +01:00