blob: f273d76aec30d117a89d7621cca09ba9ddf14f86 [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * 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.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
11
Yaowu Xuf883b422016-08-30 14:01:10 -070012#ifndef AOM_DSP_BITWRITER_BUFFER_H_
13#define AOM_DSP_BITWRITER_BUFFER_H_
Yaowu Xuc27fc142016-08-22 16:08:15 -070014
Yaowu Xuf883b422016-08-30 14:01:10 -070015#include "aom/aom_integer.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070016
17#ifdef __cplusplus
18extern "C" {
19#endif
20
Yaowu Xuf883b422016-08-30 14:01:10 -070021struct aom_write_bit_buffer {
Yaowu Xuc27fc142016-08-22 16:08:15 -070022 uint8_t *bit_buffer;
James Zern71a37de2017-04-20 16:03:13 -070023 uint32_t bit_offset;
Yaowu Xuc27fc142016-08-22 16:08:15 -070024};
25
Cyril Concolato2dab2752018-02-26 14:25:47 -080026#if CONFIG_TRAILING_BITS
27int aom_wb_is_byte_aligned(const struct aom_write_bit_buffer *wb);
28#endif
29
James Zern71a37de2017-04-20 16:03:13 -070030uint32_t aom_wb_bytes_written(const struct aom_write_bit_buffer *wb);
Yaowu Xuc27fc142016-08-22 16:08:15 -070031
Yaowu Xuf883b422016-08-30 14:01:10 -070032void aom_wb_write_bit(struct aom_write_bit_buffer *wb, int bit);
Yaowu Xuc27fc142016-08-22 16:08:15 -070033
Thomas Daviesfaa7fcf2016-11-14 11:59:43 +000034void aom_wb_overwrite_bit(struct aom_write_bit_buffer *wb, int bit);
35
Yaowu Xuf883b422016-08-30 14:01:10 -070036void aom_wb_write_literal(struct aom_write_bit_buffer *wb, int data, int bits);
Yaowu Xuc27fc142016-08-22 16:08:15 -070037
Andrey Norkin28e9ce22018-01-08 10:11:21 -080038void aom_wb_write_unsigned_literal(struct aom_write_bit_buffer *wb,
39 uint32_t data, int bits);
Andrey Norkin28e9ce22018-01-08 10:11:21 -080040
Thomas Daviesfaa7fcf2016-11-14 11:59:43 +000041void aom_wb_overwrite_literal(struct aom_write_bit_buffer *wb, int data,
42 int bits);
43
Yaowu Xuf883b422016-08-30 14:01:10 -070044void aom_wb_write_inv_signed_literal(struct aom_write_bit_buffer *wb, int data,
Yaowu Xuc27fc142016-08-22 16:08:15 -070045 int bits);
46
47#ifdef __cplusplus
48} // extern "C"
49#endif
50
Yaowu Xuf883b422016-08-30 14:01:10 -070051#endif // AOM_DSP_BITWRITER_BUFFER_H_