Home | History | Annotate | Download | only in aom_dsp
      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 
     12 #ifndef AOM_AOM_DSP_BITREADER_BUFFER_H_
     13 #define AOM_AOM_DSP_BITREADER_BUFFER_H_
     14 
     15 #include <limits.h>
     16 
     17 #include "aom/aom_integer.h"
     18 
     19 #ifdef __cplusplus
     20 extern "C" {
     21 #endif
     22 
     23 typedef void (*aom_rb_error_handler)(void *data);
     24 
     25 struct aom_read_bit_buffer {
     26   const uint8_t *bit_buffer;
     27   const uint8_t *bit_buffer_end;
     28   uint32_t bit_offset;
     29 
     30   void *error_handler_data;
     31   aom_rb_error_handler error_handler;
     32 };
     33 
     34 size_t aom_rb_bytes_read(const struct aom_read_bit_buffer *rb);
     35 
     36 int aom_rb_read_bit(struct aom_read_bit_buffer *rb);
     37 
     38 int aom_rb_read_literal(struct aom_read_bit_buffer *rb, int bits);
     39 
     40 uint32_t aom_rb_read_unsigned_literal(struct aom_read_bit_buffer *rb, int bits);
     41 
     42 int aom_rb_read_inv_signed_literal(struct aom_read_bit_buffer *rb, int bits);
     43 
     44 uint32_t aom_rb_read_uvlc(struct aom_read_bit_buffer *rb);
     45 
     46 int16_t aom_rb_read_signed_primitive_refsubexpfin(
     47     struct aom_read_bit_buffer *rb, uint16_t n, uint16_t k, int16_t ref);
     48 
     49 #ifdef __cplusplus
     50 }  // extern "C"
     51 #endif
     52 
     53 #endif  // AOM_AOM_DSP_BITREADER_BUFFER_H_
     54