Nathan E. Egge | 8043cc4 | 2016-03-06 12:42:47 -0500 | [diff] [blame] | 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 | #include "aom_dsp/daalaboolreader.h" |
| 13 | |
| 14 | int 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 Alaiwan | 856b878 | 2017-07-07 12:06:25 +0200 | [diff] [blame] | 20 | od_ec_dec_init(&r->ec, buffer, size); |
Michael Bebenita | 6048d05 | 2016-08-25 14:40:54 -0700 | [diff] [blame] | 21 | #if CONFIG_ACCOUNTING |
| 22 | r->accounting = NULL; |
| 23 | #endif |
Nathan E. Egge | 8043cc4 | 2016-03-06 12:42:47 -0500 | [diff] [blame] | 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | const uint8_t *aom_daala_reader_find_end(daala_reader *r) { |
| 28 | return r->buffer_end; |
| 29 | } |
Michael Bebenita | 868fc0b | 2016-08-03 16:13:04 -0700 | [diff] [blame] | 30 | |
Nathan E. Egge | b244f39 | 2016-09-06 23:48:43 -0400 | [diff] [blame] | 31 | uint32_t aom_daala_reader_tell(const daala_reader *r) { |
Michael Bebenita | 868fc0b | 2016-08-03 16:13:04 -0700 | [diff] [blame] | 32 | return od_ec_dec_tell(&r->ec); |
| 33 | } |
Michael Bebenita | d7baf45 | 2016-08-25 11:27:56 -0700 | [diff] [blame] | 34 | |
Nathan E. Egge | b244f39 | 2016-09-06 23:48:43 -0400 | [diff] [blame] | 35 | uint32_t aom_daala_reader_tell_frac(const daala_reader *r) { |
Michael Bebenita | d7baf45 | 2016-08-25 11:27:56 -0700 | [diff] [blame] | 36 | return od_ec_dec_tell_frac(&r->ec); |
| 37 | } |