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 /** 210 * enabling threads 211 */ 212 UWORD32 u4_keep_threads_active; 213 214 } impeg2d_fill_mem_rec_ip_t; 215 216 typedef struct 217 { 218 iv_fill_mem_rec_op_t s_ivd_fill_mem_rec_op_t; 219 } impeg2d_fill_mem_rec_op_t; 220 221 /*****************************************************************************/ 222 /* Retrieve Memory Records */ 223 /*****************************************************************************/ 224 225 typedef struct 226 { 227 iv_retrieve_mem_rec_ip_t s_ivd_retrieve_mem_rec_ip_t; 228 } impeg2d_retrieve_mem_rec_ip_t; 229 230 typedef struct 231 { 232 iv_retrieve_mem_rec_op_t s_ivd_retrieve_mem_rec_op_t; 233 } impeg2d_retrieve_mem_rec_op_t; 234 235 /*****************************************************************************/ 236 /* Initialize decoder */ 237 /*****************************************************************************/ 238 239 typedef struct 240 { 241 ivd_init_ip_t s_ivd_init_ip_t; 242 /* Flag to enable sharing of reference buffers between decoder 243 and application */ 244 UWORD32 u4_share_disp_buf; 245 246 /** 247 * Flag to enable/disable deinterlacing 248 */ 249 UWORD32 u4_deinterlace; 250 251 /** 252 * enable_threads 253 */ 254 UWORD32 u4_keep_threads_active; 255 256 } impeg2d_init_ip_t; 257 258 typedef struct 259 { 260 ivd_init_op_t s_ivd_init_op_t; 261 } impeg2d_init_op_t; 262 263 /*****************************************************************************/ 264 /* Video Decode */ 265 /*****************************************************************************/ 266 267 typedef struct 268 { 269 ivd_video_decode_ip_t s_ivd_video_decode_ip_t; 270 } impeg2d_video_decode_ip_t; 271 272 typedef struct 273 { 274 ivd_video_decode_op_t s_ivd_video_decode_op_t; 275 } impeg2d_video_decode_op_t; 276 277 /*****************************************************************************/ 278 /* Get Display Frame */ 279 /*****************************************************************************/ 280 281 typedef struct 282 { 283 ivd_get_display_frame_ip_t s_ivd_get_display_frame_ip_t; 284 } impeg2d_get_display_frame_ip_t; 285 286 typedef struct 287 { 288 ivd_get_display_frame_op_t s_ivd_get_display_frame_op_t; 289 } impeg2d_get_display_frame_op_t; 290 291 /*****************************************************************************/ 292 /* Set Display Frame */ 293 /*****************************************************************************/ 294 typedef struct 295 { 296 ivd_set_display_frame_ip_t s_ivd_set_display_frame_ip_t; 297 } impeg2d_set_display_frame_ip_t; 298 299 typedef struct 300 { 301 ivd_set_display_frame_op_t s_ivd_set_display_frame_op_t; 302 } impeg2d_set_display_frame_op_t; 303 304 /*****************************************************************************/ 305 /* Release Display Buffers */ 306 /*****************************************************************************/ 307 308 typedef struct 309 { 310 ivd_rel_display_frame_ip_t s_ivd_rel_display_frame_ip_t; 311 } impeg2d_rel_display_frame_ip_t; 312 313 typedef struct 314 { 315 ivd_rel_display_frame_op_t s_ivd_rel_display_frame_op_t; 316 } impeg2d_rel_display_frame_op_t; 317 318 /*****************************************************************************/ 319 /* Video control Flush */ 320 /*****************************************************************************/ 321 322 typedef struct 323 { 324 ivd_ctl_flush_ip_t s_ivd_ctl_flush_ip_t; 325 } impeg2d_ctl_flush_ip_t; 326 327 typedef struct 328 { 329 ivd_ctl_flush_op_t s_ivd_ctl_flush_op_t; 330 } impeg2d_ctl_flush_op_t; 331 332 /*****************************************************************************/ 333 /* Video control reset */ 334 /*****************************************************************************/ 335 336 typedef struct 337 { 338 ivd_ctl_reset_ip_t s_ivd_ctl_reset_ip_t; 339 } impeg2d_ctl_reset_ip_t; 340 341 typedef struct 342 { 343 ivd_ctl_reset_op_t s_ivd_ctl_reset_op_t; 344 } impeg2d_ctl_reset_op_t; 345 346 /*****************************************************************************/ 347 /* Video control Set Params */ 348 /*****************************************************************************/ 349 350 typedef struct 351 { 352 ivd_ctl_set_config_ip_t s_ivd_ctl_set_config_ip_t; 353 } impeg2d_ctl_set_config_ip_t; 354 355 typedef struct 356 { 357 ivd_ctl_set_config_op_t s_ivd_ctl_set_config_op_t; 358 } impeg2d_ctl_set_config_op_t; 359 360 /*****************************************************************************/ 361 /* Video control:Get Buf Info */ 362 /*****************************************************************************/ 363 364 typedef struct 365 { 366 ivd_ctl_getbufinfo_ip_t s_ivd_ctl_getbufinfo_ip_t; 367 } impeg2d_ctl_getbufinfo_ip_t; 368 369 typedef struct 370 { 371 ivd_ctl_getbufinfo_op_t s_ivd_ctl_getbufinfo_op_t; 372 } impeg2d_ctl_getbufinfo_op_t; 373 374 /*****************************************************************************/ 375 /* Video control:Getstatus Call */ 376 /*****************************************************************************/ 377 378 typedef struct 379 { 380 ivd_ctl_getstatus_ip_t s_ivd_ctl_getstatus_ip_t; 381 } impeg2d_ctl_getstatus_ip_t; 382 383 typedef struct 384 { 385 ivd_ctl_getstatus_op_t s_ivd_ctl_getstatus_op_t; 386 } impeg2d_ctl_getstatus_op_t; 387 388 /*****************************************************************************/ 389 /* Video control:Get Version Info */ 390 /*****************************************************************************/ 391 392 typedef struct 393 { 394 ivd_ctl_getversioninfo_ip_t s_ivd_ctl_getversioninfo_ip_t; 395 } impeg2d_ctl_getversioninfo_ip_t; 396 397 typedef struct 398 { 399 ivd_ctl_getversioninfo_op_t s_ivd_ctl_getversioninfo_op_t; 400 } impeg2d_ctl_getversioninfo_op_t; 401 402 /*****************************************************************************/ 403 /* Video control:Disable Qpel */ 404 /*****************************************************************************/ 405 406 typedef struct 407 { 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 } impeg2d_ctl_set_num_cores_ip_t; 413 414 typedef struct 415 { 416 UWORD32 u4_size; 417 UWORD32 u4_error_code; 418 } impeg2d_ctl_set_num_cores_op_t; 419 420 typedef struct 421 { 422 /** 423 * size 424 */ 425 UWORD32 u4_size; 426 /** 427 * cmd 428 */ 429 IVD_API_COMMAND_TYPE_T e_cmd; 430 /** 431 * sub cmd 432 */ 433 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 434 /** 435 * Processor type 436 */ 437 UWORD32 u4_arch; 438 /** 439 * SOC type 440 */ 441 UWORD32 u4_soc; 442 443 /** 444 * num_cores 445 */ 446 UWORD32 u4_num_cores; 447 448 } impeg2d_ctl_set_processor_ip_t; 449 450 typedef struct 451 { 452 /** 453 * size 454 */ 455 UWORD32 u4_size; 456 /** 457 * error_code 458 */ 459 UWORD32 u4_error_code; 460 } impeg2d_ctl_set_processor_op_t; 461 462 typedef struct 463 { 464 465 /** 466 * size 467 */ 468 UWORD32 u4_size; 469 470 /** 471 * cmd 472 */ 473 IVD_API_COMMAND_TYPE_T e_cmd; 474 475 /** 476 * sub cmd 477 */ 478 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 479 } impeg2d_ctl_get_frame_dimensions_ip_t; 480 481 typedef struct 482 { 483 484 /** 485 * size 486 */ 487 UWORD32 u4_size; 488 489 /** 490 * error_code 491 */ 492 UWORD32 u4_error_code; 493 494 /** 495 * x_offset[3] 496 */ 497 UWORD32 u4_x_offset[3]; 498 499 /** 500 * y_offset[3] 501 */ 502 UWORD32 u4_y_offset[3]; 503 504 /** 505 * disp_wd[3] 506 */ 507 UWORD32 u4_disp_wd[3]; 508 509 /** 510 * disp_ht[3] 511 */ 512 UWORD32 u4_disp_ht[3]; 513 514 /** 515 * buffer_wd[3] 516 */ 517 UWORD32 u4_buffer_wd[3]; 518 519 /** 520 * buffer_ht[3] 521 */ 522 UWORD32 u4_buffer_ht[3]; 523 } impeg2d_ctl_get_frame_dimensions_op_t; 524 525 typedef struct 526 { 527 /** 528 * size 529 */ 530 UWORD32 u4_size; 531 532 /** 533 * cmd 534 */ 535 IVD_API_COMMAND_TYPE_T e_cmd; 536 537 /** 538 * sub cmd 539 */ 540 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 541 } impeg2d_ctl_get_seq_info_ip_t; 542 543 typedef struct 544 { 545 /** 546 * size 547 */ 548 UWORD32 u4_size; 549 550 /** 551 * error_code 552 */ 553 UWORD32 u4_error_code; 554 555 /** 556 * aspect_ratio_information 557 */ 558 UWORD8 u1_aspect_ratio_information; 559 560 /** 561 * frame_rate_code 562 */ 563 UWORD8 u1_frame_rate_code; 564 565 /** 566 * frame_rate_extension_n 567 */ 568 UWORD8 u1_frame_rate_extension_n; 569 570 /** 571 * frame_rate_extension_d 572 */ 573 UWORD8 u1_frame_rate_extension_d; 574 575 /** 576 * video_format 577 */ 578 UWORD8 u1_video_format; 579 580 /** 581 * colour_primaries 582 */ 583 UWORD8 u1_colour_primaries; 584 585 /** 586 * transfer_characteristics 587 */ 588 UWORD8 u1_transfer_characteristics; 589 590 /** 591 * matrix_coefficients 592 */ 593 UWORD8 u1_matrix_coefficients; 594 595 /** 596 * display_horizontal_size 597 */ 598 UWORD16 u2_display_horizontal_size; 599 600 /** 601 * display_vertical_size 602 */ 603 UWORD16 u2_display_vertical_size; 604 605 } impeg2d_ctl_get_seq_info_op_t; 606 #ifdef __cplusplus 607 } /* closing brace for extern "C" */ 608 #endif 609 610 #endif /* __IMPEG2D_H__ */ 611