bitreader_buffer.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2016, Alliance for Open Media. All rights reserved
  3. *
  4. * This source code is subject to the terms of the BSD 2 Clause License and
  5. * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
  6. * was not distributed with this source code in the LICENSE file, you can
  7. * obtain it at www.aomedia.org/license/software. If the Alliance for Open
  8. * Media Patent License 1.0 was not distributed with this source code in the
  9. * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  10. */
  11. #ifndef AOM_AOM_DSP_BITREADER_BUFFER_H_
  12. #define AOM_AOM_DSP_BITREADER_BUFFER_H_
  13. #include <limits.h>
  14. #include "aom/aom_integer.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. typedef void (*aom_rb_error_handler)(void *data);
  19. struct aom_read_bit_buffer {
  20. const uint8_t *bit_buffer;
  21. const uint8_t *bit_buffer_end;
  22. uint32_t bit_offset;
  23. void *error_handler_data;
  24. aom_rb_error_handler error_handler;
  25. };
  26. size_t aom_rb_bytes_read(const struct aom_read_bit_buffer *rb);
  27. int aom_rb_read_bit(struct aom_read_bit_buffer *rb);
  28. int aom_rb_read_literal(struct aom_read_bit_buffer *rb, int bits);
  29. uint32_t aom_rb_read_unsigned_literal(struct aom_read_bit_buffer *rb, int bits);
  30. int aom_rb_read_inv_signed_literal(struct aom_read_bit_buffer *rb, int bits);
  31. uint32_t aom_rb_read_uvlc(struct aom_read_bit_buffer *rb);
  32. int16_t aom_rb_read_signed_primitive_refsubexpfin(
  33. struct aom_read_bit_buffer *rb, uint16_t n, uint16_t k, int16_t ref);
  34. #ifdef __cplusplus
  35. } // extern "C"
  36. #endif
  37. #endif // AOM_AOM_DSP_BITREADER_BUFFER_H_