1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

LibVideo/VP9: Move segmentation parameters to FrameContext

Note that some of the previous segmentation feature settings must be
preserved when a frame is decoded that doesn't use segmentation.

This change also allowed a few functions in Decoder to be made static.
This commit is contained in:
Zaggy1024 2022-11-25 17:20:07 -06:00 committed by Andreas Kling
parent d82dc14bd9
commit fedbc12c4d
7 changed files with 74 additions and 64 deletions

View file

@ -163,14 +163,14 @@ ErrorOr<PredictionMode> TreeParser::parse_uv_mode(BitStream& bit_stream, Probabi
return value;
}
ErrorOr<u8> TreeParser::parse_segment_id(BitStream& bit_stream, u8 const probabilities[7])
ErrorOr<u8> TreeParser::parse_segment_id(BitStream& bit_stream, Array<u8, 7> const& probabilities)
{
auto value = TRY(parse_tree<u8>(bit_stream, { segment_tree }, [&](u8 node) { return probabilities[node]; }));
// Segment ID is not counted.
return value;
}
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, Array<u8, 3> const& probabilities, u8 above_seg_pred_context, u8 left_seg_pred_context)
{
auto context = left_seg_pred_context + above_seg_pred_context;
auto value = TRY(parse_tree<bool>(bit_stream, { binary_tree }, [&](u8) { return probabilities[context]; }));