13358b313481c08268259f41f6c0ebeb5272c18cfjohannkoenig@chromium.org/*
23358b313481c08268259f41f6c0ebeb5272c18cfjohannkoenig@chromium.org *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
3474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
4474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  Use of this source code is governed by a BSD-style license
5474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  that can be found in the LICENSE file in the root of the source
6474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  tree. An additional intellectual property rights grant can be found
7474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  in the file PATENTS.  All contributing project authors may
8474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  be found in the AUTHORS file in the root of the source tree.
96fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org */
1010a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
11085cab8fbb48aa8b9f7e3e6d5a2694afd0ffe2e0johannkoenig@chromium.org#ifndef VP9_DECODER_VP9_READ_BIT_BUFFER_H_
12085cab8fbb48aa8b9f7e3e6d5a2694afd0ffe2e0johannkoenig@chromium.org#define VP9_DECODER_VP9_READ_BIT_BUFFER_H_
1310a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
1410a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org#include <limits.h>
1510a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
1610a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org#include "vpx/vpx_integer.h"
1710a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
18dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#ifdef __cplusplus
19dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.orgextern "C" {
20dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#endif
21dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org
22411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.orgtypedef void (*vp9_rb_error_handler)(void *data);
2310a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
2410a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.orgstruct vp9_read_bit_buffer {
2510a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org  const uint8_t *bit_buffer;
2610a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org  const uint8_t *bit_buffer_end;
2710a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org  size_t bit_offset;
2810a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
2910a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org  void *error_handler_data;
3010a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org  vp9_rb_error_handler error_handler;
3110a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org};
3210a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
3393a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgsize_t vp9_rb_bytes_read(struct vp9_read_bit_buffer *rb);
3410a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
3593a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgint vp9_rb_read_bit(struct vp9_read_bit_buffer *rb);
3610a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
3793a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgint vp9_rb_read_literal(struct vp9_read_bit_buffer *rb, int bits);
3810a9a0d835561a7f2300c561c514efcf374554d6fgalligan@chromium.org
3993a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgint vp9_rb_read_signed_literal(struct vp9_read_bit_buffer *rb, int bits);
4047265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org
41dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#ifdef __cplusplus
42dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org}  // extern "C"
43dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#endif
44dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org
45085cab8fbb48aa8b9f7e3e6d5a2694afd0ffe2e0johannkoenig@chromium.org#endif  // VP9_DECODER_VP9_READ_BIT_BUFFER_H_
46