1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:07:36 +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

@ -254,6 +254,11 @@ struct ColorConfig {
bool subsampling_y { true };
};
struct SegmentFeature {
bool enabled { false };
u8 value { 0 };
};
struct FrameContext {
public:
FrameContext(Vector2D<FrameBlockContext>& contexts)
@ -330,6 +335,15 @@ public:
return base_quantizer_index == 0 && y_dc_quantizer_index_delta == 0 && uv_dc_quantizer_index_delta == 0 && uv_ac_quantizer_index_delta == 0;
}
bool segmentation_enabled { false };
// Note: We can use Optional<Array<...>> for these tree probabilities, but unfortunately it seems to have measurable performance overhead.
bool use_full_segment_id_tree { false };
Array<u8, 7> full_segment_id_tree_probabilities;
bool use_predicted_segment_id_tree { false };
Array<u8, 3> predicted_segment_id_tree_probabilities;
bool should_use_absolute_segment_base_quantizer { false };
Array<Array<SegmentFeature, SEG_LVL_MAX>, MAX_SEGMENTS> segmentation_features;
u16 header_size_in_bytes { 0 };
TXMode transform_mode;