xref: /aosp_15_r20/external/libavc/decoder/mvc/imvcd_structs.h (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
1 /******************************************************************************
2  *
3  * Copyright (C) 2021 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19  */
20 #ifndef _IMVCD_STRUCTS_H_
21 #define _IMVCD_STRUCTS_H_
22 
23 #include <stdbool.h>
24 
25 #include "ih264_typedefs.h"
26 #include "imvcd.h"
27 #include "ih264_error.h"
28 #include "ih264_buf_mgr.h"
29 #include "ih264_disp_mgr.h"
30 #include "ih264d_sei.h"
31 #include "ih264d_structs.h"
32 #include "imvc_defs.h"
33 #include "imvc_structs.h"
34 #include "imvcd_defs.h"
35 
36 /* structs */
37 typedef struct mvc_au_mv_pred_t
38 {
39     mv_pred_t *aps_mvs[MAX_NUM_VIEWS];
40 
41     /* colZeroFlag | // 0th bit
42        field_flag  | // 1st bit
43        XX          | // 2:3 bit don't cares
44        subMbMode   | // 4:5 bit
45        MbMode      | // 6:7 bit */
46     UWORD8 *apu1_mode_descriptors[MAX_NUM_VIEWS];
47 
48 } mvc_au_mv_pred_t;
49 
50 typedef struct ivp_data_t
51 {
52     bool b_is_ivp_ref;
53 
54     /* Due to the structuring of dpb_mgr_t, */
55     /* mvc_pic_buffer_t used for referencing ought to contain */
56     /* all data in indices corresponding to view_id doing the referencing. */
57     /* This struct, and this variable in particular, is used for identifying */
58     /* the reference view's view_id */
59 
60     UWORD16 u2_ref_view_id;
61 } ivp_data_t;
62 
63 typedef struct mvc_au_buffer_t
64 {
65     /** pic_buffer for all views */
66     yuv_buf_props_t as_view_buffers[MAX_NUM_VIEWS];
67 
68     /** display offsets for all views */
69     offsets_t as_disp_offsets[MAX_NUM_VIEWS];
70 
71     ivp_data_t s_ivp_data;
72 
73     /** SEI data */
74     sei s_sei_pic;
75 
76     /** AU MV Data */
77     mvc_au_mv_pred_t *ps_au_mv_data;
78 
79     /* It will contain information about types of slices */
80     UWORD32 au4_pack_slc_typ[MAX_NUM_VIEWS];
81 
82     /** Width of the display luma frame in pixels */
83     UWORD16 u2_disp_width;
84 
85     /** Height of the display luma frame in pixels */
86     UWORD16 u2_disp_height;
87 
88     /** Time at which frame has to be displayed */
89     UWORD32 u4_time_stamp;
90 
91     /** (1: short 0: long) term ref pic */
92     bool b_is_short_term_ref;
93 
94     /** frame / field / complementary field pair */
95     UWORD8 u1_pic_type;
96 
97     /** Idx into the picBufAPI array */
98     WORD32 i4_pic_buf_id;
99 
100     WORD32 i4_mv_buf_id;
101 
102     WORD32 i4_poc;
103 
104     WORD32 i4_frame_num;
105 
106     /* Derived based on '8.2.4.1' */
107     WORD32 i4_pic_num;
108 
109     /** minPOC */
110     WORD32 i4_avg_poc;
111 
112     /*Same as u1_pic_type..u1_pic_type gets overwritten whereas this doesnot get
113     overwritten
114     ...stores the pictype of frame/complementary field pair/ mbaff */
115     UWORD8 u1_picturetype;
116 
117     UWORD8 u1_long_term_frm_idx;
118 
119     UWORD8 u1_long_term_pic_num;
120 
121     /* Refer to SEI table D-1 */
122     UWORD8 u1_pic_struct;
123 
124 } mvc_au_buffer_t;
125 
126 typedef struct mvc_au_buf_mgr_t
127 {
128     void *pv_mem;
129 
130     buf_mgr_t *ps_buf_mgr_ctxt;
131 
132     void *pv_au_buf_base;
133 
134     mvc_au_buffer_t *aps_buf_id_to_au_buf_map[MAX_DISP_BUFS_NEW];
135 
136     UWORD8 au1_au_buf_id_to_mv_buf_id_map[MAX_DISP_BUFS_NEW];
137 
138     UWORD8 au1_au_buf_ref_flag[MAX_DISP_BUFS_NEW];
139 
140 } mvc_au_buf_mgr_t;
141 
142 typedef struct mvc_au_mv_pred_buf_mgr_t
143 {
144     void *pv_mem;
145 
146     buf_mgr_t *ps_buf_mgr_ctxt;
147 
148     void *pv_au_mv_pred_buf_base;
149 
150     mvc_au_mv_pred_t *aps_buf_id_to_mv_pred_buf_map[MAX_DISP_BUFS_NEW];
151 
152 } mvc_au_mv_pred_buf_mgr_t;
153 
154 typedef struct subset_sps_t
155 {
156     dec_seq_params_t s_sps_data;
157 
158     sps_mvc_ext_t s_sps_mvc_ext;
159 
160     mvc_vui_ext_t s_mvc_vui_ext;
161 
162     offsets_t s_disp_offsets;
163 
164     UWORD8 u1_mvc_vui_parameters_present_flag;
165 
166 } subset_sps_t;
167 
168 typedef struct ref_pic_list_mod_data_t
169 {
170     UWORD8 au1_num_active_refs[2];
171 
172     UWORD8 au1_ref_pic_list_modification_flag_lx[2];
173 
174     UWORD8 au1_modification_of_pic_nums_idc[2][MVC_MAX_REF_PICS + 1];
175 
176     WORD32 ai4_abs_diff_pic_num_minus1[2][MVC_MAX_REF_PICS + 1];
177 
178     WORD32 ai4_long_term_pic_num[2][MVC_MAX_REF_PICS + 1];
179 
180     WORD32 ai4_abs_diff_view_idx_minus1[2][MVC_MAX_REF_PICS + 1];
181 } ref_pic_list_mod_data_t;
182 
183 typedef struct mvc_dec_ctxt_t
184 {
185     dec_struct_t s_view_dec_ctxt;
186 
187     iv_mvc_yuv_buf_t s_out_buffer;
188 
189     /* Resolves circular dependency with mvc_dpb_manager_t */
190     void *ps_dpb_mgr;
191 
192     subset_sps_t as_subset_sps[MAX_NUM_SEQ_PARAMS];
193 
194     /* Indexed via viewOrderID */
195     nalu_mvc_ext_t as_nalu_mvc_ext[MAX_NUM_VIEWS];
196 
197     /* Indexed via viewOrderID */
198     dec_slice_params_t as_slices[MAX_NUM_VIEWS];
199 
200     ref_pic_list_mod_data_t as_ref_pic_list_mod_data[MAX_NUM_VIEWS];
201 
202     subset_sps_t *aps_pps_id_to_subset_sps_map[MAX_NUM_PIC_PARAMS];
203 
204     disp_mgr_t s_mvc_disp_buf_mgr;
205 
206     mvc_au_buf_mgr_t s_mvc_au_buf_mgr;
207 
208     mvc_au_mv_pred_buf_mgr_t s_mvc_au_mv_pred_buf_mgr;
209 
210     mvc_au_buffer_t *ps_cur_au;
211 
212     AVC_EXT_NALU_ID_T ae_nalu_id[MAX_NUM_VIEWS];
213 
214     UWORD8 au1_nal_ref_idc[MAX_NUM_VIEWS];
215 
216     UWORD32 u4_num_aus_decoded;
217 
218     UWORD16 u2_num_views;
219 
220     UWORD16 u2_num_views_decoded;
221 
222     UWORD8 u1_num_sps;
223 
224     UWORD8 u1_num_subset_sps;
225 
226     UWORD8 u1_num_pps;
227 
228     bool b_header_only_decode;
229 
230     bool b_flush_enabled;
231 
232 } mvc_dec_ctxt_t;
233 
234 #endif
235