mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 17:07:47 +00:00
LibVideo: Implement block parsing for inter frames
This gets the decoder closer to fully parsing the second frame without any errors. It will still be unable to output an inter-predicted frame. The lack of output causes VideoPlayer to crash if it attempts to read the buffers for frame 1, so it is still limited to the first frame.
This commit is contained in:
parent
6c648329c4
commit
03738aa006
5 changed files with 435 additions and 96 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
|
||||
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -29,8 +30,17 @@ public:
|
|||
int m_value;
|
||||
};
|
||||
|
||||
TreeSelection(int const* values);
|
||||
TreeSelection(int value);
|
||||
constexpr TreeSelection(int const* values)
|
||||
: m_is_single_value(false)
|
||||
, m_value { .m_tree = values }
|
||||
{
|
||||
}
|
||||
|
||||
constexpr TreeSelection(int value)
|
||||
: m_is_single_value(true)
|
||||
, m_value { .m_value = value }
|
||||
{
|
||||
}
|
||||
|
||||
bool is_single_value() const { return m_is_single_value; }
|
||||
int get_single_value() const { return m_value.m_value; }
|
||||
|
@ -65,6 +75,23 @@ public:
|
|||
m_start_y = start_y;
|
||||
}
|
||||
|
||||
void set_mv_component(u8 component)
|
||||
{
|
||||
m_mv_component = component;
|
||||
}
|
||||
|
||||
ErrorOr<bool> parse_mv_bit(u8 bit)
|
||||
{
|
||||
m_mv_bit = bit;
|
||||
return parse_tree<bool>(SyntaxElementType::MVBit);
|
||||
}
|
||||
|
||||
ErrorOr<u8> parse_mv_class0_fr(bool mv_class0_bit)
|
||||
{
|
||||
m_mv_class0_bit = mv_class0_bit;
|
||||
return parse_tree<u8>(SyntaxElementType::MVClass0FR);
|
||||
}
|
||||
|
||||
private:
|
||||
u8 calculate_partition_probability(u8 node);
|
||||
u8 calculate_default_intra_mode_probability(u8 node);
|
||||
|
@ -101,6 +128,13 @@ private:
|
|||
u32 m_plane { 0 };
|
||||
TXSize m_tx_size;
|
||||
u32 m_pos { 0 };
|
||||
u8 m_mv_component { 0 };
|
||||
// 0xFF indicates the value has not been set.
|
||||
// parse_mv_bit should be called to set this.
|
||||
u8 m_mv_bit { 0xFF };
|
||||
// 0xFF indicates the value has not been set.
|
||||
// parse_mv_class0_fr should be called to set this.
|
||||
u8 m_mv_class0_bit { 0xFF };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue