1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

LibGfx+LibVideo: Make BooleanDecoder usable for both VP8 and VP9

The marker bit is VP9-only, so move that into a new initialize_vp9()
function.

finish_decode() is VP9-only, so rename that to finish_decode_vp9().
This commit is contained in:
Nico Weber 2023-05-26 15:08:22 -04:00 committed by Andreas Kling
parent fbc53c1ec3
commit 1dfb065a9c
4 changed files with 19 additions and 9 deletions

View file

@ -229,7 +229,7 @@ public:
auto context_view = frame_context.m_block_contexts.view(rows_start, columns_start, height, width);
auto bit_stream = DECODER_TRY_ALLOC(try_make<BigEndianInputBitStream>(DECODER_TRY_ALLOC(try_make<FixedMemoryStream>(*frame_context.stream))));
auto decoder = DECODER_TRY(DecoderErrorCategory::Corrupted, BooleanDecoder::initialize(move(bit_stream), tile_size));
auto decoder = DECODER_TRY(DecoderErrorCategory::Corrupted, BooleanDecoder::initialize_vp9(move(bit_stream), tile_size));
return TileContext {
frame_context,

View file

@ -593,7 +593,7 @@ void Parser::setup_past_independence()
DecoderErrorOr<void> Parser::compressed_header(FrameContext& frame_context)
{
auto decoder = TRY_READ(BooleanDecoder::initialize(MaybeOwned(frame_context.bit_stream), frame_context.header_size_in_bytes));
auto decoder = TRY_READ(BooleanDecoder::initialize_vp9(MaybeOwned(frame_context.bit_stream), frame_context.header_size_in_bytes));
frame_context.transform_mode = TRY(read_tx_mode(decoder, frame_context));
if (frame_context.transform_mode == TransformMode::Select)
TRY(tx_mode_probs(decoder));
@ -610,7 +610,7 @@ DecoderErrorOr<void> Parser::compressed_header(FrameContext& frame_context)
TRY(read_partition_probs(decoder));
TRY(mv_probs(decoder, frame_context));
}
TRY_READ(decoder.finish_decode());
TRY_READ(decoder.finish_decode_vp9());
return {};
}
@ -1002,7 +1002,7 @@ DecoderErrorOr<void> Parser::decode_tile(TileContext& tile_context)
TRY(decode_partition(tile_context, row, col, Block_64x64));
}
}
TRY_READ(tile_context.decoder.finish_decode());
TRY_READ(tile_context.decoder.finish_decode_vp9());
return {};
}