mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:07:46 +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:
parent
57c7389200
commit
f2c0cee522
5 changed files with 61 additions and 77 deletions
|
@ -94,6 +94,20 @@ public:
|
|||
u32 columns() const { return m_columns; }
|
||||
u32 superblock_rows() const { return blocks_ceiled_to_superblocks(rows()); }
|
||||
u32 superblock_columns() const { return blocks_ceiled_to_superblocks(columns()); }
|
||||
// Calculates the output size for each plane in the frame.
|
||||
Gfx::Size<u32> decoded_size(bool uv) const
|
||||
{
|
||||
// NOTE: According to the spec, this would be `y_size_to_uv_size(subsampling, blocks_to_pixels(blocks_size))`.
|
||||
// We are deviating from that by creating smaller buffers to fit just the data we will store in an output
|
||||
// frame or reference frame buffer.
|
||||
if (uv) {
|
||||
return {
|
||||
y_size_to_uv_size(color_config.subsampling_y, size().width()),
|
||||
y_size_to_uv_size(color_config.subsampling_y, size().height()),
|
||||
};
|
||||
}
|
||||
return size();
|
||||
}
|
||||
|
||||
Vector2D<FrameBlockContext> const& block_contexts() const { return m_block_contexts; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue