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_BITWRITER_BUFFER_H_ 13 #define AOM_AOM_DSP_BITWRITER_BUFFER_H_ 14 15 #include "aom/aom_integer.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 struct aom_write_bit_buffer { 22 uint8_t *bit_buffer; 23 uint32_t bit_offset; 24 }; 25 26 int aom_wb_is_byte_aligned(const struct aom_write_bit_buffer *wb); 27 28 uint32_t aom_wb_bytes_written(const struct aom_write_bit_buffer *wb); 29 30 void aom_wb_write_bit(struct aom_write_bit_buffer *wb, int bit); 31 32 void aom_wb_overwrite_bit(struct aom_write_bit_buffer *wb, int bit); 33 34 void aom_wb_write_literal(struct aom_write_bit_buffer *wb, int data, int bits); 35 36 void aom_wb_write_unsigned_literal(struct aom_write_bit_buffer *wb, 37 uint32_t data, int bits); 38 39 void aom_wb_overwrite_literal(struct aom_write_bit_buffer *wb, int data, 40 int bits); 41 42 void aom_wb_write_inv_signed_literal(struct aom_write_bit_buffer *wb, int data, 43 int bits); 44 45 void aom_wb_write_uvlc(struct aom_write_bit_buffer *wb, uint32_t v); 46 47 void aom_wb_write_signed_primitive_refsubexpfin(struct aom_write_bit_buffer *wb, 48 uint16_t n, uint16_t k, 49 int16_t ref, int16_t v); 50 51 #ifdef __cplusplus 52 } // extern "C" 53 #endif 54 55 #endif // AOM_AOM_DSP_BITWRITER_BUFFER_H_ 56