LibVideo/VP9: Make get_tile_offset static and remove magic numbers

This can use the new utility functions for converting units now.
This commit is contained in:
Zaggy1024 2022-11-28 09:04:58 -06:00 committed by Andreas Kling
parent f5ea6c89df
commit b1c7bbc4ba
Notes: sideshowbarker 2024-07-17 03:52:50 +09:00
2 changed files with 7 additions and 8 deletions

View file

@ -845,6 +845,13 @@ DecoderErrorOr<u8> Parser::update_mv_prob(u8 prob)
return prob; return prob;
} }
static u32 get_tile_offset(u32 tile_start, u32 frame_size_in_blocks, u32 tile_size_log2)
{
u32 superblocks = blocks_ceiled_to_superblocks(frame_size_in_blocks);
u32 offset = superblocks_to_blocks((tile_start * superblocks) >> tile_size_log2);
return min(offset, frame_size_in_blocks);
}
DecoderErrorOr<void> Parser::decode_tiles(FrameContext& frame_context) DecoderErrorOr<void> Parser::decode_tiles(FrameContext& frame_context)
{ {
auto log2_dimensions = frame_context.log2_of_tile_counts; auto log2_dimensions = frame_context.log2_of_tile_counts;
@ -888,13 +895,6 @@ DecoderErrorOr<void> Parser::decode_tiles(FrameContext& frame_context)
return {}; return {};
} }
u32 Parser::get_tile_offset(u32 tile_num, u32 mis, u32 tile_size_log2)
{
u32 super_blocks = (mis + 7) >> 3u;
u32 offset = ((tile_num * super_blocks) >> tile_size_log2) << 3u;
return min(offset, mis);
}
DecoderErrorOr<void> Parser::decode_tile(TileContext& tile_context) DecoderErrorOr<void> Parser::decode_tile(TileContext& tile_context)
{ {
for (auto row = tile_context.rows_start; row < tile_context.rows_end; row += 8) { for (auto row = tile_context.rows_start; row < tile_context.rows_end; row += 8) {

View file

@ -92,7 +92,6 @@ private:
/* (6.4) Decode Tiles Syntax */ /* (6.4) Decode Tiles Syntax */
DecoderErrorOr<void> decode_tiles(FrameContext&); DecoderErrorOr<void> decode_tiles(FrameContext&);
u32 get_tile_offset(u32 tile_num, u32 mis, u32 tile_size_log2);
DecoderErrorOr<void> decode_tile(TileContext&); DecoderErrorOr<void> decode_tile(TileContext&);
void clear_left_context(TileContext&); void clear_left_context(TileContext&);
DecoderErrorOr<void> decode_partition(TileContext&, u32 row, u32 column, BlockSubsize subsize); DecoderErrorOr<void> decode_partition(TileContext&, u32 row, u32 column, BlockSubsize subsize);