• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef AOM_AV1_DECODER_DECODEFRAME_H_
13 #define AOM_AV1_DECODER_DECODEFRAME_H_
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 struct AV1Decoder;
20 struct aom_read_bit_buffer;
21 struct ThreadData;
22 
23 // Reads the middle part of the sequence header OBU (from
24 // frame_width_bits_minus_1 to enable_restoration) into seq_params.
25 // Reports errors by calling rb->error_handler() or aom_internal_error().
26 void av1_read_sequence_header(AV1_COMMON *cm, struct aom_read_bit_buffer *rb,
27                               SequenceHeader *seq_params);
28 
29 void av1_read_frame_size(struct aom_read_bit_buffer *rb, int num_bits_width,
30                          int num_bits_height, int *width, int *height);
31 BITSTREAM_PROFILE av1_read_profile(struct aom_read_bit_buffer *rb);
32 
33 // Returns 0 on success. Sets pbi->common.error.error_code and returns -1 on
34 // failure.
35 int av1_check_trailing_bits(struct AV1Decoder *pbi,
36                             struct aom_read_bit_buffer *rb);
37 
38 // On success, returns the frame header size. On failure, calls
39 // aom_internal_error and does not return.
40 // TODO(wtc): Figure out and document the p_data_end parameter.
41 uint32_t av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
42                                             struct aom_read_bit_buffer *rb,
43                                             const uint8_t *data,
44                                             const uint8_t **p_data_end,
45                                             int trailing_bits_present);
46 
47 void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
48                                     const uint8_t *data_end,
49                                     const uint8_t **p_data_end, int start_tile,
50                                     int end_tile, int initialize_flag);
51 
52 // Implements the color_config() function in the spec. Reports errors by
53 // calling rb->error_handler() or aom_internal_error().
54 void av1_read_color_config(struct aom_read_bit_buffer *rb,
55                            int allow_lowbitdepth, SequenceHeader *seq_params,
56                            struct aom_internal_error_info *error_info);
57 
58 // Implements the timing_info() function in the spec. Reports errors by calling
59 // rb->error_handler().
60 void av1_read_timing_info_header(AV1_COMMON *cm,
61                                  struct aom_read_bit_buffer *rb);
62 
63 // Implements the decoder_model_info() function in the spec. Reports errors by
64 // calling rb->error_handler().
65 void av1_read_decoder_model_info(AV1_COMMON *cm,
66                                  struct aom_read_bit_buffer *rb);
67 
68 // Implements the operating_parameters_info() function in the spec. Reports
69 // errors by calling rb->error_handler() or aom_internal_error().
70 void av1_read_op_parameters_info(AV1_COMMON *const cm,
71                                  struct aom_read_bit_buffer *rb, int op_num);
72 
73 struct aom_read_bit_buffer *av1_init_read_bit_buffer(
74     struct AV1Decoder *pbi, struct aom_read_bit_buffer *rb, const uint8_t *data,
75     const uint8_t *data_end);
76 
77 void av1_free_mc_tmp_buf(struct ThreadData *thread_data);
78 
79 void av1_set_single_tile_decoding_mode(AV1_COMMON *const cm);
80 
81 #ifdef __cplusplus
82 }  // extern "C"
83 #endif
84 
85 #endif  // AOM_AV1_DECODER_DECODEFRAME_H_
86