Commit Graph

41 Commits

Author SHA1 Message Date
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Hendiadyoin1
fbb798f98c AK: Move integral log2 and exp to IntegerMath.h 2022-02-06 17:52:33 +00:00
Sam Atkins
45cf40653a Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Michel Hermier
0f729cebf4 LibVideo/VP9: Do not null guard calls to free 2022-01-01 17:30:25 +00:00
Andreas Kling
58fb3ebf66 LibCore+AK: Move MappedFile from AK to LibCore
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
2021-11-23 11:33:36 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Ali Mohammad Pur
97e97bccab Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
Andreas Kling
84656788bf Userland: Use kmalloc_array() where appropriate 2021-08-08 00:03:45 +02:00
Hendiadyoin1
ed46d52252 Everywhere: Use AK/Math.h if applicable
AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.

Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19 16:34:21 +04:30
FalseHonesty
d60bd42972 LibVideo/VP9: Implement MV reading & rectify MV storage issues
With this patch we are finally done with section 6.4.X of the spec :^)
The only parsing left to be done is 6.5.X, motion vector prediction.

Additionally, this patch fixes how MVs were being stored in the parser.
Originally, due to the spec naming two very different values very
similarly, these properties had totally wrong data types, but this has
now been rectified.
2021-07-10 21:28:56 +02:00
FalseHonesty
27fdf8361c LibVideo/VP9: Finish implementing block decoding (6.4.4)
Though technically block decoding calls into some other incomplete
methods, so it isn't functionally complete yet. However, we are
very close to being done with the 6.4.X sections :)
2021-07-10 21:28:56 +02:00
FalseHonesty
074fbd1b06 LibVideo/VP9: Implement parsing Token and MoreCoefs trees
These elements were being used in the new tokens implementation, so
support for them in the TreeParser has been added.

Additionally, this uncovered a bug where the nonzero contexts were
being cleared with the wrong size.
2021-07-10 21:28:56 +02:00
FalseHonesty
aa27ca1b16 LibVideo/VP9: Implement token parsing (6.4.24-6.4.26)
Note that this now requires a couple new syntax types to be parsed
in the TreeParser, so a follow-up commit will implement that behavior.
2021-07-10 21:28:56 +02:00
FalseHonesty
d79c9c262f LibVideo/VP9: Implement sections 6.1.2 and 8.4.1-8.4.4
These section implement the behavior to refresh the probability
tables after parsing a frame.
2021-07-10 21:28:56 +02:00
FalseHonesty
cf6b3d0ce9 LibVideo/VP9: Begin reference frame update process (8.10)
This was required for correctly parsing more than one frame's
height/width data properly. Additionally, start handling failure
a little more gracefully. Since we don't fully parse a tile before
starting to parse the next tile, we will now no longer make it past
the first tile mark, meaning we should not handle that scenario well.
2021-07-10 21:28:56 +02:00
FalseHonesty
514559f074 LibVideo/VP9: Rename Decoder -> Parser & create an actual Decoder class
The class that was previously named Decoder handled section 6.X.X of
the spec, which actually deals with parsing out the syntax of the data,
not the actual decoding logic which is specified in section 8.X.X.
The new Decoder class will be in charge of owning and running the
Parser, as well as implementing all of the decoding behavior.
2021-07-10 21:28:56 +02:00
FalseHonesty
66628053d4 LibVideo/VP9: Start parsing residuals (6.4.21-6.4.23)
Additionally, this uncovered a couple bugs with existing code,
so those have been fixed. Currently, parsing a whole video does
fail because we are now using a new calculation for frame width,
but it hasn't been fully implemented yet.
2021-07-10 21:28:56 +02:00
FalseHonesty
cbff7c386a LibVideo/VP9: Refactor how above & left contexts are stored & cleared
These make more sense as Vectors, and it makes it much easier to manage
their sizing.
2021-07-10 21:28:56 +02:00
FalseHonesty
91572a49c4 LibVideo/VP9: Specify which spec section defines certain behaviors 2021-07-10 21:28:56 +02:00
FalseHonesty
ce524214c9 LibVideo/VP9: Clean up formatting & use range-based for loops 2021-07-10 21:28:56 +02:00
FalseHonesty
559f5a087d LibVideo/VP9: Implement simple FIXMEs that use now supported data 2021-07-10 21:28:56 +02:00
FalseHonesty
e4f015ce3d LibVideo/VP9: Implement more TreeParser probability calculations
Now TreeParser has mostly complete probability calculation
implementations for all currently used syntax elements. Some of these
calculation methods aren't actually finished because they use data
we have yet to parse in the Decoder, but they're close to finished.
2021-07-10 21:28:56 +02:00
FalseHonesty
f85f557a1f LibVideo/VP9: Implement syntax element counting for supported elements
With the progress made in the Decoder thus far, we have the ability
to support most of the syntax element counters in the tree parser.

Additionally, it will now crash when trying to count unsupported
elements.
2021-07-10 21:28:56 +02:00
FalseHonesty
988e17ed05 LibVideo: Migrate to east-const style & apply other minor fixes
This patch brings all of LibVideo up to the east-const style in the
project. Additionally, it applies a few fixes from the reviews in #8170
that referred to older LibVideo code.
2021-06-30 11:03:51 +02:00
FalseHonesty
7d4053dde1 LibVideo/VP9: Implement most of block_mode_info methods (6.4.15-6.4.18) 2021-06-30 11:03:51 +02:00
FalseHonesty
42fdaa7f60 LibVideo/VP9: Implement most of inter_frame_mode_info (6.4.11-6.4.14) 2021-06-30 11:03:51 +02:00
FalseHonesty
e687f05b42 LibVideo/VP9: Implement intra_frame_mode_info procedure (6.4.6) 2021-06-30 11:03:51 +02:00
FalseHonesty
cc1a9e3d1c LibVideo/VP9: Add SAFE_CALL macro to help propagate failure state 2021-06-30 11:03:51 +02:00
FalseHonesty
741677b992 LibVideo/VP9: Refactor how TreeParser accesses decoder data
The TreeParser requires information about a lot of the decoder's
current state in order to parse syntax tree elements correctly, so
there has to be some communication between the Decoder and the
TreeParser. Previously, the Decoder would copy its state to the
TreeParser when it changed, however, this was a poor choice. Now,
the TreeParser simply has a reference to its owning Decoder, and
accesses its state directly.
2021-06-30 11:03:51 +02:00
FalseHonesty
375dbad144 LibVideo/VP9: Begin decoding VP9 blocks 2021-06-30 11:03:51 +02:00
FalseHonesty
2ce4155b42 LibVideo/VP9: Successfully parse partition syntax element 2021-06-30 11:03:51 +02:00
FalseHonesty
7ff6315246 LibVideo/VP9: Begin creating a tree parser to parse syntax elements 2021-06-30 11:03:51 +02:00
FalseHonesty
cfd65eafa9 LibVideo/VP9: Begin decoding tiles 2021-06-30 11:03:51 +02:00
FalseHonesty
f9899fc17f LibVideo/VP9: Parse compressed header data
This patch adds compressed header parsing to the VP9 decoder (section
6.4 of the spec). This is the final decoder step before we can start to
decode tiles.
2021-06-30 11:03:51 +02:00
FalseHonesty
baff94e44d LibVideo/VP9: Add Decoder and begin parsing uncompressed header data
This patch brings all of the previous work together and starts to
actually parse and decode frame information. Currently it only parses
the uncompressed header data (section 6.2 of the spec).
2021-06-12 22:48:28 +04:30
FalseHonesty
2e31b9cf7c LibVideo/VP9: Implement a bit stream to decode VP9 data
The VP9 specification requires a special decoding process to parse a
lot of the data read from a frame, so this BitStream wrapper implements
that behavior. These processes are defined in section 9 of the
VP9 spec.
2021-06-12 22:48:28 +04:30
FalseHonesty
18759ff56d LibVideo/VP9: Implement syntax element counter 2021-06-12 22:48:28 +04:30
FalseHonesty
8dd9d1bbdb LibVideo/VP9: Add probability table constants
This patch adds VP9's probability tables and the functions needed
to load/clear them.
2021-06-12 22:48:28 +04:30
FalseHonesty
ff3a2a703f LibVideo/VP9: Define all VP9 symbols and enum constants 2021-06-12 22:48:28 +04:30
FalseHonesty
403bb07443 LibVideo: Scaffold LibVideo and implement simplistic Matroska parser
This commit initializes the LibVideo library and implements parsing
basic Matroska container files. Currently, it will only parse audio
and video tracks.
2021-06-06 17:47:00 +02:00