xref: /aosp_15_r20/external/libaom/av1/decoder/decodeframe.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
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 BITSTREAM_PROFILE av1_read_profile(struct aom_read_bit_buffer *rb);
30 
31 // Returns 0 on success. Sets pbi->common.error.error_code and returns -1 on
32 // failure.
33 int av1_check_trailing_bits(struct AV1Decoder *pbi,
34                             struct aom_read_bit_buffer *rb);
35 
36 // On success, returns the frame header size. On failure, calls
37 // aom_internal_error and does not return.
38 uint32_t av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
39                                             struct aom_read_bit_buffer *rb,
40                                             int trailing_bits_present);
41 
42 void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
43                                     const uint8_t *data_end,
44                                     const uint8_t **p_data_end, int start_tile,
45                                     int end_tile, int initialize_flag);
46 
47 // Implements the color_config() function in the spec. Reports errors by
48 // calling rb->error_handler() or aom_internal_error().
49 void av1_read_color_config(struct aom_read_bit_buffer *rb,
50                            int allow_lowbitdepth, SequenceHeader *seq_params,
51                            struct aom_internal_error_info *error_info);
52 
53 // Implements the timing_info() function in the spec. Reports errors by calling
54 // rb->error_handler() or aom_internal_error().
55 void av1_read_timing_info_header(aom_timing_info_t *timing_info,
56                                  struct aom_internal_error_info *error,
57                                  struct aom_read_bit_buffer *rb);
58 
59 // Implements the decoder_model_info() function in the spec. Reports errors by
60 // calling rb->error_handler().
61 void av1_read_decoder_model_info(aom_dec_model_info_t *decoder_model_info,
62                                  struct aom_read_bit_buffer *rb);
63 
64 // Implements the operating_parameters_info() function in the spec. Reports
65 // errors by calling rb->error_handler().
66 void av1_read_op_parameters_info(aom_dec_model_op_parameters_t *op_params,
67                                  int buffer_delay_length,
68                                  struct aom_read_bit_buffer *rb);
69 
70 struct aom_read_bit_buffer *av1_init_read_bit_buffer(
71     struct AV1Decoder *pbi, struct aom_read_bit_buffer *rb, const uint8_t *data,
72     const uint8_t *data_end);
73 
74 void av1_free_mc_tmp_buf(struct ThreadData *thread_data);
75 
76 void av1_set_single_tile_decoding_mode(AV1_COMMON *const cm);
77 
78 #ifdef __cplusplus
79 }  // extern "C"
80 #endif
81 
82 #endif  // AOM_AV1_DECODER_DECODEFRAME_H_
83