1 /****************************************************************************** 2 * 3 * Copyright (C) 2018 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 21 /** 22 ****************************************************************************** 23 * @file 24 * ihevce_lap_structs.h 25 * 26 * @brief 27 * This file contains structure definitions related to look-ahead processing 28 * 29 * @author 30 * ittiam 31 * 32 ****************************************************************************** 33 */ 34 35 #ifndef _IHEVCE_LAP_STRUCTS_H_ 36 #define _IHEVCE_LAP_STRUCTS_H_ 37 38 /*****************************************************************************/ 39 /* Constant Macros */ 40 /*****************************************************************************/ 41 #define EVAL_VERSION 0 42 #define EVAL_MODE_FORCE_LOGO 0 43 #define MAX_FRAMES_EVAL_VERSION 50000 44 #define LAP_DEBUG_PRINT 0 45 #define FORCE_IDR_TEST 1 46 #define MAX_NUM_ENC_NODES 8 47 #define MAX_QUEUE_LENGTH (MAX_LAP_WINDOW_SIZE + MAX_SUB_GOP_SIZE + 2) 48 49 /*****************************************************************************/ 50 /* Enums */ 51 /*****************************************************************************/ 52 typedef enum 53 { 54 LAP_CTXT = 0, 55 LAP_NODE_MEM, 56 NUM_LAP_MEM_RECS, 57 } LAP_MEM_T; 58 59 /*****************************************************************************/ 60 /* Structures */ 61 /*****************************************************************************/ 62 63 /* Picture types */ 64 typedef enum PIC_TYPE_E 65 { 66 PIC_TYPE_NA = -1, /* Invalid frame type*/ 67 PIC_TYPE_I, /* I frame */ 68 PIC_TYPE_P, /* P frame */ 69 PIC_TYPE_B, /* B frame */ 70 PIC_TYPE_IDR, /* IDR frame */ 71 PIC_TYPE_CRA, /* CRA frame */ 72 MAX_NUM_PIC_TYPES 73 } PIC_TYPE_E; 74 75 typedef struct ihevce_encode_node_t 76 { 77 WORD32 data; 78 void *pv_left_node; 79 void *pv_right_node; 80 WORD32 i4_hierachical_layer; 81 WORD32 i4_interlace_field; 82 ihevce_lap_enc_buf_t *ps_lap_top_buff; 83 ihevce_lap_enc_buf_t *ps_lap_bottom_buff; 84 85 } ihevce_encode_node_t; 86 87 /** 88 ****************************************************************************** 89 * @brief lap context 90 ****************************************************************************** 91 */ 92 typedef struct 93 { 94 // cfg params 95 ihevce_static_cfg_params_t s_static_cfg_params; 96 ihevce_lap_static_params_t s_lap_static_params; 97 98 //pic reorder info 99 ihevce_lap_enc_buf_t *aps_lap_inp_buf[MAX_QUEUE_LENGTH]; 100 101 ihevce_encode_node_t *aps_encode_node[1]; 102 103 /** Array of nodes in encode order*/ 104 ihevce_lap_enc_buf_t *api4_encode_order_array[MAX_NUM_ENC_NODES]; 105 106 /** Array of nodes in capture order*/ 107 ihevce_lap_enc_buf_t *api4_capture_order_array[MAX_NUM_ENC_NODES]; 108 109 /**Array of POCS in encode order*/ 110 WORD32 ai4_encode_order_poc[MAX_NUM_ENC_NODES]; 111 112 /**Array of POCS in capture order*/ 113 WORD32 ai4_capture_order_poc[MAX_NUM_ENC_NODES]; 114 115 /** Pointer to POC in encode order*/ 116 WORD32 *pi4_encode_poc_ptr; 117 118 /** Pointer to POC in capture order*/ 119 WORD32 *pi4_capture_poc_ptr; 120 121 WORD32 ai4_pic_type_to_be_removed[NUM_LAP2_LOOK_AHEAD]; 122 123 void *pv_prev_inp_buf; 124 125 WORD32 i4_buf_enq_idx; 126 WORD32 i4_buf_deq_idx; 127 WORD32 i4_lap_out_idx; 128 WORD32 i4_capture_idx; 129 WORD32 i4_idr_flag; 130 WORD32 i4_num_bufs_encode_order; 131 WORD32 i4_deq_idx; 132 WORD32 i4_enq_idx; 133 // poc info 134 WORD32 ref_poc_array[MAX_REF_PICS]; 135 WORD8 ai1_pic_type[10]; 136 WORD32 i4_curr_poc; 137 WORD32 i4_cra_poc; 138 WORD32 i4_assoc_IRAP_poc; 139 // counters 140 WORD32 i4_max_idr_period; 141 WORD32 i4_min_idr_period; 142 WORD32 i4_max_cra_period; 143 WORD32 i4_max_i_period; 144 WORD32 i4_idr_counter; 145 WORD32 i4_cra_counter; 146 WORD32 i4_i_counter; 147 WORD32 i4_idr_gop_num; 148 WORD32 i4_curr_ref_pics; 149 WORD32 i4_display_num; 150 WORD32 i4_num_frames_after_force_idr; 151 WORD32 i4_num_frm_type_decided; 152 WORD32 i4_frm_gop_idx; 153 WORD32 i4_is_all_i_pic_in_seq; 154 WORD32 i4_next_start_ctr; 155 WORD32 i4_fixed_open_gop_period; 156 WORD32 i4_fixed_i_period; 157 // misc 158 WORD32 i4_enable_logo; 159 WORD32 i4_cra_i_pic_flag; 160 WORD32 i4_force_end_flag; 161 WORD32 i4_sub_gop_size; 162 WORD32 i4_sub_gop_size_idr; 163 WORD32 i4_dyn_sub_gop_size; 164 WORD32 end_flag; 165 WORD32 i4_immediate_idr_case; 166 WORD32 i4_max_buf_in_enc_order; 167 WORD32 i4_end_flag_pic_idx; 168 WORD32 i4_lap2_counter; 169 WORD32 i4_rc_lap_period; 170 WORD32 i4_gop_period; 171 WORD32 i4_no_back_to_back_i_avoidance; 172 } lap_struct_t; 173 174 void ihevce_populate_tree_nodes( 175 ihevce_encode_node_t *encode_parent_node_t, 176 ihevce_encode_node_t *encode_node_t, 177 WORD32 *loop_count, 178 WORD32 layer, 179 WORD32 hier_layer); 180 181 #endif /* _IHEVCE_LAP_STRUCTS_H_ */ 182