1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57: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

@ -14,13 +14,18 @@
namespace Gfx {
// Can decode bitstreams encoded with VP8's and VP9's arithmetic boolean encoder.
class BooleanDecoder {
public:
/* (9.2) */
static ErrorOr<BooleanDecoder> initialize(MaybeOwned<BigEndianInputBitStream> bit_stream, size_t size_in_bytes);
/* (9.2) */
static ErrorOr<BooleanDecoder> initialize_vp9(MaybeOwned<BigEndianInputBitStream> bit_stream, size_t size_in_bytes);
ErrorOr<bool> read_bool(u8 probability);
ErrorOr<u8> read_literal(u8 bits);
ErrorOr<void> finish_decode();
ErrorOr<void> finish_decode_vp9();
private:
BooleanDecoder(MaybeOwned<BigEndianInputBitStream>&& bit_stream, u8 value, u8 range, u64 bits_left)