mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
LibVideo/VP9: Use unit conversion functions in BlockContext
This should make things in there seem a little less magical :^)
This commit is contained in:
parent
1fe22f2141
commit
720fc5a853
2 changed files with 16 additions and 4 deletions
|
@ -69,14 +69,14 @@ public:
|
|||
m_size = size;
|
||||
|
||||
// From spec, compute_image_size( )
|
||||
m_rows = (size.height() + 7u) >> 3u;
|
||||
m_columns = (size.width() + 7u) >> 3u;
|
||||
m_rows = pixels_to_blocks(size.height() + 7u);
|
||||
m_columns = pixels_to_blocks(size.width() + 7u);
|
||||
return m_block_contexts.try_resize(m_rows, m_columns);
|
||||
}
|
||||
u32 rows() const { return m_rows; }
|
||||
u32 columns() const { return m_columns; }
|
||||
u32 superblock_rows() const { return (rows() + 7u) >> 3u; }
|
||||
u32 superblock_columns() const { return (columns() + 7u) >> 3u; }
|
||||
u32 superblock_rows() const { return blocks_to_superblocks(rows() + 7u); }
|
||||
u32 superblock_columns() const { return blocks_to_superblocks(columns() + 7u); }
|
||||
|
||||
Vector2D<FrameBlockContext> const& block_contexts() const { return m_block_contexts; }
|
||||
|
||||
|
|
|
@ -60,6 +60,18 @@ inline Gfx::Size<u8> block_size_to_sub_blocks(BlockSubsize size)
|
|||
return Gfx::Size<u8>(num_4x4_blocks_wide_lookup[size], num_4x4_blocks_high_lookup[size]);
|
||||
}
|
||||
|
||||
template<Integral T>
|
||||
inline T blocks_to_superblocks(T blocks)
|
||||
{
|
||||
return blocks >> 3;
|
||||
}
|
||||
|
||||
template<Integral T>
|
||||
inline T superblocks_to_blocks(T superblocks)
|
||||
{
|
||||
return superblocks << 3;
|
||||
}
|
||||
|
||||
template<Integral T>
|
||||
inline T blocks_to_sub_blocks(T blocks)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue