mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:47:46 +00:00
LibVideo: Allow bit stream reads to throw errors
Errors are propagated to the user of the decoder so that they can be aware of specific places where a read failed.
This commit is contained in:
parent
af0584ea53
commit
b37ea6b414
10 changed files with 529 additions and 509 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
|
||||
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -8,6 +9,7 @@
|
|||
|
||||
#include "Parser.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Error.h>
|
||||
|
||||
namespace Video::VP9 {
|
||||
|
||||
|
@ -16,27 +18,27 @@ class Decoder {
|
|||
|
||||
public:
|
||||
Decoder();
|
||||
bool decode_frame(ByteBuffer const&);
|
||||
ErrorOr<void> decode_frame(ByteBuffer const&);
|
||||
void dump_frame_info();
|
||||
|
||||
private:
|
||||
/* (8.4) Probability Adaptation Process */
|
||||
u8 merge_prob(u8 pre_prob, u8 count_0, u8 count_1, u8 count_sat, u8 max_update_factor);
|
||||
u8 merge_probs(int const* tree, int index, u8* probs, u8* counts, u8 count_sat, u8 max_update_factor);
|
||||
bool adapt_coef_probs();
|
||||
bool adapt_non_coef_probs();
|
||||
ErrorOr<void> adapt_coef_probs();
|
||||
ErrorOr<void> adapt_non_coef_probs();
|
||||
void adapt_probs(int const* tree, u8* probs, u8* counts);
|
||||
u8 adapt_prob(u8 prob, u8 counts[2]);
|
||||
|
||||
/* (8.5) Prediction Processes */
|
||||
bool predict_intra(size_t plane, u32 x, u32 y, bool have_left, bool have_above, bool not_on_right, TXSize tx_size, u32 block_index);
|
||||
bool predict_inter(size_t plane, u32 x, u32 y, u32 w, u32 h, u32 block_index);
|
||||
ErrorOr<void> predict_intra(size_t plane, u32 x, u32 y, bool have_left, bool have_above, bool not_on_right, TXSize tx_size, u32 block_index);
|
||||
ErrorOr<void> predict_inter(size_t plane, u32 x, u32 y, u32 w, u32 h, u32 block_index);
|
||||
|
||||
/* (8.6) Reconstruction and Dequantization */
|
||||
bool reconstruct(size_t plane, u32 x, u32 y, TXSize size);
|
||||
ErrorOr<void> reconstruct(size_t plane, u32 x, u32 y, TXSize size);
|
||||
|
||||
/* (8.10) Reference Frame Update Process */
|
||||
bool update_reference_frames();
|
||||
ErrorOr<void> update_reference_frames();
|
||||
|
||||
NonnullOwnPtr<Parser> m_parser;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue