xref: /aosp_15_r20/external/libaom/av1/decoder/decodeframe.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker  * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3*77c1e3ccSAndroid Build Coastguard Worker  *
4*77c1e3ccSAndroid Build Coastguard Worker  * This source code is subject to the terms of the BSD 2 Clause License and
5*77c1e3ccSAndroid Build Coastguard Worker  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6*77c1e3ccSAndroid Build Coastguard Worker  * was not distributed with this source code in the LICENSE file, you can
7*77c1e3ccSAndroid Build Coastguard Worker  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8*77c1e3ccSAndroid Build Coastguard Worker  * Media Patent License 1.0 was not distributed with this source code in the
9*77c1e3ccSAndroid Build Coastguard Worker  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10*77c1e3ccSAndroid Build Coastguard Worker  */
11*77c1e3ccSAndroid Build Coastguard Worker 
12*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_AV1_DECODER_DECODEFRAME_H_
13*77c1e3ccSAndroid Build Coastguard Worker #define AOM_AV1_DECODER_DECODEFRAME_H_
14*77c1e3ccSAndroid Build Coastguard Worker 
15*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus
16*77c1e3ccSAndroid Build Coastguard Worker extern "C" {
17*77c1e3ccSAndroid Build Coastguard Worker #endif
18*77c1e3ccSAndroid Build Coastguard Worker 
19*77c1e3ccSAndroid Build Coastguard Worker struct AV1Decoder;
20*77c1e3ccSAndroid Build Coastguard Worker struct aom_read_bit_buffer;
21*77c1e3ccSAndroid Build Coastguard Worker struct ThreadData;
22*77c1e3ccSAndroid Build Coastguard Worker 
23*77c1e3ccSAndroid Build Coastguard Worker // Reads the middle part of the sequence header OBU (from
24*77c1e3ccSAndroid Build Coastguard Worker // frame_width_bits_minus_1 to enable_restoration) into seq_params.
25*77c1e3ccSAndroid Build Coastguard Worker // Reports errors by calling rb->error_handler() or aom_internal_error().
26*77c1e3ccSAndroid Build Coastguard Worker void av1_read_sequence_header(AV1_COMMON *cm, struct aom_read_bit_buffer *rb,
27*77c1e3ccSAndroid Build Coastguard Worker                               SequenceHeader *seq_params);
28*77c1e3ccSAndroid Build Coastguard Worker 
29*77c1e3ccSAndroid Build Coastguard Worker BITSTREAM_PROFILE av1_read_profile(struct aom_read_bit_buffer *rb);
30*77c1e3ccSAndroid Build Coastguard Worker 
31*77c1e3ccSAndroid Build Coastguard Worker // Returns 0 on success. Sets pbi->common.error.error_code and returns -1 on
32*77c1e3ccSAndroid Build Coastguard Worker // failure.
33*77c1e3ccSAndroid Build Coastguard Worker int av1_check_trailing_bits(struct AV1Decoder *pbi,
34*77c1e3ccSAndroid Build Coastguard Worker                             struct aom_read_bit_buffer *rb);
35*77c1e3ccSAndroid Build Coastguard Worker 
36*77c1e3ccSAndroid Build Coastguard Worker // On success, returns the frame header size. On failure, calls
37*77c1e3ccSAndroid Build Coastguard Worker // aom_internal_error and does not return.
38*77c1e3ccSAndroid Build Coastguard Worker uint32_t av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
39*77c1e3ccSAndroid Build Coastguard Worker                                             struct aom_read_bit_buffer *rb,
40*77c1e3ccSAndroid Build Coastguard Worker                                             int trailing_bits_present);
41*77c1e3ccSAndroid Build Coastguard Worker 
42*77c1e3ccSAndroid Build Coastguard Worker void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
43*77c1e3ccSAndroid Build Coastguard Worker                                     const uint8_t *data_end,
44*77c1e3ccSAndroid Build Coastguard Worker                                     const uint8_t **p_data_end, int start_tile,
45*77c1e3ccSAndroid Build Coastguard Worker                                     int end_tile, int initialize_flag);
46*77c1e3ccSAndroid Build Coastguard Worker 
47*77c1e3ccSAndroid Build Coastguard Worker // Implements the color_config() function in the spec. Reports errors by
48*77c1e3ccSAndroid Build Coastguard Worker // calling rb->error_handler() or aom_internal_error().
49*77c1e3ccSAndroid Build Coastguard Worker void av1_read_color_config(struct aom_read_bit_buffer *rb,
50*77c1e3ccSAndroid Build Coastguard Worker                            int allow_lowbitdepth, SequenceHeader *seq_params,
51*77c1e3ccSAndroid Build Coastguard Worker                            struct aom_internal_error_info *error_info);
52*77c1e3ccSAndroid Build Coastguard Worker 
53*77c1e3ccSAndroid Build Coastguard Worker // Implements the timing_info() function in the spec. Reports errors by calling
54*77c1e3ccSAndroid Build Coastguard Worker // rb->error_handler() or aom_internal_error().
55*77c1e3ccSAndroid Build Coastguard Worker void av1_read_timing_info_header(aom_timing_info_t *timing_info,
56*77c1e3ccSAndroid Build Coastguard Worker                                  struct aom_internal_error_info *error,
57*77c1e3ccSAndroid Build Coastguard Worker                                  struct aom_read_bit_buffer *rb);
58*77c1e3ccSAndroid Build Coastguard Worker 
59*77c1e3ccSAndroid Build Coastguard Worker // Implements the decoder_model_info() function in the spec. Reports errors by
60*77c1e3ccSAndroid Build Coastguard Worker // calling rb->error_handler().
61*77c1e3ccSAndroid Build Coastguard Worker void av1_read_decoder_model_info(aom_dec_model_info_t *decoder_model_info,
62*77c1e3ccSAndroid Build Coastguard Worker                                  struct aom_read_bit_buffer *rb);
63*77c1e3ccSAndroid Build Coastguard Worker 
64*77c1e3ccSAndroid Build Coastguard Worker // Implements the operating_parameters_info() function in the spec. Reports
65*77c1e3ccSAndroid Build Coastguard Worker // errors by calling rb->error_handler().
66*77c1e3ccSAndroid Build Coastguard Worker void av1_read_op_parameters_info(aom_dec_model_op_parameters_t *op_params,
67*77c1e3ccSAndroid Build Coastguard Worker                                  int buffer_delay_length,
68*77c1e3ccSAndroid Build Coastguard Worker                                  struct aom_read_bit_buffer *rb);
69*77c1e3ccSAndroid Build Coastguard Worker 
70*77c1e3ccSAndroid Build Coastguard Worker struct aom_read_bit_buffer *av1_init_read_bit_buffer(
71*77c1e3ccSAndroid Build Coastguard Worker     struct AV1Decoder *pbi, struct aom_read_bit_buffer *rb, const uint8_t *data,
72*77c1e3ccSAndroid Build Coastguard Worker     const uint8_t *data_end);
73*77c1e3ccSAndroid Build Coastguard Worker 
74*77c1e3ccSAndroid Build Coastguard Worker void av1_free_mc_tmp_buf(struct ThreadData *thread_data);
75*77c1e3ccSAndroid Build Coastguard Worker 
76*77c1e3ccSAndroid Build Coastguard Worker void av1_set_single_tile_decoding_mode(AV1_COMMON *const cm);
77*77c1e3ccSAndroid Build Coastguard Worker 
78*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus
79*77c1e3ccSAndroid Build Coastguard Worker }  // extern "C"
80*77c1e3ccSAndroid Build Coastguard Worker #endif
81*77c1e3ccSAndroid Build Coastguard Worker 
82*77c1e3ccSAndroid Build Coastguard Worker #endif  // AOM_AV1_DECODER_DECODEFRAME_H_
83