Decoder.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include "Parser.h"
  8. #include <AK/ByteBuffer.h>
  9. namespace Video::VP9 {
  10. class Decoder {
  11. friend class Parser;
  12. public:
  13. Decoder();
  14. bool decode_frame(ByteBuffer const&);
  15. void dump_frame_info();
  16. private:
  17. /* (8.4) Probability Adaptation Process */
  18. u8 merge_prob(u8 pre_prob, u8 count_0, u8 count_1, u8 count_sat, u8 max_update_factor);
  19. u8 merge_probs(int const* tree, int index, u8* probs, u8* counts, u8 count_sat, u8 max_update_factor);
  20. bool adapt_coef_probs();
  21. bool adapt_non_coef_probs();
  22. void adapt_probs(int const* tree, u8* probs, u8* counts);
  23. u8 adapt_prob(u8 prob, u8 counts[2]);
  24. /* (8.5) Prediction Processes */
  25. 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);
  26. bool predict_inter(size_t plane, u32 x, u32 y, u32 w, u32 h, u32 block_index);
  27. /* (8.6) Reconstruction and Dequantization */
  28. bool reconstruct(size_t plane, u32 x, u32 y, TXSize size);
  29. /* (8.10) Reference Frame Update Process */
  30. bool update_reference_frames();
  31. NonnullOwnPtr<Parser> m_parser;
  32. };
  33. }