mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:37:35 +00:00
LibVideo: Move parsing of Partition to its own TreeParser function
This adds a tree-parsing function that can be called statically from specific trees' implementations in TreeParser, of which Partition is the first. This way, all calls to tree parses will take the context they need to be able to select a tree and probabilities, which will allow removal of the state dependence in TreeParser on fields from itself and Parser.
This commit is contained in:
parent
69e6feaf32
commit
6192a33e79
3 changed files with 91 additions and 50 deletions
|
@ -23,6 +23,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
// FIXME: Move or remove this class once it is unused in the header.
|
||||
class TreeSelection {
|
||||
public:
|
||||
union TreeSelectionValue {
|
||||
|
@ -43,8 +44,8 @@ public:
|
|||
}
|
||||
|
||||
bool is_single_value() const { return m_is_single_value; }
|
||||
int get_single_value() const { return m_value.m_value; }
|
||||
int const* get_tree_value() const { return m_value.m_tree; }
|
||||
int single_value() const { return m_value.m_value; }
|
||||
int const* tree() const { return m_value.m_tree; }
|
||||
|
||||
private:
|
||||
bool m_is_single_value;
|
||||
|
@ -61,6 +62,8 @@ public:
|
|||
/* (9.3.4) */
|
||||
void count_syntax_element(SyntaxElementType type, int value);
|
||||
|
||||
static ErrorOr<Partition> parse_partition(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, bool has_rows, bool has_columns, BlockSubsize block_subsize, u8 num_8x8, Vector<u8> const& above_partition_context, Vector<u8> const& left_partition_context, u32 row, u32 column, bool frame_is_intra);
|
||||
|
||||
void set_default_intra_mode_variables(u8 idx, u8 idy)
|
||||
{
|
||||
m_idx = idx;
|
||||
|
@ -93,7 +96,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
u8 calculate_partition_probability(u8 node);
|
||||
u8 calculate_default_intra_mode_probability(u8 node);
|
||||
u8 calculate_default_uv_mode_probability(u8 node);
|
||||
u8 calculate_intra_mode_probability(u8 node);
|
||||
|
@ -137,4 +139,16 @@ private:
|
|||
u8 m_mv_class0_bit { 0xFF };
|
||||
};
|
||||
|
||||
struct PartitionTreeContext {
|
||||
bool has_rows;
|
||||
bool has_columns;
|
||||
BlockSubsize block_subsize;
|
||||
u8 num_8x8;
|
||||
Vector<u8> const& above_partition_context;
|
||||
Vector<u8> const& left_partition_context;
|
||||
u32 row;
|
||||
u32 column;
|
||||
bool frame_is_intra;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue