Cyril Concolato | 6c78883 | 2017-10-30 16:30:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, 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 | */ |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 11 | #ifndef AOM_COMMON_OBUDEC_H_ |
| 12 | #define AOM_COMMON_OBUDEC_H_ |
Cyril Concolato | 6c78883 | 2017-10-30 16:30:35 -0700 | [diff] [blame] | 13 | |
Tom Finegan | dd3e2a5 | 2018-05-23 14:33:09 -0700 | [diff] [blame] | 14 | #include "common/tools_common.h" |
Cyril Concolato | 6c78883 | 2017-10-30 16:30:35 -0700 | [diff] [blame] | 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
Tom Finegan | 66ae916 | 2018-03-19 18:12:50 -0700 | [diff] [blame] | 20 | struct ObuDecInputContext { |
| 21 | struct AvxInputContext *avx_ctx; |
| 22 | uint8_t *buffer; |
| 23 | size_t buffer_capacity; |
| 24 | size_t bytes_buffered; |
Soo-Chul Han | 29c46fb | 2018-03-23 16:02:00 -0400 | [diff] [blame] | 25 | int is_annexb; |
Tom Finegan | 66ae916 | 2018-03-19 18:12:50 -0700 | [diff] [blame] | 26 | }; |
Cyril Concolato | 6c78883 | 2017-10-30 16:30:35 -0700 | [diff] [blame] | 27 | |
Soo-Chul Han | 29c46fb | 2018-03-23 16:02:00 -0400 | [diff] [blame] | 28 | // Returns 1 when file data starts (if Annex B stream, after reading the |
| 29 | // size of the OBU) with what appears to be a Temporal Delimiter |
Tom Finegan | 66ae916 | 2018-03-19 18:12:50 -0700 | [diff] [blame] | 30 | // OBU as defined by Section 5 of the AV1 bitstream specification. |
| 31 | int file_is_obu(struct ObuDecInputContext *obu_ctx); |
| 32 | |
| 33 | // Reads one Temporal Unit from the input file. Returns 0 when a TU is |
| 34 | // successfully read, 1 when end of file is reached, and less than 0 when an |
| 35 | // error occurs. Stores TU data in 'buffer'. Reallocs buffer to match TU size, |
| 36 | // returns buffer capacity via 'buffer_size', and returns size of buffered data |
| 37 | // via 'bytes_read'. |
| 38 | int obudec_read_temporal_unit(struct ObuDecInputContext *obu_ctx, |
| 39 | uint8_t **buffer, size_t *bytes_read, |
Tom Finegan | 82a4118 | 2018-03-30 11:32:37 -0700 | [diff] [blame] | 40 | size_t *buffer_size); |
Tom Finegan | 66ae916 | 2018-03-19 18:12:50 -0700 | [diff] [blame] | 41 | |
| 42 | void obudec_free(struct ObuDecInputContext *obu_ctx); |
Cyril Concolato | 6c78883 | 2017-10-30 16:30:35 -0700 | [diff] [blame] | 43 | |
| 44 | #ifdef __cplusplus |
| 45 | } /* extern "C" */ |
| 46 | #endif |
| 47 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 48 | #endif // AOM_COMMON_OBUDEC_H_ |