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 203 /** Get SEI MDCV parameters */ 204 IH264D_CMD_CTL_GET_SEI_MDCV_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x301, 205 206 /** Get SEI CLL parameters */ 207 IH264D_CMD_CTL_GET_SEI_CLL_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x302, 208 209 /** Get SEI AVE parameters */ 210 IH264D_CMD_CTL_GET_SEI_AVE_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x303, 211 212 /** Get SEI CCV parameters */ 213 IH264D_CMD_CTL_GET_SEI_CCV_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x304 214 215 }IH264D_CMD_CTL_SUB_CMDS; 216 /*****************************************************************************/ 217 /* Video control Flush */ 218 /*****************************************************************************/ 219 220 221 typedef struct{ 222 ivd_ctl_flush_ip_t s_ivd_ctl_flush_ip_t; 223 }ih264d_ctl_flush_ip_t; 224 225 226 typedef struct{ 227 ivd_ctl_flush_op_t s_ivd_ctl_flush_op_t; 228 }ih264d_ctl_flush_op_t; 229 230 /*****************************************************************************/ 231 /* Video control reset */ 232 /*****************************************************************************/ 233 234 235 typedef struct{ 236 ivd_ctl_reset_ip_t s_ivd_ctl_reset_ip_t; 237 }ih264d_ctl_reset_ip_t; 238 239 240 typedef struct{ 241 ivd_ctl_reset_op_t s_ivd_ctl_reset_op_t; 242 }ih264d_ctl_reset_op_t; 243 244 245 /*****************************************************************************/ 246 /* Video control Set Params */ 247 /*****************************************************************************/ 248 249 250 typedef struct { 251 ivd_ctl_set_config_ip_t s_ivd_ctl_set_config_ip_t; 252 }ih264d_ctl_set_config_ip_t; 253 254 255 typedef struct{ 256 ivd_ctl_set_config_op_t s_ivd_ctl_set_config_op_t; 257 }ih264d_ctl_set_config_op_t; 258 259 /*****************************************************************************/ 260 /* Video control:Get Buf Info */ 261 /*****************************************************************************/ 262 263 264 typedef struct{ 265 ivd_ctl_getbufinfo_ip_t s_ivd_ctl_getbufinfo_ip_t; 266 }ih264d_ctl_getbufinfo_ip_t; 267 268 269 270 typedef struct{ 271 ivd_ctl_getbufinfo_op_t s_ivd_ctl_getbufinfo_op_t; 272 }ih264d_ctl_getbufinfo_op_t; 273 274 275 /*****************************************************************************/ 276 /* Video control:Getstatus Call */ 277 /*****************************************************************************/ 278 279 280 typedef struct{ 281 ivd_ctl_getstatus_ip_t s_ivd_ctl_getstatus_ip_t; 282 }ih264d_ctl_getstatus_ip_t; 283 284 285 286 typedef struct{ 287 ivd_ctl_getstatus_op_t s_ivd_ctl_getstatus_op_t; 288 }ih264d_ctl_getstatus_op_t; 289 290 291 /*****************************************************************************/ 292 /* Video control:Get Version Info */ 293 /*****************************************************************************/ 294 295 296 typedef struct{ 297 ivd_ctl_getversioninfo_ip_t s_ivd_ctl_getversioninfo_ip_t; 298 }ih264d_ctl_getversioninfo_ip_t; 299 300 301 302 typedef struct{ 303 ivd_ctl_getversioninfo_op_t s_ivd_ctl_getversioninfo_op_t; 304 }ih264d_ctl_getversioninfo_op_t; 305 306 typedef struct{ 307 308 /** 309 * u4_size 310 */ 311 UWORD32 u4_size; 312 313 /** 314 * cmd 315 */ 316 IVD_API_COMMAND_TYPE_T e_cmd; 317 318 /** 319 * sub_cmd 320 */ 321 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 322 323 /** 324 * Pictures that are are degraded 325 * 0 : No degrade 326 * 1 : Only on non-reference frames 327 * 2 : Use interval specified by u4_nondegrade_interval 328 * 3 : All non-key frames 329 * 4 : All frames 330 */ 331 WORD32 i4_degrade_pics; 332 333 /** 334 * Interval for pictures which are completely decoded without any degradation 335 */ 336 WORD32 i4_nondegrade_interval; 337 338 /** 339 * bit position (lsb is zero): Type of degradation 340 * 1 : Disable deblocking 341 * 2 : Faster inter prediction filters 342 * 3 : Fastest inter prediction filters 343 */ 344 WORD32 i4_degrade_type; 345 346 }ih264d_ctl_degrade_ip_t; 347 348 typedef struct 349 { 350 /** 351 * u4_size 352 */ 353 UWORD32 u4_size; 354 355 /** 356 * error_code 357 */ 358 UWORD32 u4_error_code; 359 }ih264d_ctl_degrade_op_t; 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_disable_deblk_level; 366 }ih264d_ctl_disable_deblock_ip_t; 367 368 typedef struct{ 369 UWORD32 u4_size; 370 UWORD32 u4_error_code; 371 }ih264d_ctl_disable_deblock_op_t; 372 373 374 typedef struct{ 375 UWORD32 u4_size; 376 IVD_API_COMMAND_TYPE_T e_cmd; 377 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 378 UWORD32 u4_num_cores; 379 }ih264d_ctl_set_num_cores_ip_t; 380 381 typedef struct{ 382 UWORD32 u4_size; 383 UWORD32 u4_error_code; 384 }ih264d_ctl_set_num_cores_op_t; 385 386 typedef struct 387 { 388 /** 389 * i4_size 390 */ 391 UWORD32 u4_size; 392 /** 393 * cmd 394 */ 395 IVD_API_COMMAND_TYPE_T e_cmd; 396 /** 397 * sub cmd 398 */ 399 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 400 /** 401 * Processor type 402 */ 403 UWORD32 u4_arch; 404 /** 405 * SOC type 406 */ 407 UWORD32 u4_soc; 408 409 /** 410 * num_cores 411 */ 412 UWORD32 u4_num_cores; 413 414 }ih264d_ctl_set_processor_ip_t; 415 416 typedef struct 417 { 418 /** 419 * i4_size 420 */ 421 UWORD32 u4_size; 422 /** 423 * error_code 424 */ 425 UWORD32 u4_error_code; 426 }ih264d_ctl_set_processor_op_t; 427 428 typedef struct{ 429 UWORD32 u4_size; 430 IVD_API_COMMAND_TYPE_T e_cmd; 431 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 432 }ih264d_ctl_get_frame_dimensions_ip_t; 433 434 435 typedef struct{ 436 UWORD32 u4_size; 437 UWORD32 u4_error_code; 438 UWORD32 u4_x_offset[3]; 439 UWORD32 u4_y_offset[3]; 440 UWORD32 u4_disp_wd[3]; 441 UWORD32 u4_disp_ht[3]; 442 UWORD32 u4_buffer_wd[3]; 443 UWORD32 u4_buffer_ht[3]; 444 }ih264d_ctl_get_frame_dimensions_op_t; 445 446 typedef struct 447 { 448 UWORD32 u4_size; 449 IVD_API_COMMAND_TYPE_T e_cmd; 450 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 451 }ih264d_ctl_get_vui_params_ip_t; 452 453 typedef struct 454 { 455 UWORD32 u4_size; 456 UWORD32 u4_error_code; 457 UWORD8 u1_aspect_ratio_idc; 458 UWORD16 u2_sar_width; 459 UWORD16 u2_sar_height; 460 UWORD8 u1_overscan_appropriate_flag; 461 UWORD8 u1_video_format; 462 UWORD8 u1_video_full_range_flag; 463 UWORD8 u1_colour_primaries; 464 UWORD8 u1_tfr_chars; 465 UWORD8 u1_matrix_coeffs; 466 UWORD8 u1_cr_top_field; 467 UWORD8 u1_cr_bottom_field; 468 UWORD32 u4_num_units_in_tick; 469 UWORD32 u4_time_scale; 470 UWORD8 u1_fixed_frame_rate_flag; 471 UWORD8 u1_nal_hrd_params_present; 472 UWORD8 u1_vcl_hrd_params_present; 473 UWORD8 u1_low_delay_hrd_flag; 474 UWORD8 u1_pic_struct_present_flag; 475 UWORD8 u1_bitstream_restriction_flag; 476 UWORD8 u1_mv_over_pic_boundaries_flag; 477 UWORD32 u4_max_bytes_per_pic_denom; 478 UWORD32 u4_max_bits_per_mb_denom; 479 UWORD32 u4_log2_max_mv_length_horz; 480 UWORD32 u4_log2_max_mv_length_vert; 481 UWORD32 u4_num_reorder_frames; 482 UWORD32 u4_max_dec_frame_buffering; 483 }ih264d_ctl_get_vui_params_op_t; 484 485 486 typedef struct 487 { 488 /** 489 * u4_size 490 */ 491 UWORD32 u4_size; 492 493 /** 494 * cmd 495 */ 496 IVD_API_COMMAND_TYPE_T e_cmd; 497 498 /** 499 * sub_cmd 500 */ 501 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 502 }ih264d_ctl_get_sei_mdcv_params_ip_t; 503 504 typedef struct 505 { 506 /** 507 * u4_size 508 */ 509 UWORD32 u4_size; 510 511 /** 512 * error_code 513 */ 514 UWORD32 u4_error_code; 515 516 /** 517 * Array to store the display_primaries_x values 518 */ 519 UWORD16 au2_display_primaries_x[NUM_SEI_MDCV_PRIMARIES]; 520 521 /** 522 * Array to store the display_primaries_y values 523 */ 524 UWORD16 au2_display_primaries_y[NUM_SEI_MDCV_PRIMARIES]; 525 526 /** 527 * Variable to store the white point x value 528 */ 529 UWORD16 u2_white_point_x; 530 531 /** 532 * Variable to store the white point y value 533 */ 534 UWORD16 u2_white_point_y; 535 536 /** 537 * Variable to store the max display mastering luminance value 538 */ 539 UWORD32 u4_max_display_mastering_luminance; 540 541 /** 542 * Variable to store the min display mastering luminance value 543 */ 544 UWORD32 u4_min_display_mastering_luminance; 545 }ih264d_ctl_get_sei_mdcv_params_op_t; 546 547 typedef struct 548 { 549 /** 550 * u4_size 551 */ 552 UWORD32 u4_size; 553 554 /** 555 * cmd 556 */ 557 IVD_API_COMMAND_TYPE_T e_cmd; 558 559 /** 560 * sub_cmd 561 */ 562 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 563 }ih264d_ctl_get_sei_cll_params_ip_t; 564 565 typedef struct 566 { 567 /** 568 * u4_size 569 */ 570 UWORD32 u4_size; 571 572 /** 573 * error_code 574 */ 575 UWORD32 u4_error_code; 576 577 /** 578 * The maximum pixel intensity of all samples 579 */ 580 UWORD16 u2_max_content_light_level; 581 582 /** 583 * The average pixel intensity of all samples 584 */ 585 UWORD16 u2_max_pic_average_light_level; 586 } ih264d_ctl_get_sei_cll_params_op_t; 587 588 typedef struct 589 { 590 /** 591 * u4_size 592 */ 593 UWORD32 u4_size; 594 595 /** 596 * cmd 597 */ 598 IVD_API_COMMAND_TYPE_T e_cmd; 599 600 /** 601 * sub_cmd 602 */ 603 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 604 }ih264d_ctl_get_sei_ave_params_ip_t; 605 606 typedef struct 607 { 608 /** 609 * u4_size 610 */ 611 UWORD32 u4_size; 612 613 /** 614 * error_code 615 */ 616 UWORD32 u4_error_code; 617 618 /** 619 * specifies the environmental illluminance of the ambient viewing environment 620 */ 621 UWORD32 u4_ambient_illuminance; 622 623 /* 624 * specify the normalized x chromaticity coordinates of the 625 * environmental ambient light in the nominal viewing environment 626 */ 627 UWORD16 u2_ambient_light_x; 628 629 /* 630 * specify the normalized y chromaticity coordinates of the 631 * environmental ambient light in the nominal viewing environment 632 */ 633 UWORD16 u2_ambient_light_y; 634 } ih264d_ctl_get_sei_ave_params_op_t; 635 636 typedef struct 637 { 638 /** 639 * u4_size 640 */ 641 UWORD32 u4_size; 642 643 /** 644 * cmd 645 */ 646 IVD_API_COMMAND_TYPE_T e_cmd; 647 648 /** 649 * sub_cmd 650 */ 651 IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd; 652 }ih264d_ctl_get_sei_ccv_params_ip_t; 653 654 typedef struct 655 { 656 /** 657 * u4_size 658 */ 659 UWORD32 u4_size; 660 661 /** 662 * error_code 663 */ 664 UWORD32 u4_error_code; 665 666 /* 667 * Flag used to control persistence of CCV SEI messages 668 */ 669 UWORD8 u1_ccv_cancel_flag; 670 671 /* 672 * specifies the persistence of the CCV SEI message for the current layer 673 */ 674 UWORD8 u1_ccv_persistence_flag; 675 676 /* 677 * specifies the presence of syntax elements ccv_primaries_x and ccv_primaries_y 678 */ 679 UWORD8 u1_ccv_primaries_present_flag; 680 681 /* 682 * specifies that the syntax element ccv_min_luminance_value is present 683 */ 684 UWORD8 u1_ccv_min_luminance_value_present_flag; 685 686 /* 687 * specifies that the syntax element ccv_max_luminance_value is present 688 */ 689 UWORD8 u1_ccv_max_luminance_value_present_flag; 690 691 /* 692 * specifies that the syntax element ccv_avg_luminance_value is present 693 */ 694 UWORD8 u1_ccv_avg_luminance_value_present_flag; 695 696 /* 697 * shall be equal to 0 in bitstreams conforming to this version. Other values 698 * for reserved_zero_2bits are reserved for future use 699 */ 700 UWORD8 u1_ccv_reserved_zero_2bits; 701 702 /* 703 * specify the normalized x chromaticity coordinates of the colour 704 * primary component c of the nominal content colour volume 705 */ 706 WORD32 ai4_ccv_primaries_x[NUM_SEI_CCV_PRIMARIES]; 707 708 /* 709 * specify the normalized y chromaticity coordinates of the colour 710 * primary component c of the nominal content colour volume 711 */ 712 WORD32 ai4_ccv_primaries_y[NUM_SEI_CCV_PRIMARIES]; 713 714 /* 715 * specifies the normalized minimum luminance value 716 */ 717 UWORD32 u4_ccv_min_luminance_value; 718 719 /* 720 * specifies the normalized maximum luminance value 721 */ 722 UWORD32 u4_ccv_max_luminance_value; 723 724 /* 725 * specifies the normalized average luminance value 726 */ 727 UWORD32 u4_ccv_avg_luminance_value; 728 } ih264d_ctl_get_sei_ccv_params_op_t; 729 730 731 #ifdef __cplusplus 732 } /* closing brace for extern "C" */ 733 #endif 734 #endif /* _IH264D_H_ */ 735