1 /****************************************************************************** 2 * 3 * Copyright (C) 2015 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 /* File Name : ih264d.h */ 23 /* */ 24 /* Description : This file contains all the necessary structure and */ 25 /* enumeration definitions needed for the Application */ 26 /* Program Interface(API) of the Ittiam H264 ASP */ 27 /* Decoder on Cortex A8 - Neon platform */ 28 /* */ 29 /* List of Functions : ih264d_api_function */ 30 /* */ 31 /* Issues / Problems : None */ 32 /* */ 33 /* Revision History : */ 34 /* */ 35 /* DD MM YYYY Author(s) Changes (Describe the changes made) */ 36 /* 26 08 2010 100239(RCY) Draft */ 37 /* */ 38 /*****************************************************************************/ 39 40 #ifndef _IH264D_H_ 41 #define _IH264D_H_ 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 #include "iv.h" 47 #include "ivd.h" 48 49 50 /*****************************************************************************/ 51 /* Constant Macros */ 52 /*****************************************************************************/ 53 #define IVD_ERROR_MASK 0xFF 54 55 /*****************************************************************************/ 56 /* Function Macros */ 57 /*****************************************************************************/ 58 #define IS_IVD_CONCEALMENT_APPLIED(x) (x & (1 << IVD_APPLIEDCONCEALMENT)) 59 #define IS_IVD_INSUFFICIENTDATA_ERROR(x) (x & (1 << IVD_INSUFFICIENTDATA)) 60 #define IS_IVD_CORRUPTEDDATA_ERROR(x) (x & (1 << IVD_CORRUPTEDDATA)) 61 #define IS_IVD_CORRUPTEDHEADER_ERROR(x) (x & (1 << IVD_CORRUPTEDHEADER)) 62 #define IS_IVD_UNSUPPORTEDINPUT_ERROR(x) (x & (1 << IVD_UNSUPPORTEDINPUT)) 63 #define IS_IVD_UNSUPPORTEDPARAM_ERROR(x) (x & (1 << IVD_UNSUPPORTEDPARAM)) 64 #define IS_IVD_FATAL_ERROR(x) (x & (1 << IVD_FATALERROR)) 65 #define IS_IVD_INVALID_BITSTREAM_ERROR(x) (x & (1 << IVD_INVALID_BITSTREAM)) 66 #define IS_IVD_INCOMPLETE_BITSTREAM_ERROR(x) (x & (1 << IVD_INCOMPLETE_BITSTREAM)) 67 68 69 /*****************************************************************************/ 70 /* API Function Prototype */ 71 /*****************************************************************************/ 72 IV_API_CALL_STATUS_T ih264d_api_function(iv_obj_t *ps_handle, void *pv_api_ip,void *pv_api_op); 73 74 /*****************************************************************************/ 75 /* Enums */ 76 /*****************************************************************************/ 77 /* Codec Error codes for H264 ASP Decoder */ 78 79 typedef enum { 80 81 IH264D_VID_HDR_DEC_NUM_FRM_BUF_NOT_SUFFICIENT = IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS + 1, 82 83 }IH264D_ERROR_CODES_T; 84 85 /*****************************************************************************/ 86 /* Extended Structures */ 87 /*****************************************************************************/ 88 89 90 /*****************************************************************************/ 91 /* Delete Codec */ 92 /*****************************************************************************/ 93 94 95 typedef struct { 96 ivd_delete_ip_t s_ivd_delete_ip_t; 97 }ih264d_delete_ip_t; 98 99 100 typedef struct{ 101 ivd_delete_op_t s_ivd_delete_op_t; 102 }ih264d_delete_op_t; 103 104 105 /*****************************************************************************/ 106 /* Initialize decoder */ 107 /*****************************************************************************/ 108 109 110 typedef struct { 111 ivd_create_ip_t s_ivd_create_ip_t; 112 }ih264d_create_ip_t; 113 114 115 typedef struct{ 116 ivd_create_op_t s_ivd_create_op_t; 117 }ih264d_create_op_t; 118 119 120 /*****************************************************************************/ 121 /* Video Decode */ 122 /*****************************************************************************/ 123 124 125 typedef struct { 126 ivd_video_decode_ip_t s_ivd_video_decode_ip_t; 127 }ih264d_video_decode_ip_t; 128 129 130 typedef struct{ 131 ivd_video_decode_op_t s_ivd_video_decode_op_t; 132 }ih264d_video_decode_op_t; 133 134 135 /*****************************************************************************/ 136 /* Get Display Frame */ 137 /*****************************************************************************/ 138 139 140 typedef struct 141 { 142 ivd_get_display_frame_ip_t s_ivd_get_display_frame_ip_t; 143 }ih264d_get_display_frame_ip_t; 144 145 146 typedef struct 147 { 148 ivd_get_display_frame_op_t s_ivd_get_display_frame_op_t; 149 }ih264d_get_display_frame_op_t; 150 151 /*****************************************************************************/ 152 /* Set Display Frame */ 153 /*****************************************************************************/ 154 155 156 typedef struct 157 { 158 ivd_set_display_frame_ip_t s_ivd_set_display_frame_ip_t; 159 }ih264d_set_display_frame_ip_t; 160 161 162 typedef struct 163 { 164 ivd_set_display_frame_op_t s_ivd_set_display_frame_op_t; 165 }ih264d_set_display_frame_op_t; 166 167 /*****************************************************************************/ 168 /* Release Display Buffers */ 169 /*****************************************************************************/ 170 171 172 typedef struct 173 { 174 ivd_rel_display_frame_ip_t s_ivd_rel_display_frame_ip_t; 175 }ih264d_rel_display_frame_ip_t; 176 177 178 typedef struct 179 { 180 ivd_rel_display_frame_op_t s_ivd_rel_display_frame_op_t; 181 }ih264d_rel_display_frame_op_t; 182 183 184 typedef enum { 185 /** Set number of cores/threads to be used */ 186 IH264D_CMD_CTL_SET_NUM_CORES = IVD_CMD_CTL_CODEC_SUBCMD_START, 187 188 /** Set processor details */ 189 IH264D_CMD_CTL_SET_PROCESSOR = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x001, 190 191 /** Get display buffer dimensions */ 192 IH264D_CMD_CTL_GET_BUFFER_DIMENSIONS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x100, 193 194 /** Get VUI parameters */ 195 IH264D_CMD_CTL_GET_VUI_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x101, 196 197 /** Enable/disable GPU, supported on select platforms */ 198 IH264D_CMD_CTL_GPU_ENABLE_DISABLE = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x200, 199 200 /** Set degrade level */ 201 IH264D_CMD_CTL_DEGRADE = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x300 202 }IH264D_CMD_CTL_SUB_CMDS; 203 /*****************************************************************************/ 204 /* Video control Flush */ 205 /*****************************************************************************/ 206 207 208 typedef struct{ 209 ivd_ctl_flush_ip_t s_ivd_ctl_flush_ip_t; 210 }ih264d_ctl_flush_ip_t; 211 212 213 typedef struct{ 214 ivd_ctl_flush_op_t s_ivd_ctl_flush_op_t; 215 }ih264d_ctl_flush_op_t; 216 217 /*****************************************************************************/ 218 /* Video control reset */ 219 /*****************************************************************************/ 220 221 222 typedef struct{ 223 ivd_ctl_reset_ip_t s_ivd_ctl_reset_ip_t; 224 }ih264d_ctl_reset_ip_t; 225 226 227 typedef struct{ 228 ivd_ctl_reset_op_t s_ivd_ctl_reset_op_t; 229 }ih264d_ctl_reset_op_t; 230 231 232 /*****************************************************************************/ 233 /* Video control Set Params */ 234 /*****************************************************************************/ 235 236 237 typedef struct { 238 ivd_ctl_set_config_ip_t s_ivd_ctl_set_config_ip_t; 239 }ih264d_ctl_set_config_ip_t; 240 241 242 typedef struct{ 243 ivd_ctl_set_config_op_t s_ivd_ctl_set_config_op_t; 244 }ih264d_ctl_set_config_op_t; 245 246 /*****************************************************************************/ 247 /* Video control:Get Buf Info */ 248 /*****************************************************************************/ 249 250 251 typedef struct{ 252 ivd_ctl_getbufinfo_ip_t s_ivd_ctl_getbufinfo_ip_t; 253 }ih264d_ctl_getbufinfo_ip_t; 254 255 256 257 typedef struct{ 258 ivd_ctl_getbufinfo_op_t s_ivd_ctl_getbufinfo_op_t; 259 }ih264d_ctl_getbufinfo_op_t; 260 261 262 /*****************************************************************************/ 263 /* Video control:Getstatus Call */ 264 /*****************************************************************************/ 265 266 267 typedef struct{ 268 ivd_ctl_getstatus_ip_t s_ivd_ctl_getstatus_ip_t; 269 }ih264d_ctl_getstatus_ip_t; 270 271 272 273 typedef struct{ 274 ivd_ctl_getstatus_op_t s_ivd_ctl_getstatus_op_t; 275 }ih264d_ctl_getstatus_op_t; 276 277 278 /*****************************************************************************/ 279 /* Video control:Get Version Info */ 280 /*****************************************************************************/ 281 282 283 typedef struct{ 284 ivd_ctl_getversioninfo_ip_t s_ivd_ctl_getversioninfo_ip_t; 285 }ih264d_ctl_getversioninfo_ip_t; 286 287 288 289 typedef struct{ 290 ivd_ctl_getversioninfo_op_t s_ivd_ctl_getversioninfo_op_t; 291 }ih264d_ctl_getversioninfo_op_t; 292 293 typedef struct{ 294 295 /** 296 * u4_size 297 */ 298 UWORD32 u4_size; 299 300 /** 301 * cmd 302 */ 303 IVD_API_COMMAND_TYPE_T e_cmd; 304 305 /** 306 * sub_cmd 307 */ 308 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 309 310 /** 311 * Pictures that are are degraded 312 * 0 : No degrade 313 * 1 : Only on non-reference frames 314 * 2 : Use interval specified by u4_nondegrade_interval 315 * 3 : All non-key frames 316 * 4 : All frames 317 */ 318 WORD32 i4_degrade_pics; 319 320 /** 321 * Interval for pictures which are completely decoded without any degradation 322 */ 323 WORD32 i4_nondegrade_interval; 324 325 /** 326 * bit position (lsb is zero): Type of degradation 327 * 1 : Disable deblocking 328 * 2 : Faster inter prediction filters 329 * 3 : Fastest inter prediction filters 330 */ 331 WORD32 i4_degrade_type; 332 333 }ih264d_ctl_degrade_ip_t; 334 335 typedef struct 336 { 337 /** 338 * u4_size 339 */ 340 UWORD32 u4_size; 341 342 /** 343 * error_code 344 */ 345 UWORD32 u4_error_code; 346 }ih264d_ctl_degrade_op_t; 347 348 typedef struct{ 349 UWORD32 u4_size; 350 IVD_API_COMMAND_TYPE_T e_cmd; 351 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 352 UWORD32 u4_disable_deblk_level; 353 }ih264d_ctl_disable_deblock_ip_t; 354 355 typedef struct{ 356 UWORD32 u4_size; 357 UWORD32 u4_error_code; 358 }ih264d_ctl_disable_deblock_op_t; 359 360 361 typedef struct{ 362 UWORD32 u4_size; 363 IVD_API_COMMAND_TYPE_T e_cmd; 364 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 365 UWORD32 u4_num_cores; 366 }ih264d_ctl_set_num_cores_ip_t; 367 368 typedef struct{ 369 UWORD32 u4_size; 370 UWORD32 u4_error_code; 371 }ih264d_ctl_set_num_cores_op_t; 372 373 typedef struct 374 { 375 /** 376 * i4_size 377 */ 378 UWORD32 u4_size; 379 /** 380 * cmd 381 */ 382 IVD_API_COMMAND_TYPE_T e_cmd; 383 /** 384 * sub cmd 385 */ 386 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 387 /** 388 * Processor type 389 */ 390 UWORD32 u4_arch; 391 /** 392 * SOC type 393 */ 394 UWORD32 u4_soc; 395 396 /** 397 * num_cores 398 */ 399 UWORD32 u4_num_cores; 400 401 }ih264d_ctl_set_processor_ip_t; 402 403 typedef struct 404 { 405 /** 406 * i4_size 407 */ 408 UWORD32 u4_size; 409 /** 410 * error_code 411 */ 412 UWORD32 u4_error_code; 413 }ih264d_ctl_set_processor_op_t; 414 415 typedef struct{ 416 UWORD32 u4_size; 417 IVD_API_COMMAND_TYPE_T e_cmd; 418 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 419 }ih264d_ctl_get_frame_dimensions_ip_t; 420 421 422 typedef struct{ 423 UWORD32 u4_size; 424 UWORD32 u4_error_code; 425 UWORD32 u4_x_offset[3]; 426 UWORD32 u4_y_offset[3]; 427 UWORD32 u4_disp_wd[3]; 428 UWORD32 u4_disp_ht[3]; 429 UWORD32 u4_buffer_wd[3]; 430 UWORD32 u4_buffer_ht[3]; 431 }ih264d_ctl_get_frame_dimensions_op_t; 432 433 typedef struct 434 { 435 UWORD32 u4_size; 436 IVD_API_COMMAND_TYPE_T e_cmd; 437 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 438 }ih264d_ctl_get_vui_params_ip_t; 439 440 typedef struct 441 { 442 UWORD32 u4_size; 443 UWORD32 u4_error_code; 444 UWORD8 u1_aspect_ratio_idc; 445 UWORD16 u2_sar_width; 446 UWORD16 u2_sar_height; 447 UWORD8 u1_overscan_appropriate_flag; 448 UWORD8 u1_video_format; 449 UWORD8 u1_video_full_range_flag; 450 UWORD8 u1_colour_primaries; 451 UWORD8 u1_tfr_chars; 452 UWORD8 u1_matrix_coeffs; 453 UWORD8 u1_cr_top_field; 454 UWORD8 u1_cr_bottom_field; 455 UWORD32 u4_num_units_in_tick; 456 UWORD32 u4_time_scale; 457 UWORD8 u1_fixed_frame_rate_flag; 458 UWORD8 u1_nal_hrd_params_present; 459 UWORD8 u1_vcl_hrd_params_present; 460 UWORD8 u1_low_delay_hrd_flag; 461 UWORD8 u1_pic_struct_present_flag; 462 UWORD8 u1_bitstream_restriction_flag; 463 UWORD8 u1_mv_over_pic_boundaries_flag; 464 UWORD32 u4_max_bytes_per_pic_denom; 465 UWORD32 u4_max_bits_per_mb_denom; 466 UWORD32 u4_log2_max_mv_length_horz; 467 UWORD32 u4_log2_max_mv_length_vert; 468 UWORD32 u4_num_reorder_frames; 469 UWORD32 u4_max_dec_frame_buffering; 470 }ih264d_ctl_get_vui_params_op_t; 471 472 #ifdef __cplusplus 473 } /* closing brace for extern "C" */ 474 #endif 475 #endif /* _IH264D_H_ */ 476