1 /****************************************************************************** 2 * 3 * Copyright (C) 2022 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 * isvc_structs.h 25 * 26 * @brief 27 * Contains struct definition used for SVC 28 * 29 * @author 30 * ittiam 31 * 32 * @remarks 33 * None 34 * 35 ******************************************************************************* 36 */ 37 38 #ifndef _ISVC_STRUCTS_H_ 39 #define _ISVC_STRUCTS_H_ 40 41 #include "ih264_typedefs.h" 42 #include "iv2.h" 43 #include "ih264_defs.h" 44 #include "ih264_structs.h" 45 #include "isvc_defs.h" 46 47 typedef struct buffer_container_t 48 { 49 void *pv_data; 50 51 WORD32 i4_data_stride; 52 53 } buffer_container_t; 54 55 typedef struct yuv_buf_props_t 56 { 57 buffer_container_t as_component_bufs[NUM_COMPONENTS]; 58 59 IV_COLOR_FORMAT_T e_color_format; 60 61 UWORD32 u4_width; 62 63 UWORD32 u4_height; 64 65 UWORD8 u1_bit_depth; 66 } yuv_buf_props_t; 67 68 typedef struct nal_unit_header_t 69 { 70 UWORD8 u1_nal_ref_idc; 71 72 UWORD8 u1_nal_unit_type; 73 } nal_unit_header_t; 74 75 typedef struct coordinates_t 76 { 77 WORD32 i4_abscissa; 78 79 WORD32 i4_ordinate; 80 } coordinates_t; 81 82 typedef struct svc_au_buf_t 83 { 84 /* Array of structs that contain properties of the buffers used for storing */ 85 yuv_buf_props_t *ps_layer_yuv_buf_props; 86 87 /* Temporal ID */ 88 WORD8 i1_temporal_id; 89 90 /* Num Spatial Layers */ 91 UWORD8 u1_num_spatial_layers; 92 93 /* Resolution ration b/w spatial layers */ 94 DOUBLE d_spatial_res_ratio; 95 96 /* absolute value of POC */ 97 WORD32 i4_abs_poc; 98 99 /* POC % MaxPicOrderCntLSB */ 100 WORD32 i4_poc_lsb; 101 102 /* Lower 32 bits of time stamp */ 103 UWORD32 u4_timestamp_low; 104 105 /* Higher 32 bits of time stamp */ 106 UWORD32 u4_timestamp_high; 107 108 /* Is Pic used as refPic for future frames? */ 109 WORD32 i4_used_as_ref; 110 111 /* frame_num in the slice header */ 112 WORD32 i4_frame_num; 113 114 /* 115 * 0: Top Field 116 * 1: Bottom Field 117 */ 118 WORD8 i1_field_type; 119 120 /* buffer ID from frame buffer manager */ 121 WORD32 i4_buf_id; 122 123 } svc_au_buf_t; 124 125 typedef struct svc_nalu_ext_t 126 { 127 nal_unit_header_t s_nalu_header; 128 129 /* idr_flag */ 130 UWORD8 u1_idr_flag; 131 132 /* priority_id (Range = [0, 63]) */ 133 UWORD8 u1_priority_id; 134 135 /* no_inter_layer_pred_flag */ 136 UWORD8 u1_no_inter_layer_pred_flag; 137 138 /* dependency_id (Range = [0, 7]) */ 139 UWORD8 u1_dependency_id; 140 141 /* quality_id (Range = [0, 15]) */ 142 UWORD8 u1_quality_id; 143 144 /* temporal_id (Range = [0, 7]) */ 145 UWORD8 u1_temporal_id; 146 147 /* use_ref_base_pic_flag */ 148 UWORD8 u1_use_ref_base_pic_flag; 149 150 /* discardable_flag */ 151 UWORD8 u1_discardable_flag; 152 153 /* output_flag */ 154 UWORD8 u1_output_flag; 155 156 /* reserved_three_2bits */ 157 UWORD8 u1_reserved_three_2bits; 158 159 } svc_nalu_ext_t; 160 161 typedef struct svc_vui_ext_t 162 { 163 /* specifies the maximum layers in the SVC bitstream */ 164 UWORD32 u4_vui_ext_num_entries_minus1; 165 166 /* specifies the dependency ID for each layer */ 167 UWORD8 u1_vui_ext_dependency_id[MAX_VUI_EXT_NUM_ENTRIES]; 168 169 /* specifies the quality ID for each layer */ 170 UWORD8 u1_vui_ext_quality_id[MAX_VUI_EXT_NUM_ENTRIES]; 171 172 /* specifies the temporal ID for each layer */ 173 UWORD8 u1_vui_ext_temporal_id[MAX_VUI_EXT_NUM_ENTRIES]; 174 175 /* specifies the timing_info_present_flag value of the i-th sub-bitstream */ 176 UWORD8 u1_vui_ext_timing_info_present_flag[MAX_VUI_EXT_NUM_ENTRIES]; 177 178 /* specifies the num_units_in_tick value of the i-th sub-bitstream */ 179 UWORD32 u4_vui_ext_num_units_in_tick[MAX_VUI_EXT_NUM_ENTRIES]; 180 181 /* specifies the time_scale value of the i-th sub-bitstream */ 182 UWORD32 u4_vui_ext_time_scale[MAX_VUI_EXT_NUM_ENTRIES]; 183 184 /* specifies the fixed_frame_rate_flag value of the i-th sub-bitstream */ 185 UWORD8 u1_vui_ext_fixed_frame_rate_flag[MAX_VUI_EXT_NUM_ENTRIES]; 186 187 /* specifies the nal_hrd_parameters_present_flag value of the i-th */ 188 UWORD8 u1_vui_ext_nal_hrd_params_present_flag[MAX_VUI_EXT_NUM_ENTRIES]; 189 190 /* specifies the vcl_hrd_parameters_present_flag value of the i-th */ 191 UWORD8 u1_vui_ext_vcl_hrd_params_present_flag[MAX_VUI_EXT_NUM_ENTRIES]; 192 193 /* specifies the low_delay_hrd_flag value of the i-th sub-bitstream */ 194 UWORD8 u1_vui_ext_low_delay_hrd_flag[MAX_VUI_EXT_NUM_ENTRIES]; 195 196 /* specifies the pic_struct_present_flag value of the i-th sub-bitstream */ 197 UWORD8 u1_vui_ext_pic_struct_present_flag[MAX_VUI_EXT_NUM_ENTRIES]; 198 199 } svc_vui_ext_t; 200 201 typedef struct sps_svc_ext_t 202 { 203 /* inter_layer_deblocking_filter_control_present_flag */ 204 UWORD8 u1_inter_layer_deblocking_filter_control_present_flag; 205 206 /* extended_spatial_scalability_idc */ 207 UWORD8 u1_extended_spatial_scalability_idc; 208 209 /* chroma_phase_x_plus1_flag */ 210 UWORD8 u1_chroma_phase_x_plus1; 211 212 /* chroma_phase_y_plus1 */ 213 UWORD8 u1_chroma_phase_y_plus1; 214 215 /* seq_ref_layer_chroma_phase_x_plus1_flag */ 216 UWORD8 u1_seq_ref_layer_chroma_phase_x_plus1_flag; 217 218 /* seq_ref_layer_chroma_phase_y_plus1 */ 219 UWORD8 u1_seq_ref_layer_chroma_phase_y_plus1; 220 221 /* seq_scaled_ref_layer_left_offset */ 222 WORD32 i4_seq_scaled_ref_layer_left_offset; 223 224 /* seq_scaled_ref_layer_top_offset */ 225 WORD32 i4_seq_scaled_ref_layer_top_offset; 226 227 /* seq_scaled_ref_layer_right_offset */ 228 WORD32 i4_seq_scaled_ref_layer_right_offset; 229 230 /* seq_scaled_ref_layer_bottom_offset */ 231 WORD32 i4_seq_scaled_ref_layer_bottom_offset; 232 233 /* seq_tcoeff_level_prediction_flag */ 234 WORD8 i1_seq_tcoeff_level_prediction_flag; 235 236 /* adaptive_tcoeff_level_prediction_flag */ 237 WORD8 i1_adaptive_tcoeff_level_prediction_flag; 238 239 /* slice_header_restriction_flag */ 240 WORD8 i1_slice_header_restriction_flag; 241 242 } sps_svc_ext_t; 243 244 typedef struct subset_sps_t 245 { 246 /* SPS structure */ 247 sps_t s_sps; 248 249 /* Structure containing flags specific to SVC SPS */ 250 sps_svc_ext_t s_sps_svc_ext; 251 252 /* svc_vui_parameters_present_flag */ 253 WORD8 i1_svc_vui_parameters_present_flag; 254 255 svc_vui_ext_t s_svc_vui; 256 257 /* additional_extension2_data_flag */ 258 WORD8 i1_additional_extension2_flag; 259 260 } subset_sps_t; 261 262 typedef struct svc_slice_header_t 263 { 264 /* ref_layer_dq_id */ 265 UWORD32 u4_ref_layer_dq_id; 266 267 /* disable_inter_layer_deblocking_filter_idc */ 268 UWORD32 u4_disable_inter_layer_deblocking_filter_idc; 269 270 /* inter_layer_slice_alpha_c0_offset_div2 */ 271 WORD32 i4_inter_layer_slice_alpha_c0_offset_div2; 272 273 /* inter_layer_slice_beta_offset_div2 */ 274 WORD32 i4_inter_layer_slice_beta_offset_div2; 275 276 /* constrained_intra_resampling_flag */ 277 WORD8 i1_constrained_intra_resampling_flag; 278 279 /* ref_layer_chroma_phase_x_plus1_flag */ 280 WORD8 i1_ref_layer_chroma_phase_x_plus1_flag; 281 282 /* ref_layer_chroma_phase_y_plus1 */ 283 WORD8 i1_ref_layer_chroma_phase_y_plus1; 284 285 /* scaled_ref_layer_left_offset */ 286 WORD32 i4_scaled_ref_layer_left; 287 288 /* scaled_ref_layer_top_offset */ 289 WORD32 i4_scaled_ref_layer_top; 290 291 /* scaled_ref_layer_right_offset */ 292 WORD32 i4_scaled_ref_layer_right; 293 294 /* scaled_ref_layer_bottom_offset */ 295 WORD32 i4_scaled_ref_layer_bottom; 296 297 /* slice_skip_flag */ 298 WORD8 i1_slice_skip_flag; 299 300 /* num_mbs_in_slice_minus1 */ 301 UWORD32 u4_num_mbs_in_slice_minus1; 302 303 /* adaptive_base_mode_flag */ 304 WORD8 i1_adaptive_base_mode_flag; 305 306 /* default_base_mode_flag */ 307 WORD8 i1_default_base_mode_flag; 308 309 /* adaptive_motion_prediction_flag */ 310 WORD8 i1_adaptive_motion_prediction_flag; 311 312 /* default_motion_prediction_flag */ 313 WORD8 i1_default_motion_prediction_flag; 314 315 /* adaptive_residual_prediction_flag */ 316 WORD8 i1_adaptive_residual_prediction_flag; 317 318 /* default_residual_prediction_flag */ 319 WORD8 i1_default_residual_prediction_flag; 320 321 /* tcoeff_level_prediction_flag */ 322 WORD8 i1_tcoeff_level_prediction_flag; 323 324 /* scan_idx_start */ 325 UWORD32 u4_scan_idx_start; 326 327 /* scan_idx_end */ 328 UWORD32 u4_scan_idx_end; 329 330 WORD32 i4_store_ref_base_pic_flag; 331 332 slice_header_t s_slice_header; 333 } svc_slice_header_t; 334 335 #endif 336