1*495ae853SAndroid Build Coastguard Worker /****************************************************************************** 2*495ae853SAndroid Build Coastguard Worker * 3*495ae853SAndroid Build Coastguard Worker * Copyright (C) 2021 The Android Open Source Project 4*495ae853SAndroid Build Coastguard Worker * 5*495ae853SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 6*495ae853SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 7*495ae853SAndroid Build Coastguard Worker * You may obtain a copy of the License at: 8*495ae853SAndroid Build Coastguard Worker * 9*495ae853SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 10*495ae853SAndroid Build Coastguard Worker * 11*495ae853SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 12*495ae853SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 13*495ae853SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*495ae853SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 15*495ae853SAndroid Build Coastguard Worker * limitations under the License. 16*495ae853SAndroid Build Coastguard Worker * 17*495ae853SAndroid Build Coastguard Worker ***************************************************************************** 18*495ae853SAndroid Build Coastguard Worker * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19*495ae853SAndroid Build Coastguard Worker */ 20*495ae853SAndroid Build Coastguard Worker 21*495ae853SAndroid Build Coastguard Worker /*****************************************************************************/ 22*495ae853SAndroid Build Coastguard Worker /* */ 23*495ae853SAndroid Build Coastguard Worker /* File Name : imvcd_nalu_parser.h */ 24*495ae853SAndroid Build Coastguard Worker /* */ 25*495ae853SAndroid Build Coastguard Worker /* Description : Functions for MVC NALU parsing */ 26*495ae853SAndroid Build Coastguard Worker /* */ 27*495ae853SAndroid Build Coastguard Worker /*****************************************************************************/ 28*495ae853SAndroid Build Coastguard Worker 29*495ae853SAndroid Build Coastguard Worker #ifndef _IMVCD_DPB_MANAGER_H_ 30*495ae853SAndroid Build Coastguard Worker #define _IMVCD_DPB_MANAGER_H_ 31*495ae853SAndroid Build Coastguard Worker #include <stdbool.h> 32*495ae853SAndroid Build Coastguard Worker #include <string.h> 33*495ae853SAndroid Build Coastguard Worker 34*495ae853SAndroid Build Coastguard Worker #include "ih264_typedefs.h" 35*495ae853SAndroid Build Coastguard Worker #include "ih264_error.h" 36*495ae853SAndroid Build Coastguard Worker #include "ih264_buf_mgr.h" 37*495ae853SAndroid Build Coastguard Worker #include "ih264_disp_mgr.h" 38*495ae853SAndroid Build Coastguard Worker #include "ih264d_dpb_manager.h" 39*495ae853SAndroid Build Coastguard Worker #include "imvcd_defs.h" 40*495ae853SAndroid Build Coastguard Worker #include "imvcd_structs.h" 41*495ae853SAndroid Build Coastguard Worker #include "imvcd_utils.h" 42*495ae853SAndroid Build Coastguard Worker 43*495ae853SAndroid Build Coastguard Worker #define NUM_MMCO_CMD_IDS ((RESET_ALL_PICTURES) + 1) 44*495ae853SAndroid Build Coastguard Worker 45*495ae853SAndroid Build Coastguard Worker typedef struct mvc_dpb_info_t 46*495ae853SAndroid Build Coastguard Worker { 47*495ae853SAndroid Build Coastguard Worker mvc_au_buffer_t *ps_au_buf; 48*495ae853SAndroid Build Coastguard Worker 49*495ae853SAndroid Build Coastguard Worker struct mvc_dpb_info_t *ps_prev_short; 50*495ae853SAndroid Build Coastguard Worker 51*495ae853SAndroid Build Coastguard Worker struct mvc_dpb_info_t *ps_prev_long; 52*495ae853SAndroid Build Coastguard Worker 53*495ae853SAndroid Build Coastguard Worker struct field_t s_top_field; 54*495ae853SAndroid Build Coastguard Worker 55*495ae853SAndroid Build Coastguard Worker struct field_t s_bot_field; 56*495ae853SAndroid Build Coastguard Worker 57*495ae853SAndroid Build Coastguard Worker bool b_used_as_ref; 58*495ae853SAndroid Build Coastguard Worker 59*495ae853SAndroid Build Coastguard Worker } mvc_dpb_info_t; 60*495ae853SAndroid Build Coastguard Worker 61*495ae853SAndroid Build Coastguard Worker typedef struct display_buf_info_t 62*495ae853SAndroid Build Coastguard Worker { 63*495ae853SAndroid Build Coastguard Worker WORD32 i4_poc; 64*495ae853SAndroid Build Coastguard Worker 65*495ae853SAndroid Build Coastguard Worker WORD32 i4_poc_buf_id; 66*495ae853SAndroid Build Coastguard Worker 67*495ae853SAndroid Build Coastguard Worker WORD32 i4_frame_num; 68*495ae853SAndroid Build Coastguard Worker } display_buf_info_t; 69*495ae853SAndroid Build Coastguard Worker 70*495ae853SAndroid Build Coastguard Worker typedef struct dpb_ivp_ctxt_t 71*495ae853SAndroid Build Coastguard Worker { 72*495ae853SAndroid Build Coastguard Worker sps_mvc_ext_t *ps_sps_mvc_ext; 73*495ae853SAndroid Build Coastguard Worker 74*495ae853SAndroid Build Coastguard Worker nalu_mvc_ext_t *ps_nalu_mvc_exts; 75*495ae853SAndroid Build Coastguard Worker 76*495ae853SAndroid Build Coastguard Worker UWORD8 au1_au_buf_ids[MVC_MAX_REF_PICS]; 77*495ae853SAndroid Build Coastguard Worker 78*495ae853SAndroid Build Coastguard Worker UWORD8 au1_mv_buf_ids[MVC_MAX_REF_PICS]; 79*495ae853SAndroid Build Coastguard Worker 80*495ae853SAndroid Build Coastguard Worker UWORD32 u4_num_ivp_refs; 81*495ae853SAndroid Build Coastguard Worker } dpb_ivp_ctxt_t; 82*495ae853SAndroid Build Coastguard Worker 83*495ae853SAndroid Build Coastguard Worker typedef struct mvc_dpb_manager_t 84*495ae853SAndroid Build Coastguard Worker { 85*495ae853SAndroid Build Coastguard Worker /** DPB in default index order */ 86*495ae853SAndroid Build Coastguard Worker mvc_au_buffer_t *aps_def_dpb[MVC_MAX_REF_PICS]; 87*495ae853SAndroid Build Coastguard Worker 88*495ae853SAndroid Build Coastguard Worker /** DPB in reordered index order, 0-fwd,1-bwd */ 89*495ae853SAndroid Build Coastguard Worker mvc_au_buffer_t *aps_mod_dpb[2][MVC_MAX_REF_PICS]; 90*495ae853SAndroid Build Coastguard Worker 91*495ae853SAndroid Build Coastguard Worker /** DPB in reordered index order, 0-fwd,1-bwd */ 92*495ae853SAndroid Build Coastguard Worker mvc_au_buffer_t as_init_dpb[2][MVC_MAX_REF_PICS]; 93*495ae853SAndroid Build Coastguard Worker 94*495ae853SAndroid Build Coastguard Worker /** Replicates view level data in 'aps_mod_dpb' */ 95*495ae853SAndroid Build Coastguard Worker pic_buffer_t *aps_view_mod_dpb[2][MVC_MAX_REF_PICS]; 96*495ae853SAndroid Build Coastguard Worker 97*495ae853SAndroid Build Coastguard Worker /** Replicates view level data in 'aps_init_dpb' */ 98*495ae853SAndroid Build Coastguard Worker pic_buffer_t as_view_init_dpb[2][MVC_MAX_REF_PICS]; 99*495ae853SAndroid Build Coastguard Worker 100*495ae853SAndroid Build Coastguard Worker mvc_dpb_info_t as_dpb_info[MVC_MAX_REF_PICS]; 101*495ae853SAndroid Build Coastguard Worker 102*495ae853SAndroid Build Coastguard Worker display_buf_info_t as_display_buf_info[MAX_FRAMES]; 103*495ae853SAndroid Build Coastguard Worker 104*495ae853SAndroid Build Coastguard Worker dpb_ivp_ctxt_t s_dpb_ivp_ctxt; 105*495ae853SAndroid Build Coastguard Worker 106*495ae853SAndroid Build Coastguard Worker mvc_dpb_info_t *ps_dpb_st_head; 107*495ae853SAndroid Build Coastguard Worker 108*495ae853SAndroid Build Coastguard Worker mvc_dpb_info_t *ps_dpb_lt_head; 109*495ae853SAndroid Build Coastguard Worker 110*495ae853SAndroid Build Coastguard Worker mvc_au_buf_mgr_t *ps_mvc_au_buf_mgr; 111*495ae853SAndroid Build Coastguard Worker 112*495ae853SAndroid Build Coastguard Worker mvc_au_mv_pred_buf_mgr_t *ps_mvc_au_mv_pred_buf_mgr; 113*495ae853SAndroid Build Coastguard Worker 114*495ae853SAndroid Build Coastguard Worker disp_mgr_t *ps_disp_buf_mgr; 115*495ae853SAndroid Build Coastguard Worker 116*495ae853SAndroid Build Coastguard Worker WORD32 ai4_gaps_start_frm_num[MAX_FRAMES]; 117*495ae853SAndroid Build Coastguard Worker 118*495ae853SAndroid Build Coastguard Worker WORD32 ai4_gaps_end_frm_num[MAX_FRAMES]; 119*495ae853SAndroid Build Coastguard Worker 120*495ae853SAndroid Build Coastguard Worker WORD8 ai1_gaps_per_seq[MAX_FRAMES]; 121*495ae853SAndroid Build Coastguard Worker 122*495ae853SAndroid Build Coastguard Worker UWORD8 au1_num_active_st_refs[2]; 123*495ae853SAndroid Build Coastguard Worker 124*495ae853SAndroid Build Coastguard Worker UWORD8 au1_num_active_lt_refs[2]; 125*495ae853SAndroid Build Coastguard Worker 126*495ae853SAndroid Build Coastguard Worker WORD32 i4_max_pic_num; 127*495ae853SAndroid Build Coastguard Worker 128*495ae853SAndroid Build Coastguard Worker WORD32 i4_display_delay; 129*495ae853SAndroid Build Coastguard Worker 130*495ae853SAndroid Build Coastguard Worker WORD32 i4_cur_display_seq; 131*495ae853SAndroid Build Coastguard Worker 132*495ae853SAndroid Build Coastguard Worker UWORD16 u2_num_views; 133*495ae853SAndroid Build Coastguard Worker 134*495ae853SAndroid Build Coastguard Worker UWORD8 u1_num_st_ref_bufs; 135*495ae853SAndroid Build Coastguard Worker 136*495ae853SAndroid Build Coastguard Worker UWORD8 u1_num_lt_ref_bufs; 137*495ae853SAndroid Build Coastguard Worker 138*495ae853SAndroid Build Coastguard Worker UWORD8 u1_max_lt_frame_idx; 139*495ae853SAndroid Build Coastguard Worker 140*495ae853SAndroid Build Coastguard Worker UWORD8 u1_num_gaps; 141*495ae853SAndroid Build Coastguard Worker 142*495ae853SAndroid Build Coastguard Worker WORD8 i1_poc_buf_id_entries; 143*495ae853SAndroid Build Coastguard Worker 144*495ae853SAndroid Build Coastguard Worker WORD8 i1_gaps_deleted; 145*495ae853SAndroid Build Coastguard Worker 146*495ae853SAndroid Build Coastguard Worker UWORD8 u1_mmco_error_in_seq; 147*495ae853SAndroid Build Coastguard Worker 148*495ae853SAndroid Build Coastguard Worker } mvc_dpb_manager_t; 149*495ae853SAndroid Build Coastguard Worker 150*495ae853SAndroid Build Coastguard Worker /* Function declarations */ 151*495ae853SAndroid Build Coastguard Worker extern void imvcd_init_dpb_mgr(mvc_dpb_manager_t *ps_dpb_mgr, mvc_au_buf_mgr_t *ps_mvc_au_buf_mgr, 152*495ae853SAndroid Build Coastguard Worker mvc_au_mv_pred_buf_mgr_t *ps_mvc_au_mv_pred_buf_mgr, 153*495ae853SAndroid Build Coastguard Worker disp_mgr_t *ps_disp_buf_mgr); 154*495ae853SAndroid Build Coastguard Worker 155*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_dpb_assign_display_seq(mvc_dpb_manager_t *ps_dpb_mgr); 156*495ae853SAndroid Build Coastguard Worker 157*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_dpb_insert_pic_in_display_list(mvc_dpb_manager_t *ps_dpb_mgr, 158*495ae853SAndroid Build Coastguard Worker WORD32 i4_display_poc, UWORD32 u4_frame_num, 159*495ae853SAndroid Build Coastguard Worker WORD32 i4_buf_id); 160*495ae853SAndroid Build Coastguard Worker 161*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_dpb_do_mmco_for_gaps(mvc_dpb_manager_t *ps_dpb_mgr, UWORD8 u1_num_ref_frames); 162*495ae853SAndroid Build Coastguard Worker 163*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_delete_nonref_nondisplay_pics(mvc_dpb_manager_t *ps_dpb_mgr); 164*495ae853SAndroid Build Coastguard Worker 165*495ae853SAndroid Build Coastguard Worker extern void imvcd_reset_dpb(mvc_dpb_manager_t *ps_dpb_mgr); 166*495ae853SAndroid Build Coastguard Worker 167*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_release_display_bufs(mvc_dpb_manager_t *ps_dpb_mgr); 168*495ae853SAndroid Build Coastguard Worker 169*495ae853SAndroid Build Coastguard Worker extern void imvcd_assign_pic_num(mvc_dpb_manager_t *ps_dpb_mgr, WORD32 i4_max_frame_num, 170*495ae853SAndroid Build Coastguard Worker WORD32 i4_cur_frame_num, 171*495ae853SAndroid Build Coastguard Worker bool b_are_gaps_in_frame_num_value_allowed); 172*495ae853SAndroid Build Coastguard Worker 173*495ae853SAndroid Build Coastguard Worker extern UWORD8 imvcd_dpb_st_lt_deduplicator(mvc_dpb_manager_t *ps_dpb_mgr); 174*495ae853SAndroid Build Coastguard Worker 175*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_init_ref_pic_list(mvc_dpb_manager_t *ps_dpb_mgr, 176*495ae853SAndroid Build Coastguard Worker nalu_mvc_ext_t *ps_cur_nalu_mvc_ext, 177*495ae853SAndroid Build Coastguard Worker mvc_au_buffer_t *ps_cur_au, UWORD16 u2_view_order_id); 178*495ae853SAndroid Build Coastguard Worker 179*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_dpb_reorder_ref_pic_list(mvc_dpb_manager_t *ps_dpb_mgr, 180*495ae853SAndroid Build Coastguard Worker nalu_mvc_ext_t *ps_cur_nalu_mvc_ext, 181*495ae853SAndroid Build Coastguard Worker mvc_au_buffer_t *ps_cur_au, 182*495ae853SAndroid Build Coastguard Worker ref_pic_list_mod_data_t *ps_ref_pic_list_mod_data, 183*495ae853SAndroid Build Coastguard Worker UWORD16 u2_view_order_id); 184*495ae853SAndroid Build Coastguard Worker 185*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_dpb_insert_st_node(mvc_dpb_manager_t *ps_dpb_mgr, mvc_au_buffer_t *ps_au_buf); 186*495ae853SAndroid Build Coastguard Worker 187*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_dpb_delete_st_node_or_make_lt(mvc_dpb_manager_t *ps_dpb_mgr, 188*495ae853SAndroid Build Coastguard Worker WORD32 i4_frame_num, UWORD32 u4_lt_idx); 189*495ae853SAndroid Build Coastguard Worker 190*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_dpb_do_mmco(dpb_commands_t *ps_dpb_cmds, mvc_dpb_manager_t *ps_dpb_mgr, 191*495ae853SAndroid Build Coastguard Worker mvc_au_buffer_t *ps_cur_au, UWORD8 u1_max_num_ref_frames, 192*495ae853SAndroid Build Coastguard Worker UWORD8 u1_curr_pic_in_err); 193*495ae853SAndroid Build Coastguard Worker 194*495ae853SAndroid Build Coastguard Worker extern WORD32 imvcd_dpb_update_default_index_list(mvc_dpb_manager_t *ps_dpb_mgr); 195*495ae853SAndroid Build Coastguard Worker 196*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_set_display_num(mvc_dpb_manager_t *ps_dpb_mgr, WORD32 i4_display_num); 197*495ae853SAndroid Build Coastguard Worker 198*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_set_max_pic_num(mvc_dpb_manager_t *ps_dpb_mgr, WORD32 i4_max_pic_num); 199*495ae853SAndroid Build Coastguard Worker 200*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_set_num_views(mvc_dpb_manager_t *ps_dpb_mgr, UWORD16 u2_num_views); 201*495ae853SAndroid Build Coastguard Worker 202*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_set_display_delay(mvc_dpb_manager_t *ps_dpb_mgr, WORD32 i4_display_delay); 203*495ae853SAndroid Build Coastguard Worker 204*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_init_au_bufs(mvc_dpb_manager_t *ps_dpb_mgr, mvc_au_buffer_t *ps_cur_au); 205*495ae853SAndroid Build Coastguard Worker 206*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_init_view_bufs(mvc_dpb_manager_t *ps_dpb_mgr, UWORD16 u2_view_order_id, 207*495ae853SAndroid Build Coastguard Worker UWORD16 u2_view_id); 208*495ae853SAndroid Build Coastguard Worker 209*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_init_ivp_ctxt(mvc_dpb_manager_t *ps_dpb_mgr, sps_mvc_ext_t *ps_sps_mvc_ext, 210*495ae853SAndroid Build Coastguard Worker nalu_mvc_ext_t *ps_nalu_mvc_exts); 211*495ae853SAndroid Build Coastguard Worker 212*495ae853SAndroid Build Coastguard Worker extern void imvcd_dpb_reset_ivp_ctxt(mvc_dpb_manager_t *ps_dpb_mgr); 213*495ae853SAndroid Build Coastguard Worker 214*495ae853SAndroid Build Coastguard Worker extern pic_buffer_t **imvcd_dpb_get_view_ref_pic_list(mvc_dpb_manager_t *ps_dpb_mgr, 215*495ae853SAndroid Build Coastguard Worker UWORD16 u2_view_order_id, UWORD16 u2_view_id, 216*495ae853SAndroid Build Coastguard Worker UWORD8 u1_pred_dir); 217*495ae853SAndroid Build Coastguard Worker 218*495ae853SAndroid Build Coastguard Worker extern bool imvcd_dpb_is_diff_poc_valid(mvc_dpb_manager_t *ps_dpb_mgr, WORD32 i4_curr_poc); 219*495ae853SAndroid Build Coastguard Worker 220*495ae853SAndroid Build Coastguard Worker #endif 221