blob: c6e3ac82d80452734ef502693bb091a8e02ab600 [file] [log] [blame]
Nathan E. Egge8043cc42016-03-06 12:42:47 -05001/*
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#include "aom_dsp/daalaboolreader.h"
13
14int aom_daala_reader_init(daala_reader *r, const uint8_t *buffer, int size) {
15 if (size && !buffer) {
16 return 1;
17 }
18 r->buffer_end = buffer + size;
19 r->buffer = buffer;
Sebastien Alaiwan856b8782017-07-07 12:06:25 +020020 od_ec_dec_init(&r->ec, buffer, size);
Michael Bebenita6048d052016-08-25 14:40:54 -070021#if CONFIG_ACCOUNTING
22 r->accounting = NULL;
23#endif
Nathan E. Egge8043cc42016-03-06 12:42:47 -050024 return 0;
25}
26
27const uint8_t *aom_daala_reader_find_end(daala_reader *r) {
28 return r->buffer_end;
29}
Michael Bebenita868fc0b2016-08-03 16:13:04 -070030
Nathan E. Eggeb244f392016-09-06 23:48:43 -040031uint32_t aom_daala_reader_tell(const daala_reader *r) {
Michael Bebenita868fc0b2016-08-03 16:13:04 -070032 return od_ec_dec_tell(&r->ec);
33}
Michael Bebenitad7baf452016-08-25 11:27:56 -070034
Nathan E. Eggeb244f392016-09-06 23:48:43 -040035uint32_t aom_daala_reader_tell_frac(const daala_reader *r) {
Michael Bebenitad7baf452016-08-25 11:27:56 -070036 return od_ec_dec_tell_frac(&r->ec);
37}