Hamsalekha S | 8d3d303 | 2015-03-13 21:24:58 +0530 | [diff] [blame^] | 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 | |
| 54 | /*****************************************************************************/ |
| 55 | /* Function Macros */ |
| 56 | /*****************************************************************************/ |
| 57 | #define IS_IVD_CONCEALMENT_APPLIED(x) (x & (1 << IVD_APPLIEDCONCEALMENT)) |
| 58 | #define IS_IVD_INSUFFICIENTDATA_ERROR(x) (x & (1 << IVD_INSUFFICIENTDATA)) |
| 59 | #define IS_IVD_CORRUPTEDDATA_ERROR(x) (x & (1 << IVD_CORRUPTEDDATA)) |
| 60 | #define IS_IVD_CORRUPTEDHEADER_ERROR(x) (x & (1 << IVD_CORRUPTEDHEADER)) |
| 61 | #define IS_IVD_UNSUPPORTEDINPUT_ERROR(x) (x & (1 << IVD_UNSUPPORTEDINPUT)) |
| 62 | #define IS_IVD_UNSUPPORTEDPARAM_ERROR(x) (x & (1 << IVD_UNSUPPORTEDPARAM)) |
| 63 | #define IS_IVD_FATAL_ERROR(x) (x & (1 << IVD_FATALERROR)) |
| 64 | #define IS_IVD_INVALID_BITSTREAM_ERROR(x) (x & (1 << IVD_INVALID_BITSTREAM)) |
| 65 | #define IS_IVD_INCOMPLETE_BITSTREAM_ERROR(x) (x & (1 << IVD_INCOMPLETE_BITSTREAM)) |
| 66 | |
| 67 | |
| 68 | /*****************************************************************************/ |
| 69 | /* API Function Prototype */ |
| 70 | /*****************************************************************************/ |
| 71 | IV_API_CALL_STATUS_T ih264d_api_function(iv_obj_t *ps_handle, void *pv_api_ip,void *pv_api_op); |
| 72 | |
| 73 | /*****************************************************************************/ |
| 74 | /* Enums */ |
| 75 | /*****************************************************************************/ |
| 76 | /* Codec Error codes for H264 ASP Decoder */ |
| 77 | |
| 78 | typedef enum { |
| 79 | |
| 80 | IH264D_VID_HDR_DEC_NUM_FRM_BUF_NOT_SUFFICIENT = IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS + 1, |
| 81 | |
| 82 | }IH264D_ERROR_CODES_T; |
| 83 | |
| 84 | /*****************************************************************************/ |
| 85 | /* Extended Structures */ |
| 86 | /*****************************************************************************/ |
| 87 | |
| 88 | /*****************************************************************************/ |
| 89 | /* Get Number of Memory Records */ |
| 90 | /*****************************************************************************/ |
| 91 | |
| 92 | |
| 93 | typedef struct { |
| 94 | iv_num_mem_rec_ip_t s_ivd_num_mem_rec_ip_t; |
| 95 | }ih264d_num_mem_rec_ip_t; |
| 96 | |
| 97 | |
| 98 | typedef struct{ |
| 99 | iv_num_mem_rec_op_t s_ivd_num_mem_rec_op_t; |
| 100 | }ih264d_num_mem_rec_op_t; |
| 101 | |
| 102 | |
| 103 | /*****************************************************************************/ |
| 104 | /* Fill Memory Records */ |
| 105 | /*****************************************************************************/ |
| 106 | |
| 107 | |
| 108 | typedef struct { |
| 109 | iv_fill_mem_rec_ip_t s_ivd_fill_mem_rec_ip_t; |
| 110 | WORD32 i4_level; |
| 111 | UWORD32 u4_num_reorder_frames; |
| 112 | UWORD32 u4_num_ref_frames; |
| 113 | UWORD32 u4_share_disp_buf; |
| 114 | |
| 115 | /* format in which codec has to give out frame data for display */ |
| 116 | IV_COLOR_FORMAT_T e_output_format; |
| 117 | |
| 118 | /* Number of extra display buffers that will be allocated to handle display pipeline depth */ |
| 119 | UWORD32 u4_num_extra_disp_buf; |
| 120 | |
| 121 | }ih264d_fill_mem_rec_ip_t; |
| 122 | |
| 123 | |
| 124 | typedef struct{ |
| 125 | iv_fill_mem_rec_op_t s_ivd_fill_mem_rec_op_t; |
| 126 | |
| 127 | }ih264d_fill_mem_rec_op_t; |
| 128 | |
| 129 | /*****************************************************************************/ |
| 130 | /* Retrieve Memory Records */ |
| 131 | /*****************************************************************************/ |
| 132 | |
| 133 | |
| 134 | typedef struct { |
| 135 | iv_retrieve_mem_rec_ip_t s_ivd_retrieve_mem_rec_ip_t; |
| 136 | }ih264d_retrieve_mem_rec_ip_t; |
| 137 | |
| 138 | |
| 139 | typedef struct{ |
| 140 | iv_retrieve_mem_rec_op_t s_ivd_retrieve_mem_rec_op_t; |
| 141 | }ih264d_retrieve_mem_rec_op_t; |
| 142 | |
| 143 | |
| 144 | /*****************************************************************************/ |
| 145 | /* Initialize decoder */ |
| 146 | /*****************************************************************************/ |
| 147 | |
| 148 | |
| 149 | typedef struct { |
| 150 | ivd_init_ip_t s_ivd_init_ip_t; |
| 151 | WORD32 i4_level; |
| 152 | UWORD32 u4_num_reorder_frames; |
| 153 | UWORD32 u4_num_ref_frames; |
| 154 | UWORD32 u4_share_disp_buf; |
| 155 | /* Number of extra display buffers that will be allocated to handle display pipeline depth */ |
| 156 | UWORD32 u4_num_extra_disp_buf; |
| 157 | |
| 158 | }ih264d_init_ip_t; |
| 159 | |
| 160 | |
| 161 | typedef struct{ |
| 162 | ivd_init_op_t s_ivd_init_op_t; |
| 163 | }ih264d_init_op_t; |
| 164 | |
| 165 | |
| 166 | /*****************************************************************************/ |
| 167 | /* Video Decode */ |
| 168 | /*****************************************************************************/ |
| 169 | |
| 170 | |
| 171 | typedef struct { |
| 172 | ivd_video_decode_ip_t s_ivd_video_decode_ip_t; |
| 173 | }ih264d_video_decode_ip_t; |
| 174 | |
| 175 | |
| 176 | typedef struct{ |
| 177 | ivd_video_decode_op_t s_ivd_video_decode_op_t; |
| 178 | }ih264d_video_decode_op_t; |
| 179 | |
| 180 | |
| 181 | /*****************************************************************************/ |
| 182 | /* Get Display Frame */ |
| 183 | /*****************************************************************************/ |
| 184 | |
| 185 | |
| 186 | typedef struct |
| 187 | { |
| 188 | ivd_get_display_frame_ip_t s_ivd_get_display_frame_ip_t; |
| 189 | }ih264d_get_display_frame_ip_t; |
| 190 | |
| 191 | |
| 192 | typedef struct |
| 193 | { |
| 194 | ivd_get_display_frame_op_t s_ivd_get_display_frame_op_t; |
| 195 | }ih264d_get_display_frame_op_t; |
| 196 | |
| 197 | /*****************************************************************************/ |
| 198 | /* Set Display Frame */ |
| 199 | /*****************************************************************************/ |
| 200 | |
| 201 | |
| 202 | typedef struct |
| 203 | { |
| 204 | ivd_set_display_frame_ip_t s_ivd_set_display_frame_ip_t; |
| 205 | }ih264d_set_display_frame_ip_t; |
| 206 | |
| 207 | |
| 208 | typedef struct |
| 209 | { |
| 210 | ivd_set_display_frame_op_t s_ivd_set_display_frame_op_t; |
| 211 | }ih264d_set_display_frame_op_t; |
| 212 | |
| 213 | /*****************************************************************************/ |
| 214 | /* Release Display Buffers */ |
| 215 | /*****************************************************************************/ |
| 216 | |
| 217 | |
| 218 | typedef struct |
| 219 | { |
| 220 | ivd_rel_display_frame_ip_t s_ivd_rel_display_frame_ip_t; |
| 221 | }ih264d_rel_display_frame_ip_t; |
| 222 | |
| 223 | |
| 224 | typedef struct |
| 225 | { |
| 226 | ivd_rel_display_frame_op_t s_ivd_rel_display_frame_op_t; |
| 227 | }ih264d_rel_display_frame_op_t; |
| 228 | |
| 229 | |
| 230 | typedef enum { |
| 231 | /** Set number of cores/threads to be used */ |
| 232 | IH264D_CMD_CTL_SET_NUM_CORES = IVD_CMD_CTL_CODEC_SUBCMD_START, |
| 233 | |
| 234 | /** Set processor details */ |
| 235 | IH264D_CMD_CTL_SET_PROCESSOR = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x001, |
| 236 | |
| 237 | /** Get display buffer dimensions */ |
| 238 | IH264D_CMD_CTL_GET_BUFFER_DIMENSIONS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x100, |
| 239 | |
| 240 | /** Get VUI parameters */ |
| 241 | IH264D_CMD_CTL_GET_VUI_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x101, |
| 242 | |
| 243 | /** Enable/disable GPU, supported on select platforms */ |
| 244 | IH264D_CMD_CTL_GPU_ENABLE_DISABLE = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x200, |
| 245 | |
| 246 | /** Set degrade level */ |
| 247 | IH264D_CMD_CTL_DEGRADE = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x300 |
| 248 | }IH264D_CMD_CTL_SUB_CMDS; |
| 249 | /*****************************************************************************/ |
| 250 | /* Video control Flush */ |
| 251 | /*****************************************************************************/ |
| 252 | |
| 253 | |
| 254 | typedef struct{ |
| 255 | ivd_ctl_flush_ip_t s_ivd_ctl_flush_ip_t; |
| 256 | }ih264d_ctl_flush_ip_t; |
| 257 | |
| 258 | |
| 259 | typedef struct{ |
| 260 | ivd_ctl_flush_op_t s_ivd_ctl_flush_op_t; |
| 261 | }ih264d_ctl_flush_op_t; |
| 262 | |
| 263 | /*****************************************************************************/ |
| 264 | /* Video control reset */ |
| 265 | /*****************************************************************************/ |
| 266 | |
| 267 | |
| 268 | typedef struct{ |
| 269 | ivd_ctl_reset_ip_t s_ivd_ctl_reset_ip_t; |
| 270 | }ih264d_ctl_reset_ip_t; |
| 271 | |
| 272 | |
| 273 | typedef struct{ |
| 274 | ivd_ctl_reset_op_t s_ivd_ctl_reset_op_t; |
| 275 | }ih264d_ctl_reset_op_t; |
| 276 | |
| 277 | |
| 278 | /*****************************************************************************/ |
| 279 | /* Video control Set Params */ |
| 280 | /*****************************************************************************/ |
| 281 | |
| 282 | |
| 283 | typedef struct { |
| 284 | ivd_ctl_set_config_ip_t s_ivd_ctl_set_config_ip_t; |
| 285 | }ih264d_ctl_set_config_ip_t; |
| 286 | |
| 287 | |
| 288 | typedef struct{ |
| 289 | ivd_ctl_set_config_op_t s_ivd_ctl_set_config_op_t; |
| 290 | }ih264d_ctl_set_config_op_t; |
| 291 | |
| 292 | /*****************************************************************************/ |
| 293 | /* Video control:Get Buf Info */ |
| 294 | /*****************************************************************************/ |
| 295 | |
| 296 | |
| 297 | typedef struct{ |
| 298 | ivd_ctl_getbufinfo_ip_t s_ivd_ctl_getbufinfo_ip_t; |
| 299 | }ih264d_ctl_getbufinfo_ip_t; |
| 300 | |
| 301 | |
| 302 | |
| 303 | typedef struct{ |
| 304 | ivd_ctl_getbufinfo_op_t s_ivd_ctl_getbufinfo_op_t; |
| 305 | }ih264d_ctl_getbufinfo_op_t; |
| 306 | |
| 307 | |
| 308 | /*****************************************************************************/ |
| 309 | /* Video control:Getstatus Call */ |
| 310 | /*****************************************************************************/ |
| 311 | |
| 312 | |
| 313 | typedef struct{ |
| 314 | ivd_ctl_getstatus_ip_t s_ivd_ctl_getstatus_ip_t; |
| 315 | }ih264d_ctl_getstatus_ip_t; |
| 316 | |
| 317 | |
| 318 | |
| 319 | typedef struct{ |
| 320 | ivd_ctl_getstatus_op_t s_ivd_ctl_getstatus_op_t; |
| 321 | }ih264d_ctl_getstatus_op_t; |
| 322 | |
| 323 | |
| 324 | /*****************************************************************************/ |
| 325 | /* Video control:Get Version Info */ |
| 326 | /*****************************************************************************/ |
| 327 | |
| 328 | |
| 329 | typedef struct{ |
| 330 | ivd_ctl_getversioninfo_ip_t s_ivd_ctl_getversioninfo_ip_t; |
| 331 | }ih264d_ctl_getversioninfo_ip_t; |
| 332 | |
| 333 | |
| 334 | |
| 335 | typedef struct{ |
| 336 | ivd_ctl_getversioninfo_op_t s_ivd_ctl_getversioninfo_op_t; |
| 337 | }ih264d_ctl_getversioninfo_op_t; |
| 338 | |
| 339 | typedef struct{ |
| 340 | |
| 341 | /** |
| 342 | * u4_size |
| 343 | */ |
| 344 | UWORD32 u4_size; |
| 345 | |
| 346 | /** |
| 347 | * cmd |
| 348 | */ |
| 349 | IVD_API_COMMAND_TYPE_T e_cmd; |
| 350 | |
| 351 | /** |
| 352 | * sub_cmd |
| 353 | */ |
| 354 | IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; |
| 355 | |
| 356 | /** |
| 357 | * Pictures that are are degraded |
| 358 | * 0 : No degrade |
| 359 | * 1 : Only on non-reference frames |
| 360 | * 2 : Use interval specified by u4_nondegrade_interval |
| 361 | * 3 : All non-key frames |
| 362 | * 4 : All frames |
| 363 | */ |
| 364 | WORD32 i4_degrade_pics; |
| 365 | |
| 366 | /** |
| 367 | * Interval for pictures which are completely decoded without any degradation |
| 368 | */ |
| 369 | WORD32 i4_nondegrade_interval; |
| 370 | |
| 371 | /** |
| 372 | * bit position (lsb is zero): Type of degradation |
| 373 | * 1 : Disable deblocking |
| 374 | * 2 : Faster inter prediction filters |
| 375 | * 3 : Fastest inter prediction filters |
| 376 | */ |
| 377 | WORD32 i4_degrade_type; |
| 378 | |
| 379 | }ih264d_ctl_degrade_ip_t; |
| 380 | |
| 381 | typedef struct |
| 382 | { |
| 383 | /** |
| 384 | * u4_size |
| 385 | */ |
| 386 | UWORD32 u4_size; |
| 387 | |
| 388 | /** |
| 389 | * error_code |
| 390 | */ |
| 391 | UWORD32 u4_error_code; |
| 392 | }ih264d_ctl_degrade_op_t; |
| 393 | |
| 394 | typedef struct{ |
| 395 | UWORD32 u4_size; |
| 396 | IVD_API_COMMAND_TYPE_T e_cmd; |
| 397 | IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; |
| 398 | UWORD32 u4_disable_deblk_level; |
| 399 | }ih264d_ctl_disable_deblock_ip_t; |
| 400 | |
| 401 | typedef struct{ |
| 402 | UWORD32 u4_size; |
| 403 | UWORD32 u4_error_code; |
| 404 | }ih264d_ctl_disable_deblock_op_t; |
| 405 | |
| 406 | |
| 407 | typedef struct{ |
| 408 | UWORD32 u4_size; |
| 409 | IVD_API_COMMAND_TYPE_T e_cmd; |
| 410 | IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; |
| 411 | UWORD32 u4_num_cores; |
| 412 | }ih264d_ctl_set_num_cores_ip_t; |
| 413 | |
| 414 | typedef struct{ |
| 415 | UWORD32 u4_size; |
| 416 | UWORD32 u4_error_code; |
| 417 | }ih264d_ctl_set_num_cores_op_t; |
| 418 | |
| 419 | typedef struct |
| 420 | { |
| 421 | /** |
| 422 | * i4_size |
| 423 | */ |
| 424 | UWORD32 u4_size; |
| 425 | /** |
| 426 | * cmd |
| 427 | */ |
| 428 | IVD_API_COMMAND_TYPE_T e_cmd; |
| 429 | /** |
| 430 | * sub cmd |
| 431 | */ |
| 432 | IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; |
| 433 | /** |
| 434 | * Processor type |
| 435 | */ |
| 436 | UWORD32 u4_arch; |
| 437 | /** |
| 438 | * SOC type |
| 439 | */ |
| 440 | UWORD32 u4_soc; |
| 441 | |
| 442 | /** |
| 443 | * num_cores |
| 444 | */ |
| 445 | UWORD32 u4_num_cores; |
| 446 | |
| 447 | }ih264d_ctl_set_processor_ip_t; |
| 448 | |
| 449 | typedef struct |
| 450 | { |
| 451 | /** |
| 452 | * i4_size |
| 453 | */ |
| 454 | UWORD32 u4_size; |
| 455 | /** |
| 456 | * error_code |
| 457 | */ |
| 458 | UWORD32 u4_error_code; |
| 459 | }ih264d_ctl_set_processor_op_t; |
| 460 | |
| 461 | typedef struct{ |
| 462 | UWORD32 u4_size; |
| 463 | IVD_API_COMMAND_TYPE_T e_cmd; |
| 464 | IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; |
| 465 | }ih264d_ctl_get_frame_dimensions_ip_t; |
| 466 | |
| 467 | |
| 468 | typedef struct{ |
| 469 | UWORD32 u4_size; |
| 470 | UWORD32 u4_error_code; |
| 471 | UWORD32 u4_x_offset[3]; |
| 472 | UWORD32 u4_y_offset[3]; |
| 473 | UWORD32 u4_disp_wd[3]; |
| 474 | UWORD32 u4_disp_ht[3]; |
| 475 | UWORD32 u4_buffer_wd[3]; |
| 476 | UWORD32 u4_buffer_ht[3]; |
| 477 | }ih264d_ctl_get_frame_dimensions_op_t; |
| 478 | |
| 479 | #ifdef __cplusplus |
| 480 | } /* closing brace for extern "C" */ |
| 481 | #endif |
| 482 | #endif /* _IH264D_H_ */ |