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 : impeg2d.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 MPEG2 ASP */ 27 /* Decoder on Cortex A8 - Neon platform */ 28 /* */ 29 /* List of Functions : impeg2d_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 __IMPEG2D_H__ 41 #define __IMPEG2D_H__ 42 43 #include "iv.h" 44 #include "ivd.h" 45 #ifdef __cplusplus 46 extern "C" 47 { 48 #endif 49 50 /*****************************************************************************/ 51 /* Constant Macros */ 52 /*****************************************************************************/ 53 #define EXPORT_MPEG2DEC_FULLCODEC_MEM_RECORDS 22 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 #define SET_IVD_CONCEALMENT_APPLIED(x) ((x) |= (x) | (1 << IVD_APPLIEDCONCEALMENT)) 69 #define SET_IVD_INSUFFICIENTDATA_ERROR(x) ((x) |= (x) | (1 << IVD_INSUFFICIENTDATA)) 70 #define SET_IVD_CORRUPTEDDATA_ERROR(x) ((x) |= (x) | (1 << IVD_CORRUPTEDDATA)) 71 #define SET_IVD_CORRUPTEDHEADER_ERROR(x) ((x) |= (x) | (1 << IVD_CORRUPTEDHEADER)) 72 #define SET_IVD_UNSUPPORTEDINPUT_ERROR(x) ((x) |= (x) | (1 << IVD_UNSUPPORTEDINPUT)) 73 #define SET_IVD_UNSUPPORTEDPARAM_ERROR(x) ((x) |= (x) | (1 << IVD_UNSUPPORTEDPARAM)) 74 #define SET_IVD_FATAL_ERROR(x) ((x) |= (x) | (1 << IVD_FATALERROR)) 75 #define SET_IVD_INVALID_BITSTREAM_ERROR(x) ((x) |= (x) | (1 << IVD_INVALID_BITSTREAM)) 76 #define SET_IVD_INCOMPLETE_BITSTREAM_ERROR(x) ((x) |= (x) | (1 << IVD_INCOMPLETE_BITSTREAM)) 77 78 /*****************************************************************************/ 79 /* API Function Prototype */ 80 /*****************************************************************************/ 81 IV_API_CALL_STATUS_T impeg2d_api_function(iv_obj_t *ps_handle, 82 void *pv_api_ip, 83 void *pv_api_op); 84 85 /*****************************************************************************/ 86 /* Enums */ 87 /*****************************************************************************/ 88 /* Codec Error codes for MPEG2 ASP Decoder */ 89 90 typedef enum 91 { 92 93 IMPEG2D_UNKNOWN_ERROR = IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS + 1, 94 /* API calls without init call */ 95 IMPEG2D_INIT_NOT_DONE, 96 /* Query number of Memory Records API */ 97 IMPEG2D_QUERY_NUM_MEM_REC_FAIL, 98 99 /* Fill Memory Records API */ 100 IMPEG2D_FILL_NUM_MEM_REC_NOT_SUFFICIENT, 101 102 /* Initialize Decoder API */ 103 IMPEG2D_INIT_DEC_SCR_MEM_INSUFFICIENT, 104 IMPEG2D_INIT_DEC_PER_MEM_INSUFFICIENT, 105 IMPEG2D_INIT_NUM_MEM_REC_NOT_SUFFICIENT, 106 IMPEG2D_INIT_CHROMA_FORMAT_HEIGHT_ERROR, 107 108 /* Decode Sequence Header API */ 109 IMPEG2D_FRM_HDR_START_CODE_NOT_FOUND, 110 IMPEG2D_FRM_HDR_MARKER_BIT_NOT_FOUND, 111 IMPEG2D_PROF_LEVEL_NOT_SUPPORTED, 112 IMPEG2D_FMT_NOT_SUPPORTED, 113 IMPEG2D_SCALABILITIY_NOT_SUPPORTED, 114 IMPEG2D_PIC_SIZE_NOT_SUPPORTED, 115 116 /* Search for start code API */ 117 //IMPEG2D_SEARCH_START_CODE_FAIL , 118 /* Decode Video Frame API */ 119 IMPEG2D_START_CODE_NOT_FOUND, 120 IMPEG2D_MARKER_BIT_NOT_FOUND, 121 IMPEG2D_INVALID_STUFFING, 122 IMPEG2D_PROFILE_LEVEL_NOT_SUP, 123 IMPEG2D_CHROMA_FMT_NOT_SUP, 124 IMPEG2D_SCALABLITY_NOT_SUP, 125 IMPEG2D_FRM_HDR_DECODE_ERR, 126 IMPEG2D_MB_HDR_DECODE_ERR, 127 IMPEG2D_MB_TEX_DECODE_ERR, 128 IMPEG2D_INCORRECT_QUANT_MATRIX, 129 IMPEG2D_INVALID_SKIP_MB, 130 IMPEG2D_NOT_SUPPORTED_ERR, 131 IMPEG2D_BITSTREAM_BUFF_EXCEEDED_ERR, 132 IMPEG2D_INVALID_PIC_TYPE, 133 IMPEG2D_INVALID_HUFFMAN_CODE, 134 IMPEG2D_NO_FREE_BUF_ERR, 135 136 /* slice header errors */ 137 IMPEG2D_INVALID_VERT_SIZE, 138 IMPEG2D_MB_DATA_DECODE_ERR, 139 140 /* Get Display Frame API */ 141 IMPEG2D_GET_DISP_FRM_FAIL, 142 143 /* Sample Version limitation */ 144 IMPEG2D_SAMPLE_VERSION_LIMIT_ERR, 145 /** 146 * Width/height greater than max width and max height 147 */ 148 IMPEG2D_UNSUPPORTED_DIMENSIONS, 149 150 /* Unknown API Command */ 151 IMPEG2D_UNKNOWN_API_COMMAND 152 153 } IMPEG2D_ERROR_CODES_T; 154 155 /*****************************************************************************/ 156 /* Extended Structures */ 157 /*****************************************************************************/ 158 typedef enum 159 { 160 /** Set number of cores/threads to be used */ 161 IMPEG2D_CMD_CTL_SET_NUM_CORES = IVD_CMD_CTL_CODEC_SUBCMD_START, 162 163 /** Set processor details */ 164 IMPEG2D_CMD_CTL_SET_PROCESSOR = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x001, 165 166 /** Get display buffer dimensions */ 167 IMPEG2D_CMD_CTL_GET_BUFFER_DIMENSIONS = IVD_CMD_CTL_CODEC_SUBCMD_START 168 + 0x100, 169 170 /** Get Seq header/seq header extension info */ 171 IMPEG2D_CMD_CTL_GET_SEQ_INFO = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x101, 172 173 } IMPEG2D_CMD_CTL_SUB_CMDS; 174 175 /*****************************************************************************/ 176 /* Get Number of Memory Records */ 177 /*****************************************************************************/ 178 179 typedef struct 180 { 181 iv_num_mem_rec_ip_t s_ivd_num_mem_rec_ip_t; 182 } impeg2d_num_mem_rec_ip_t; 183 184 typedef struct 185 { 186 iv_num_mem_rec_op_t s_ivd_num_mem_rec_op_t; 187 } impeg2d_num_mem_rec_op_t; 188 189 /*****************************************************************************/ 190 /* Fill Memory Records */ 191 /*****************************************************************************/ 192 193 typedef struct 194 { 195 iv_fill_mem_rec_ip_t s_ivd_fill_mem_rec_ip_t; 196 /* Flag to enable sharing of reference buffers between decoder 197 and application */ 198 199 UWORD32 u4_share_disp_buf; 200 201 /* format in which codec has to give out frame data for display */ 202 IV_COLOR_FORMAT_T e_output_format; 203 204 /** 205 * Flag to enable/disable deinterlacing 206 */ 207 UWORD32 u4_deinterlace; 208 209 } impeg2d_fill_mem_rec_ip_t; 210 211 typedef struct 212 { 213 iv_fill_mem_rec_op_t s_ivd_fill_mem_rec_op_t; 214 } impeg2d_fill_mem_rec_op_t; 215 216 /*****************************************************************************/ 217 /* Retrieve Memory Records */ 218 /*****************************************************************************/ 219 220 typedef struct 221 { 222 iv_retrieve_mem_rec_ip_t s_ivd_retrieve_mem_rec_ip_t; 223 } impeg2d_retrieve_mem_rec_ip_t; 224 225 typedef struct 226 { 227 iv_retrieve_mem_rec_op_t s_ivd_retrieve_mem_rec_op_t; 228 } impeg2d_retrieve_mem_rec_op_t; 229 230 /*****************************************************************************/ 231 /* Initialize decoder */ 232 /*****************************************************************************/ 233 234 typedef struct 235 { 236 ivd_init_ip_t s_ivd_init_ip_t; 237 /* Flag to enable sharing of reference buffers between decoder 238 and application */ 239 UWORD32 u4_share_disp_buf; 240 241 /** 242 * Flag to enable/disable deinterlacing 243 */ 244 UWORD32 u4_deinterlace; 245 246 } impeg2d_init_ip_t; 247 248 typedef struct 249 { 250 ivd_init_op_t s_ivd_init_op_t; 251 } impeg2d_init_op_t; 252 253 /*****************************************************************************/ 254 /* Video Decode */ 255 /*****************************************************************************/ 256 257 typedef struct 258 { 259 ivd_video_decode_ip_t s_ivd_video_decode_ip_t; 260 } impeg2d_video_decode_ip_t; 261 262 typedef struct 263 { 264 ivd_video_decode_op_t s_ivd_video_decode_op_t; 265 } impeg2d_video_decode_op_t; 266 267 /*****************************************************************************/ 268 /* Get Display Frame */ 269 /*****************************************************************************/ 270 271 typedef struct 272 { 273 ivd_get_display_frame_ip_t s_ivd_get_display_frame_ip_t; 274 } impeg2d_get_display_frame_ip_t; 275 276 typedef struct 277 { 278 ivd_get_display_frame_op_t s_ivd_get_display_frame_op_t; 279 } impeg2d_get_display_frame_op_t; 280 281 /*****************************************************************************/ 282 /* Set Display Frame */ 283 /*****************************************************************************/ 284 typedef struct 285 { 286 ivd_set_display_frame_ip_t s_ivd_set_display_frame_ip_t; 287 } impeg2d_set_display_frame_ip_t; 288 289 typedef struct 290 { 291 ivd_set_display_frame_op_t s_ivd_set_display_frame_op_t; 292 } impeg2d_set_display_frame_op_t; 293 294 /*****************************************************************************/ 295 /* Release Display Buffers */ 296 /*****************************************************************************/ 297 298 typedef struct 299 { 300 ivd_rel_display_frame_ip_t s_ivd_rel_display_frame_ip_t; 301 } impeg2d_rel_display_frame_ip_t; 302 303 typedef struct 304 { 305 ivd_rel_display_frame_op_t s_ivd_rel_display_frame_op_t; 306 } impeg2d_rel_display_frame_op_t; 307 308 /*****************************************************************************/ 309 /* Video control Flush */ 310 /*****************************************************************************/ 311 312 typedef struct 313 { 314 ivd_ctl_flush_ip_t s_ivd_ctl_flush_ip_t; 315 } impeg2d_ctl_flush_ip_t; 316 317 typedef struct 318 { 319 ivd_ctl_flush_op_t s_ivd_ctl_flush_op_t; 320 } impeg2d_ctl_flush_op_t; 321 322 /*****************************************************************************/ 323 /* Video control reset */ 324 /*****************************************************************************/ 325 326 typedef struct 327 { 328 ivd_ctl_reset_ip_t s_ivd_ctl_reset_ip_t; 329 } impeg2d_ctl_reset_ip_t; 330 331 typedef struct 332 { 333 ivd_ctl_reset_op_t s_ivd_ctl_reset_op_t; 334 } impeg2d_ctl_reset_op_t; 335 336 /*****************************************************************************/ 337 /* Video control Set Params */ 338 /*****************************************************************************/ 339 340 typedef struct 341 { 342 ivd_ctl_set_config_ip_t s_ivd_ctl_set_config_ip_t; 343 } impeg2d_ctl_set_config_ip_t; 344 345 typedef struct 346 { 347 ivd_ctl_set_config_op_t s_ivd_ctl_set_config_op_t; 348 } impeg2d_ctl_set_config_op_t; 349 350 /*****************************************************************************/ 351 /* Video control:Get Buf Info */ 352 /*****************************************************************************/ 353 354 typedef struct 355 { 356 ivd_ctl_getbufinfo_ip_t s_ivd_ctl_getbufinfo_ip_t; 357 } impeg2d_ctl_getbufinfo_ip_t; 358 359 typedef struct 360 { 361 ivd_ctl_getbufinfo_op_t s_ivd_ctl_getbufinfo_op_t; 362 } impeg2d_ctl_getbufinfo_op_t; 363 364 /*****************************************************************************/ 365 /* Video control:Getstatus Call */ 366 /*****************************************************************************/ 367 368 typedef struct 369 { 370 ivd_ctl_getstatus_ip_t s_ivd_ctl_getstatus_ip_t; 371 } impeg2d_ctl_getstatus_ip_t; 372 373 typedef struct 374 { 375 ivd_ctl_getstatus_op_t s_ivd_ctl_getstatus_op_t; 376 } impeg2d_ctl_getstatus_op_t; 377 378 /*****************************************************************************/ 379 /* Video control:Get Version Info */ 380 /*****************************************************************************/ 381 382 typedef struct 383 { 384 ivd_ctl_getversioninfo_ip_t s_ivd_ctl_getversioninfo_ip_t; 385 } impeg2d_ctl_getversioninfo_ip_t; 386 387 typedef struct 388 { 389 ivd_ctl_getversioninfo_op_t s_ivd_ctl_getversioninfo_op_t; 390 } impeg2d_ctl_getversioninfo_op_t; 391 392 /*****************************************************************************/ 393 /* Video control:Disable Qpel */ 394 /*****************************************************************************/ 395 396 typedef struct 397 { 398 UWORD32 u4_size; 399 IVD_API_COMMAND_TYPE_T e_cmd; 400 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 401 UWORD32 u4_num_cores; 402 } impeg2d_ctl_set_num_cores_ip_t; 403 404 typedef struct 405 { 406 UWORD32 u4_size; 407 UWORD32 u4_error_code; 408 } impeg2d_ctl_set_num_cores_op_t; 409 410 typedef struct 411 { 412 /** 413 * size 414 */ 415 UWORD32 u4_size; 416 /** 417 * cmd 418 */ 419 IVD_API_COMMAND_TYPE_T e_cmd; 420 /** 421 * sub cmd 422 */ 423 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 424 /** 425 * Processor type 426 */ 427 UWORD32 u4_arch; 428 /** 429 * SOC type 430 */ 431 UWORD32 u4_soc; 432 433 /** 434 * num_cores 435 */ 436 UWORD32 u4_num_cores; 437 438 } impeg2d_ctl_set_processor_ip_t; 439 440 typedef struct 441 { 442 /** 443 * size 444 */ 445 UWORD32 u4_size; 446 /** 447 * error_code 448 */ 449 UWORD32 u4_error_code; 450 } impeg2d_ctl_set_processor_op_t; 451 452 typedef struct 453 { 454 455 /** 456 * size 457 */ 458 UWORD32 u4_size; 459 460 /** 461 * cmd 462 */ 463 IVD_API_COMMAND_TYPE_T e_cmd; 464 465 /** 466 * sub cmd 467 */ 468 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 469 } impeg2d_ctl_get_frame_dimensions_ip_t; 470 471 typedef struct 472 { 473 474 /** 475 * size 476 */ 477 UWORD32 u4_size; 478 479 /** 480 * error_code 481 */ 482 UWORD32 u4_error_code; 483 484 /** 485 * x_offset[3] 486 */ 487 UWORD32 u4_x_offset[3]; 488 489 /** 490 * y_offset[3] 491 */ 492 UWORD32 u4_y_offset[3]; 493 494 /** 495 * disp_wd[3] 496 */ 497 UWORD32 u4_disp_wd[3]; 498 499 /** 500 * disp_ht[3] 501 */ 502 UWORD32 u4_disp_ht[3]; 503 504 /** 505 * buffer_wd[3] 506 */ 507 UWORD32 u4_buffer_wd[3]; 508 509 /** 510 * buffer_ht[3] 511 */ 512 UWORD32 u4_buffer_ht[3]; 513 } impeg2d_ctl_get_frame_dimensions_op_t; 514 515 typedef struct 516 { 517 /** 518 * size 519 */ 520 UWORD32 u4_size; 521 522 /** 523 * cmd 524 */ 525 IVD_API_COMMAND_TYPE_T e_cmd; 526 527 /** 528 * sub cmd 529 */ 530 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 531 } impeg2d_ctl_get_seq_info_ip_t; 532 533 typedef struct 534 { 535 /** 536 * size 537 */ 538 UWORD32 u4_size; 539 540 /** 541 * error_code 542 */ 543 UWORD32 u4_error_code; 544 545 /** 546 * aspect_ratio_information 547 */ 548 UWORD8 u1_aspect_ratio_information; 549 550 /** 551 * frame_rate_code 552 */ 553 UWORD8 u1_frame_rate_code; 554 555 /** 556 * frame_rate_extension_n 557 */ 558 UWORD8 u1_frame_rate_extension_n; 559 560 /** 561 * frame_rate_extension_d 562 */ 563 UWORD8 u1_frame_rate_extension_d; 564 565 /** 566 * video_format 567 */ 568 UWORD8 u1_video_format; 569 570 /** 571 * colour_primaries 572 */ 573 UWORD8 u1_colour_primaries; 574 575 /** 576 * transfer_characteristics 577 */ 578 UWORD8 u1_transfer_characteristics; 579 580 /** 581 * matrix_coefficients 582 */ 583 UWORD8 u1_matrix_coefficients; 584 585 /** 586 * display_horizontal_size 587 */ 588 UWORD16 u2_display_horizontal_size; 589 590 /** 591 * display_vertical_size 592 */ 593 UWORD16 u2_display_vertical_size; 594 595 } impeg2d_ctl_get_seq_info_op_t; 596 #ifdef __cplusplus 597 } /* closing brace for extern "C" */ 598 #endif 599 600 #endif /* __IMPEG2D_H__ */ 601