1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

LibVideo/VP9: Consolidate frame size calculations

This moves all the frame size calculation to `FrameContext`, where the
subsampling is easily accessible to determine the size for each plane.
The internal framebuffer size has also been reduced to the exact frame
size that is output.
This commit is contained in:
Zaggy1024 2023-04-18 20:16:44 -05:00 committed by Tim Flynn
parent 57c7389200
commit f2c0cee522
5 changed files with 61 additions and 77 deletions

View file

@ -1366,20 +1366,6 @@ DecoderErrorOr<i32> Parser::read_single_motion_vector_component(BooleanDecoder&
return (mv_sign ? -1 : 1) * static_cast<i32>(magnitude);
}
Gfx::Point<size_t> Parser::get_decoded_point_for_plane(FrameContext const& frame_context, u32 column, u32 row, u8 plane)
{
(void)frame_context;
if (plane == 0)
return { column * 8, row * 8 };
return { (column * 8) >> frame_context.color_config.subsampling_x, (row * 8) >> frame_context.color_config.subsampling_y };
}
Gfx::Size<size_t> Parser::get_decoded_size_for_plane(FrameContext const& frame_context, u8 plane)
{
auto point = get_decoded_point_for_plane(frame_context, frame_context.columns(), frame_context.rows(), plane);
return { point.x(), point.y() };
}
static TransformSize get_uv_transform_size(TransformSize transform_size, BlockSubsize size_for_plane)
{
return min(transform_size, max_txsize_lookup[size_for_plane]);