mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:57:36 +00:00
LibVideo: Make new DecoderError class to report useful errors
This allows runtime strings, so we can format the errors to make them more helpful. Errors in the VP9 decoder will now print out a function, filename and line number for where a read or bitstream requirement has failed. The DecoderErrorCategory enum will classify the errors so library users can show general user-friendly error messages, while providing the debug information separately. Any non-DecoderErrorOr<> results can be wrapped by DECODER_TRY to return from decoder functions. This will also add the extra information mentioned above to the error message.
This commit is contained in:
parent
72efd9a5ff
commit
da9ff31166
5 changed files with 369 additions and 278 deletions
|
@ -7,9 +7,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Parser.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Error.h>
|
||||
#include <LibVideo/DecoderError.h>
|
||||
|
||||
#include "Parser.h"
|
||||
|
||||
namespace Video::VP9 {
|
||||
|
||||
|
@ -18,27 +20,27 @@ class Decoder {
|
|||
|
||||
public:
|
||||
Decoder();
|
||||
ErrorOr<void> decode_frame(ByteBuffer const&);
|
||||
DecoderErrorOr<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);
|
||||
ErrorOr<void> adapt_coef_probs();
|
||||
ErrorOr<void> adapt_non_coef_probs();
|
||||
DecoderErrorOr<void> adapt_coef_probs();
|
||||
DecoderErrorOr<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 */
|
||||
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);
|
||||
DecoderErrorOr<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);
|
||||
DecoderErrorOr<void> predict_inter(size_t plane, u32 x, u32 y, u32 w, u32 h, u32 block_index);
|
||||
|
||||
/* (8.6) Reconstruction and Dequantization */
|
||||
ErrorOr<void> reconstruct(size_t plane, u32 x, u32 y, TXSize size);
|
||||
DecoderErrorOr<void> reconstruct(size_t plane, u32 transform_block_x, u32 transform_block_y, TXSize transform_block_size);
|
||||
|
||||
/* (8.10) Reference Frame Update Process */
|
||||
ErrorOr<void> update_reference_frames();
|
||||
DecoderErrorOr<void> update_reference_frames();
|
||||
|
||||
NonnullOwnPtr<Parser> m_parser;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue