diff options
author | Zaggy1024 <zaggy1024@gmail.com> | 2022-11-28 09:04:58 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-11-30 08:28:30 +0100 |
commit | b1c7bbc4ba05d3acb6388db2a74868c92d0d49ec (patch) | |
tree | 3b6b7500115477d73adc1ce5dbb0d51c74a2f6e5 | |
parent | f5ea6c89df3ba081a416399bd0107224ad8cc662 (diff) | |
download | serenity-b1c7bbc4ba05d3acb6388db2a74868c92d0d49ec.zip |
LibVideo/VP9: Make get_tile_offset static and remove magic numbers
This can use the new utility functions for converting units now.
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Parser.cpp | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Parser.h | 1 |
2 files changed, 7 insertions, 8 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp index ae60ae8f0c..7e073a0e53 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.cpp +++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp @@ -845,6 +845,13 @@ DecoderErrorOr<u8> Parser::update_mv_prob(u8 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) { auto log2_dimensions = frame_context.log2_of_tile_counts; @@ -888,13 +895,6 @@ DecoderErrorOr<void> Parser::decode_tiles(FrameContext& frame_context) 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) { for (auto row = tile_context.rows_start; row < tile_context.rows_end; row += 8) { diff --git a/Userland/Libraries/LibVideo/VP9/Parser.h b/Userland/Libraries/LibVideo/VP9/Parser.h index f22b77417e..768a150c48 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.h +++ b/Userland/Libraries/LibVideo/VP9/Parser.h @@ -92,7 +92,6 @@ private: /* (6.4) Decode Tiles Syntax */ DecoderErrorOr<void> decode_tiles(FrameContext&); - u32 get_tile_offset(u32 tile_num, u32 mis, u32 tile_size_log2); DecoderErrorOr<void> decode_tile(TileContext&); void clear_left_context(TileContext&); DecoderErrorOr<void> decode_partition(TileContext&, u32 row, u32 column, BlockSubsize subsize); |