tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bitreader_buffer.h (1809B)


      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 #include "config/aom_config.h"
     19 
     20 #ifdef __cplusplus
     21 extern "C" {
     22 #endif
     23 
     24 typedef void (*aom_rb_error_handler)(void *data);
     25 
     26 struct aom_read_bit_buffer {
     27  const uint8_t *bit_buffer;
     28  const uint8_t *bit_buffer_end;
     29  uint32_t bit_offset;
     30 
     31  void *error_handler_data;
     32  aom_rb_error_handler error_handler;
     33 };
     34 
     35 size_t aom_rb_bytes_read(const struct aom_read_bit_buffer *rb);
     36 
     37 int aom_rb_read_bit(struct aom_read_bit_buffer *rb);
     38 
     39 int aom_rb_read_literal(struct aom_read_bit_buffer *rb, int bits);
     40 
     41 // Reads a variable length unsigned integer. Valid range is 0..UINT32_MAX - 1.
     42 // Returns UINT32_MAX if the input is too long (has 32 or more leading zero
     43 // bits).
     44 uint32_t aom_rb_read_uvlc(struct aom_read_bit_buffer *rb);
     45 
     46 #if CONFIG_AV1_DECODER
     47 uint32_t aom_rb_read_unsigned_literal(struct aom_read_bit_buffer *rb, int bits);
     48 
     49 int aom_rb_read_inv_signed_literal(struct aom_read_bit_buffer *rb, int bits);
     50 
     51 int16_t aom_rb_read_signed_primitive_refsubexpfin(
     52    struct aom_read_bit_buffer *rb, uint16_t n, uint16_t k, int16_t ref);
     53 #endif  // CONFIG_AV1_DECODER
     54 
     55 #ifdef __cplusplus
     56 }  // extern "C"
     57 #endif
     58 
     59 #endif  // AOM_AOM_DSP_BITREADER_BUFFER_H_