mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
LibVideo: Rename parse_tree_new to parse_tree in VP9/TreeParser.cpp
It is now the only function used to parse the binary trees in the VP9 decoder.
This commit is contained in:
parent
907816e629
commit
9dc622475e
1 changed files with 29 additions and 29 deletions
|
@ -21,7 +21,7 @@ namespace Video::VP9 {
|
||||||
// - 9.3.4: Counting each syntax element when it is read.
|
// - 9.3.4: Counting each syntax element when it is read.
|
||||||
|
|
||||||
template<typename OutputType>
|
template<typename OutputType>
|
||||||
inline ErrorOr<OutputType> parse_tree_new(BitStream& bit_stream, TreeParser::TreeSelection tree_selection, Function<u8(u8)> const& probability_getter)
|
inline ErrorOr<OutputType> parse_tree(BitStream& bit_stream, TreeParser::TreeSelection tree_selection, Function<u8(u8)> const& probability_getter)
|
||||||
{
|
{
|
||||||
// 9.3.3: The tree decoding function.
|
// 9.3.3: The tree decoding function.
|
||||||
if (tree_selection.is_single_value())
|
if (tree_selection.is_single_value())
|
||||||
|
@ -75,7 +75,7 @@ ErrorOr<Partition> TreeParser::parse_partition(BitStream& bit_stream, Probabilit
|
||||||
return probabilities[2];
|
return probabilities[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<Partition>(bit_stream, tree, probability_getter));
|
auto value = TRY(parse_tree<Partition>(bit_stream, tree, probability_getter));
|
||||||
increment_counter(counter.m_counts_partition[context][value]);
|
increment_counter(counter.m_counts_partition[context][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ ErrorOr<PredictionMode> TreeParser::parse_default_intra_mode(BitStream& bit_stre
|
||||||
}
|
}
|
||||||
u8 const* probabilities = probability_table.kf_y_mode_probs()[to_underlying(above_mode)][to_underlying(left_mode)];
|
u8 const* probabilities = probability_table.kf_y_mode_probs()[to_underlying(above_mode)][to_underlying(left_mode)];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||||
// Default intra mode is not counted.
|
// Default intra mode is not counted.
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ ErrorOr<PredictionMode> TreeParser::parse_default_uv_mode(BitStream& bit_stream,
|
||||||
// Probabilities
|
// Probabilities
|
||||||
u8 const* probabilities = probability_table.kf_uv_mode_prob()[to_underlying(y_mode)];
|
u8 const* probabilities = probability_table.kf_uv_mode_prob()[to_underlying(y_mode)];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||||
// Default UV mode is not counted.
|
// Default UV mode is not counted.
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ ErrorOr<PredictionMode> TreeParser::parse_intra_mode(BitStream& bit_stream, Prob
|
||||||
auto context = size_group_lookup[mi_size];
|
auto context = size_group_lookup[mi_size];
|
||||||
u8 const* probabilities = probability_table.y_mode_probs()[context];
|
u8 const* probabilities = probability_table.y_mode_probs()[context];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||||
increment_counter(counter.m_counts_intra_mode[context][to_underlying(value)]);
|
increment_counter(counter.m_counts_intra_mode[context][to_underlying(value)]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ ErrorOr<PredictionMode> TreeParser::parse_sub_intra_mode(BitStream& bit_stream,
|
||||||
// Probabilities
|
// Probabilities
|
||||||
u8 const* probabilities = probability_table.y_mode_probs()[0];
|
u8 const* probabilities = probability_table.y_mode_probs()[0];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||||
increment_counter(counter.m_counts_intra_mode[0][to_underlying(value)]);
|
increment_counter(counter.m_counts_intra_mode[0][to_underlying(value)]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -158,14 +158,14 @@ ErrorOr<PredictionMode> TreeParser::parse_uv_mode(BitStream& bit_stream, Probabi
|
||||||
// Probabilities
|
// Probabilities
|
||||||
u8 const* probabilities = probability_table.uv_mode_probs()[to_underlying(y_mode)];
|
u8 const* probabilities = probability_table.uv_mode_probs()[to_underlying(y_mode)];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||||
increment_counter(counter.m_counts_uv_mode[to_underlying(y_mode)][to_underlying(value)]);
|
increment_counter(counter.m_counts_uv_mode[to_underlying(y_mode)][to_underlying(value)]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<u8> TreeParser::parse_segment_id(BitStream& bit_stream, u8 const probabilities[7])
|
ErrorOr<u8> TreeParser::parse_segment_id(BitStream& bit_stream, u8 const probabilities[7])
|
||||||
{
|
{
|
||||||
auto value = TRY(parse_tree_new<u8>(bit_stream, { segment_tree }, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<u8>(bit_stream, { segment_tree }, [&](u8 node) { return probabilities[node]; }));
|
||||||
// Segment ID is not counted.
|
// Segment ID is not counted.
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ ErrorOr<u8> TreeParser::parse_segment_id(BitStream& bit_stream, u8 const probabi
|
||||||
ErrorOr<bool> TreeParser::parse_segment_id_predicted(BitStream& bit_stream, u8 const probabilities[3], u8 above_seg_pred_context, u8 left_seg_pred_context)
|
ErrorOr<bool> TreeParser::parse_segment_id_predicted(BitStream& bit_stream, u8 const probabilities[3], u8 above_seg_pred_context, u8 left_seg_pred_context)
|
||||||
{
|
{
|
||||||
auto context = left_seg_pred_context + above_seg_pred_context;
|
auto context = left_seg_pred_context + above_seg_pred_context;
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probabilities[context]; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probabilities[context]; }));
|
||||||
// Segment ID prediction is not counted.
|
// Segment ID prediction is not counted.
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ ErrorOr<PredictionMode> TreeParser::parse_inter_mode(BitStream& bit_stream, Prob
|
||||||
// Probabilities
|
// Probabilities
|
||||||
u8 const* probabilities = probability_table.inter_mode_probs()[mode_context_for_ref_frame_0];
|
u8 const* probabilities = probability_table.inter_mode_probs()[mode_context_for_ref_frame_0];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<PredictionMode>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||||
increment_counter(counter.m_counts_inter_mode[mode_context_for_ref_frame_0][to_underlying(value) - to_underlying(PredictionMode::NearestMv)]);
|
increment_counter(counter.m_counts_inter_mode[mode_context_for_ref_frame_0][to_underlying(value) - to_underlying(PredictionMode::NearestMv)]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ ErrorOr<InterpolationFilter> TreeParser::parse_interpolation_filter(BitStream& b
|
||||||
context = above_interp;
|
context = above_interp;
|
||||||
u8 const* probabilities = probability_table.interp_filter_probs()[context];
|
u8 const* probabilities = probability_table.interp_filter_probs()[context];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<InterpolationFilter>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<InterpolationFilter>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||||
increment_counter(counter.m_counts_interp_filter[context][to_underlying(value)]);
|
increment_counter(counter.m_counts_interp_filter[context][to_underlying(value)]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ ErrorOr<bool> TreeParser::parse_skip(BitStream& bit_stream, ProbabilityTables co
|
||||||
context += static_cast<u8>(left_skip.value_or(false));
|
context += static_cast<u8>(left_skip.value_or(false));
|
||||||
u8 probability = probability_table.skip_prob()[context];
|
u8 probability = probability_table.skip_prob()[context];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
||||||
increment_counter(counter.m_counts_skip[context][value]);
|
increment_counter(counter.m_counts_skip[context][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ ErrorOr<TXSize> TreeParser::parse_tx_size(BitStream& bit_stream, ProbabilityTabl
|
||||||
auto context = (above + left) > max_tx_size;
|
auto context = (above + left) > max_tx_size;
|
||||||
u8 const* probabilities = probability_table.tx_probs()[max_tx_size][context];
|
u8 const* probabilities = probability_table.tx_probs()[max_tx_size][context];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<TXSize>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
auto value = TRY(parse_tree<TXSize>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||||
increment_counter(counter.m_counts_tx_size[max_tx_size][context][value]);
|
increment_counter(counter.m_counts_tx_size[max_tx_size][context][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ ErrorOr<bool> TreeParser::parse_is_inter(BitStream& bit_stream, ProbabilityTable
|
||||||
context = 2 * static_cast<u8>(above_intra.has_value() ? above_intra.value() : left_intra.value());
|
context = 2 * static_cast<u8>(above_intra.has_value() ? above_intra.value() : left_intra.value());
|
||||||
u8 probability = probability_table.is_inter_prob()[context];
|
u8 probability = probability_table.is_inter_prob()[context];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
||||||
increment_counter(counter.m_counts_is_inter[context][value]);
|
increment_counter(counter.m_counts_is_inter[context][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ ErrorOr<ReferenceMode> TreeParser::parse_comp_mode(BitStream& bit_stream, Probab
|
||||||
}
|
}
|
||||||
u8 probability = probability_table.comp_mode_prob()[context];
|
u8 probability = probability_table.comp_mode_prob()[context];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<ReferenceMode>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
auto value = TRY(parse_tree<ReferenceMode>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
||||||
increment_counter(counter.m_counts_comp_mode[context][value]);
|
increment_counter(counter.m_counts_comp_mode[context][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ ErrorOr<bool> TreeParser::parse_comp_ref(BitStream& bit_stream, ProbabilityTable
|
||||||
|
|
||||||
u8 probability = probability_table.comp_ref_prob()[context];
|
u8 probability = probability_table.comp_ref_prob()[context];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
||||||
increment_counter(counter.m_counts_comp_ref[context][value]);
|
increment_counter(counter.m_counts_comp_ref[context][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ ErrorOr<bool> TreeParser::parse_single_ref_part_1(BitStream& bit_stream, Probabi
|
||||||
}
|
}
|
||||||
u8 probability = probability_table.single_ref_prob()[context][0];
|
u8 probability = probability_table.single_ref_prob()[context][0];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
||||||
increment_counter(counter.m_counts_single_ref[context][0][value]);
|
increment_counter(counter.m_counts_single_ref[context][0][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -552,21 +552,21 @@ ErrorOr<bool> TreeParser::parse_single_ref_part_2(BitStream& bit_stream, Probabi
|
||||||
}
|
}
|
||||||
u8 probability = probability_table.single_ref_prob()[context][1];
|
u8 probability = probability_table.single_ref_prob()[context][1];
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
||||||
increment_counter(counter.m_counts_single_ref[context][1][value]);
|
increment_counter(counter.m_counts_single_ref[context][1][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<MvJoint> TreeParser::parse_motion_vector_joint(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter)
|
ErrorOr<MvJoint> TreeParser::parse_motion_vector_joint(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter)
|
||||||
{
|
{
|
||||||
auto value = TRY(parse_tree_new<MvJoint>(bit_stream, { mv_joint_tree }, [&](u8 node) { return probability_table.mv_joint_probs()[node]; }));
|
auto value = TRY(parse_tree<MvJoint>(bit_stream, { mv_joint_tree }, [&](u8 node) { return probability_table.mv_joint_probs()[node]; }));
|
||||||
increment_counter(counter.m_counts_mv_joint[value]);
|
increment_counter(counter.m_counts_mv_joint[value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<bool> TreeParser::parse_motion_vector_sign(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component)
|
ErrorOr<bool> TreeParser::parse_motion_vector_sign(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component)
|
||||||
{
|
{
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probability_table.mv_sign_prob()[component]; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probability_table.mv_sign_prob()[component]; }));
|
||||||
increment_counter(counter.m_counts_mv_sign[component][value]);
|
increment_counter(counter.m_counts_mv_sign[component][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -575,21 +575,21 @@ ErrorOr<MvClass> TreeParser::parse_motion_vector_class(BitStream& bit_stream, Pr
|
||||||
{
|
{
|
||||||
// Spec doesn't mention node, but the probabilities table has an extra dimension
|
// Spec doesn't mention node, but the probabilities table has an extra dimension
|
||||||
// so we will use node for that.
|
// so we will use node for that.
|
||||||
auto value = TRY(parse_tree_new<MvClass>(bit_stream, { mv_class_tree }, [&](u8 node) { return probability_table.mv_class_probs()[component][node]; }));
|
auto value = TRY(parse_tree<MvClass>(bit_stream, { mv_class_tree }, [&](u8 node) { return probability_table.mv_class_probs()[component][node]; }));
|
||||||
increment_counter(counter.m_counts_mv_class[component][value]);
|
increment_counter(counter.m_counts_mv_class[component][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<bool> TreeParser::parse_motion_vector_class0_bit(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component)
|
ErrorOr<bool> TreeParser::parse_motion_vector_class0_bit(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component)
|
||||||
{
|
{
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probability_table.mv_class0_bit_prob()[component]; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probability_table.mv_class0_bit_prob()[component]; }));
|
||||||
increment_counter(counter.m_counts_mv_class0_bit[component][value]);
|
increment_counter(counter.m_counts_mv_class0_bit[component][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<u8> TreeParser::parse_motion_vector_class0_fr(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component, bool class_0_bit)
|
ErrorOr<u8> TreeParser::parse_motion_vector_class0_fr(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component, bool class_0_bit)
|
||||||
{
|
{
|
||||||
auto value = TRY(parse_tree_new<u8>(bit_stream, { mv_fr_tree }, [&](u8 node) { return probability_table.mv_class0_fr_probs()[component][class_0_bit][node]; }));
|
auto value = TRY(parse_tree<u8>(bit_stream, { mv_fr_tree }, [&](u8 node) { return probability_table.mv_class0_fr_probs()[component][class_0_bit][node]; }));
|
||||||
increment_counter(counter.m_counts_mv_class0_fr[component][class_0_bit][value]);
|
increment_counter(counter.m_counts_mv_class0_fr[component][class_0_bit][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -599,21 +599,21 @@ ErrorOr<bool> TreeParser::parse_motion_vector_class0_hp(BitStream& bit_stream, P
|
||||||
TreeParser::TreeSelection tree { 1 };
|
TreeParser::TreeSelection tree { 1 };
|
||||||
if (use_hp)
|
if (use_hp)
|
||||||
tree = { binary_tree };
|
tree = { binary_tree };
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, tree, [&](u8) { return probability_table.mv_class0_hp_prob()[component]; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, tree, [&](u8) { return probability_table.mv_class0_hp_prob()[component]; }));
|
||||||
increment_counter(counter.m_counts_mv_class0_hp[component][value]);
|
increment_counter(counter.m_counts_mv_class0_hp[component][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<bool> TreeParser::parse_motion_vector_bit(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component, u8 bit_index)
|
ErrorOr<bool> TreeParser::parse_motion_vector_bit(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component, u8 bit_index)
|
||||||
{
|
{
|
||||||
auto value = TRY(parse_tree_new<bool>(bit_stream, { binary_tree }, [&](u8) { return probability_table.mv_bits_prob()[component][bit_index]; }));
|
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probability_table.mv_bits_prob()[component][bit_index]; }));
|
||||||
increment_counter(counter.m_counts_mv_bits[component][bit_index][value]);
|
increment_counter(counter.m_counts_mv_bits[component][bit_index][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<u8> TreeParser::parse_motion_vector_fr(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component)
|
ErrorOr<u8> TreeParser::parse_motion_vector_fr(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, u8 component)
|
||||||
{
|
{
|
||||||
auto value = TRY(parse_tree_new<u8>(bit_stream, { mv_fr_tree }, [&](u8 node) { return probability_table.mv_fr_probs()[component][node]; }));
|
auto value = TRY(parse_tree<u8>(bit_stream, { mv_fr_tree }, [&](u8 node) { return probability_table.mv_fr_probs()[component][node]; }));
|
||||||
increment_counter(counter.m_counts_mv_fr[component][value]);
|
increment_counter(counter.m_counts_mv_fr[component][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ ErrorOr<bool> TreeParser::parse_motion_vector_hp(BitStream& bit_stream, Probabil
|
||||||
TreeParser::TreeSelection tree { 1 };
|
TreeParser::TreeSelection tree { 1 };
|
||||||
if (use_hp)
|
if (use_hp)
|
||||||
tree = { binary_tree };
|
tree = { binary_tree };
|
||||||
auto value = TRY(parse_tree_new<u8>(bit_stream, tree, [&](u8) { return probability_table.mv_hp_prob()[component]; }));
|
auto value = TRY(parse_tree<u8>(bit_stream, tree, [&](u8) { return probability_table.mv_hp_prob()[component]; }));
|
||||||
increment_counter(counter.m_counts_mv_hp[component][value]);
|
increment_counter(counter.m_counts_mv_hp[component][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -682,7 +682,7 @@ TokensContext TreeParser::get_tokens_context(bool subsampling_x, bool subsamplin
|
||||||
ErrorOr<bool> TreeParser::parse_more_coefficients(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, TokensContext const& context)
|
ErrorOr<bool> TreeParser::parse_more_coefficients(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, TokensContext const& context)
|
||||||
{
|
{
|
||||||
auto probability = probability_table.coef_probs()[context.m_tx_size][context.m_is_uv_plane][context.m_is_inter][context.m_band][context.m_context_index][0];
|
auto probability = probability_table.coef_probs()[context.m_tx_size][context.m_is_uv_plane][context.m_is_inter][context.m_band][context.m_context_index][0];
|
||||||
auto value = TRY(parse_tree_new<u8>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
auto value = TRY(parse_tree<u8>(bit_stream, { binary_tree }, [&](u8) { return probability; }));
|
||||||
increment_counter(counter.m_counts_more_coefs[context.m_tx_size][context.m_is_uv_plane][context.m_is_inter][context.m_band][context.m_context_index][value]);
|
increment_counter(counter.m_counts_more_coefs[context.m_tx_size][context.m_is_uv_plane][context.m_is_inter][context.m_band][context.m_context_index][value]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -700,7 +700,7 @@ ErrorOr<Token> TreeParser::parse_token(BitStream& bit_stream, ProbabilityTables
|
||||||
return (pareto_table[x][node - 2] + pareto_table[x + 1][node - 2]) >> 1;
|
return (pareto_table[x][node - 2] + pareto_table[x + 1][node - 2]) >> 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto value = TRY(parse_tree_new<Token>(bit_stream, { token_tree }, probability_getter));
|
auto value = TRY(parse_tree<Token>(bit_stream, { token_tree }, probability_getter));
|
||||||
increment_counter(counter.m_counts_token[context.m_tx_size][context.m_is_uv_plane][context.m_is_inter][context.m_band][context.m_context_index][min(2, value)]);
|
increment_counter(counter.m_counts_token[context.m_tx_size][context.m_is_uv_plane][context.m_is_inter][context.m_band][context.m_context_index][min(2, value)]);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue