| Harish Mahendrakar | 0d8951c | 2014-05-16 10:31:13 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore |
| 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 | |
| 19 | /** |
| 20 | ******************************************************************************* |
| 21 | * @file |
| 22 | * ihevcd_structs.h |
| 23 | * |
| 24 | * @brief |
| 25 | * Structure definitions used in the decoder |
| 26 | * |
| 27 | * @author |
| 28 | * Harish |
| 29 | * |
| 30 | * @par List of Functions: |
| 31 | * |
| 32 | * @remarks |
| 33 | * None |
| 34 | * |
| 35 | ******************************************************************************* |
| 36 | */ |
| 37 | |
| 38 | #ifndef _IHEVCD_STRUCTS_H_ |
| 39 | #define _IHEVCD_STRUCTS_H_ |
| 40 | typedef enum |
| 41 | { |
| 42 | INIT_DONE, HEADER_DONE, FIRST_FRAME_DONE, |
| 43 | }CODEC_STATE_T; |
| 44 | |
| 45 | |
| 46 | |
| 47 | typedef struct _codec_t codec_t; |
| 48 | |
| 49 | /** Structure to hold format conversion context */ |
| 50 | typedef struct |
| 51 | { |
| 52 | /** Current row for which format conversion should be done */ |
| 53 | WORD32 i4_cur_row; |
| 54 | |
| 55 | /** Number of rows for which format conversion should be done */ |
| 56 | WORD32 i4_num_rows; |
| 57 | }fmt_conv_t; |
| 58 | |
| 59 | /** |
| 60 | * Bitstream structure |
| 61 | */ |
| 62 | typedef struct |
| 63 | { |
| 64 | /** |
| 65 | * Bitstream buffer base pointer |
| 66 | */ |
| 67 | UWORD8 *pu1_buf_base; |
| 68 | |
| 69 | /** |
| 70 | * Bitstream bit offset in current word. Value between 0 and 31 |
| 71 | */ |
| 72 | UWORD32 u4_bit_ofst; |
| 73 | |
| 74 | /** |
| 75 | * Current bitstream buffer pointer |
| 76 | */ |
| 77 | UWORD32 *pu4_buf; |
| 78 | |
| 79 | /** |
| 80 | * Current word |
| 81 | */ |
| 82 | UWORD32 u4_cur_word; |
| 83 | |
| 84 | /** |
| 85 | * Next word |
| 86 | */ |
| 87 | UWORD32 u4_nxt_word; |
| 88 | |
| 89 | /** |
| 90 | * Max address for bitstream |
| 91 | */ |
| 92 | UWORD8 *pu1_buf_max; |
| 93 | }bitstrm_t; |
| 94 | |
| 95 | /** |
| 96 | ****************************************************************************** |
| 97 | * @brief Cabac context for decoder |
| 98 | ****************************************************************************** |
| 99 | */ |
| 100 | typedef struct cab_ctxt |
| 101 | { |
| 102 | /*********************************************************************/ |
| 103 | /* CABAC ENGINE related fields */ |
| 104 | /*********************************************************************/ |
| 105 | /** cabac interval range R */ |
| 106 | UWORD32 u4_range; |
| 107 | |
| 108 | /** cabac interval offset O */ |
| 109 | UWORD32 u4_ofst; |
| 110 | |
| 111 | /*********************************************************************/ |
| 112 | /* CABAC context models */ |
| 113 | /*********************************************************************/ |
| 114 | /** All Context models stored in pscked form pState[bits6-1] | MPS[bit0] */ |
| 115 | UWORD8 au1_ctxt_models[IHEVC_CAB_CTXT_END]; |
| 116 | |
| 117 | /** Context models memorized after decoding 2nd CTB in a row to be used |
| 118 | * during entropy sync cases |
| 119 | */ |
| 120 | UWORD8 au1_ctxt_models_sync[IHEVC_CAB_CTXT_END]; |
| 121 | |
| 122 | }cab_ctxt_t; |
| 123 | |
| 124 | typedef enum |
| 125 | { |
| 126 | CMD_PROCESS, |
| 127 | CMD_FMTCONV, |
| 128 | }JOBQ_CMD_T; |
| 129 | |
| 130 | /** |
| 131 | * Structure to represent a processing job entry |
| 132 | */ |
| 133 | typedef struct |
| 134 | { |
| 135 | /** |
| 136 | * Command |
| 137 | * Currently: PROCESS, FMTCONV are the only two jobs |
| 138 | */ |
| 139 | WORD32 i4_cmd; |
| 140 | /** |
| 141 | * CTB x of the starting CTB |
| 142 | */ |
| 143 | WORD16 i2_ctb_x; |
| 144 | |
| 145 | /** |
| 146 | * CTB y of the starting CTB |
| 147 | */ |
| 148 | |
| 149 | WORD16 i2_ctb_y; |
| 150 | |
| 151 | /** |
| 152 | * Number of CTBs that need to be processed in this job |
| 153 | */ |
| 154 | WORD16 i2_ctb_cnt; |
| 155 | |
| 156 | /** |
| 157 | * Slice index for the current CTB |
| 158 | */ |
| 159 | WORD16 i2_slice_idx; |
| 160 | |
| 161 | /** |
| 162 | * TU coefficient data offset for the current job |
| 163 | */ |
| 164 | WORD32 i4_tu_coeff_data_ofst; |
| 165 | #ifdef GPU_BUILD |
| 166 | /** |
| 167 | * OpenCL Granularity |
| 168 | */ |
| 169 | WORD16 i2_granularity_idx; |
| 170 | |
| 171 | /** |
| 172 | * Index to the process context |
| 173 | */ |
| 174 | //WORD16 i2_proc_idx; |
| 175 | |
| 176 | /** |
| 177 | * GPU Wait or NOT |
| 178 | */ |
| 179 | WORD16 i2_wait; |
| 180 | #endif |
| 181 | }proc_job_t; |
| 182 | /** |
| 183 | * Structure to represent a MV Bank buffer |
| 184 | */ |
| 185 | typedef struct |
| 186 | { |
| 187 | /** |
| 188 | * Pointer to hold PU index for each CTB in a picture |
| 189 | */ |
| 190 | UWORD32 *pu4_pic_pu_idx; |
| 191 | |
| 192 | /** |
| 193 | * Pointer to hold pu_t for each PU in a picture |
| 194 | */ |
| 195 | pu_t *ps_pic_pu; |
| 196 | |
| 197 | /** |
| 198 | * Pointer to hold PU map for each CTB in a picture |
| 199 | */ |
| 200 | UWORD8 *pu1_pic_pu_map; |
| 201 | |
| 202 | /** |
| 203 | * Pointer to hold the Slice map |
| 204 | */ |
| 205 | UWORD16 *pu1_pic_slice_map; |
| 206 | |
| 207 | /** |
| 208 | * Absolute POC for the current MV Bank |
| 209 | */ |
| 210 | WORD32 i4_abs_poc; |
| 211 | |
| 212 | /** |
| 213 | * Absolute POCs of reference List 0 for all slices in the frame from which this frame is reconstructed |
| 214 | */ |
| 215 | WORD32 l0_collocated_poc[MAX_SLICE_SEGMENTS_IN_FRAME][MAX_DPB_SIZE]; |
| 216 | |
| 217 | /** |
| 218 | * Flag to indicate Long Term reference for POCs of reference List 0 for all slices in the frame from which this frame is reconstructed |
| 219 | */ |
| 220 | WORD8 u1_l0_collocated_poc_lt[MAX_SLICE_SEGMENTS_IN_FRAME][MAX_DPB_SIZE]; |
| 221 | |
| 222 | /** |
| 223 | * Absolute POCs of reference List 1 for all slices in the frame from which this frame is reconstructed |
| 224 | */ |
| 225 | WORD32 l1_collocated_poc[MAX_SLICE_SEGMENTS_IN_FRAME][MAX_DPB_SIZE]; |
| 226 | /** |
| 227 | * Flag to indicate Long Term reference for POCs of reference List 1 for all slices in the frame from which this frame is reconstructed |
| 228 | */ |
| 229 | WORD32 u1_l1_collocated_poc_lt[MAX_SLICE_SEGMENTS_IN_FRAME][MAX_DPB_SIZE]; |
| 230 | |
| 231 | }mv_buf_t; |
| 232 | |
| 233 | typedef struct |
| 234 | { |
| 235 | /** |
| 236 | * Pointer to current PPS |
| 237 | */ |
| 238 | pps_t *ps_pps; |
| 239 | |
| 240 | /** |
| 241 | * Pointer to current SPS |
| 242 | */ |
| 243 | sps_t *ps_sps; |
| 244 | |
| 245 | /** |
| 246 | * Pointer to current slice header structure |
| 247 | */ |
| 248 | slice_header_t *ps_slice_hdr; |
| 249 | |
| 250 | /** |
| 251 | * CTB's x position within a picture in raster scan in CTB units |
| 252 | */ |
| 253 | WORD32 i4_ctb_x; |
| 254 | |
| 255 | /** |
| 256 | * CTB's y position within a picture in raster scan in CTB units |
| 257 | */ |
| 258 | |
| 259 | WORD32 i4_ctb_y; |
| 260 | |
| 261 | /** |
| 262 | * Current PU structure - set to CTB pu_t pointer at the start of CTB processing and incremented |
| 263 | * for every TU |
| 264 | */ |
| 265 | pu_t *ps_pu; |
| 266 | |
| 267 | /** |
| 268 | * Pointer to frame level pu_t for the current frame being parsed |
| 269 | * where MVs and Intra pred modes will be updated |
| 270 | */ |
| 271 | pu_t *ps_pic_pu; |
| 272 | |
| 273 | /** |
| 274 | * Store the current tile's information. This is needed for the computation of mvs. |
| 275 | */ |
| 276 | tile_t *ps_tile; |
| 277 | |
| 278 | /** |
| 279 | * Points to an array of PU indices which is used to identify |
| 280 | * start index of pu_t in ps_pic_pu and also to identify number of |
| 281 | * PUs in the current CTB by subtracting current idx from next CTB's |
| 282 | * PU idx |
| 283 | */ |
| 284 | UWORD32 *pu4_pic_pu_idx; |
| 285 | |
| 286 | /** PU Index map per CTB. The indices in this map are w.r.t picture pu array and not |
| 287 | * w.r.t CTB pu array. |
| 288 | * This will be used during mv prediction and since neighbours will have different CTB pu map |
| 289 | * it will be easier if they all have indices w.r.t picture level PU array rather than CTB level |
| 290 | * PU array. |
| 291 | * pu1_pic_pu_map is map w.r.t CTB's pu_t array |
| 292 | */ |
| 293 | UWORD32 *pu4_pic_pu_idx_map; |
| 294 | |
| 295 | /** |
| 296 | * Pointer to pu_map for the current frame being parsed |
| 297 | * where MVs and Intra pred modes will be updated |
| 298 | */ |
| 299 | UWORD8 *pu1_pic_pu_map; |
| 300 | |
| 301 | /** |
| 302 | * PU count in current CTB |
| 303 | */ |
| 304 | WORD32 i4_ctb_pu_cnt; |
| 305 | |
| 306 | /** |
| 307 | * PU count in current CTB |
| 308 | */ |
| 309 | WORD32 i4_ctb_start_pu_idx; |
| 310 | |
| 311 | /** |
| 312 | * Top availability for current CTB level |
| 313 | */ |
| 314 | UWORD8 u1_top_ctb_avail; |
| 315 | |
| 316 | /** |
| 317 | * Top right availability for current CTB level |
| 318 | */ |
| 319 | UWORD8 u1_top_rt_ctb_avail; |
| 320 | /** |
| 321 | * Top left availability for current CTB level |
| 322 | */ |
| 323 | UWORD8 u1_top_lt_ctb_avail; |
| 324 | /** |
| 325 | * left availability for current CTB level |
| 326 | */ |
| 327 | UWORD8 u1_left_ctb_avail; |
| 328 | |
| 329 | }mv_ctxt_t; |
| 330 | |
| 331 | typedef struct |
| 332 | { |
| 333 | /** |
| 334 | * Pointer to current PPS |
| 335 | */ |
| 336 | pps_t *ps_pps; |
| 337 | |
| 338 | /** |
| 339 | * Pointer to current SPS |
| 340 | */ |
| 341 | sps_t *ps_sps; |
| 342 | |
| 343 | /* |
| 344 | * Pointer to codec context |
| 345 | */ |
| 346 | codec_t *ps_codec; |
| 347 | |
| 348 | /** |
| 349 | * Index of the current Tile being parsed |
| 350 | */ |
| 351 | tile_t *ps_tile; |
| 352 | |
| 353 | /** |
| 354 | * Pointer to the current slice header |
| 355 | */ |
| 356 | slice_header_t *ps_slice_hdr; |
| 357 | |
| 358 | /** |
| 359 | * TU count in current CTB |
| 360 | */ |
| 361 | WORD32 i4_ctb_tu_cnt; |
| 362 | |
| 363 | /** |
| 364 | * CTB's x position within a picture in raster scan in CTB units |
| 365 | */ |
| 366 | WORD32 i4_ctb_x; |
| 367 | |
| 368 | /** |
| 369 | * CTB's y position within a picture in raster scan in CTB units |
| 370 | */ |
| 371 | |
| 372 | WORD32 i4_ctb_y; |
| 373 | |
| 374 | /** |
| 375 | * CTB's x position within a Tile in raster scan in CTB units |
| 376 | */ |
| 377 | WORD32 i4_ctb_tile_x; |
| 378 | |
| 379 | /** |
| 380 | * CTB's y position within a Tile in raster scan in CTB units |
| 381 | */ |
| 382 | |
| 383 | WORD32 i4_ctb_tile_y; |
| 384 | |
| 385 | /** |
| 386 | * CTB's x position within a Slice in raster scan in CTB units |
| 387 | */ |
| 388 | WORD32 i4_ctb_slice_x; |
| 389 | |
| 390 | /** |
| 391 | * CTB's y position within a Slice in raster scan in CTB units |
| 392 | */ |
| 393 | |
| 394 | WORD32 i4_ctb_slice_y; |
| 395 | |
| 396 | /* Two bits per edge. |
| 397 | Stored in format. BS[15] | BS[14] | .. |BS[0]*/ |
| 398 | UWORD32 *pu4_pic_vert_bs; |
| 399 | |
| 400 | /** |
| 401 | * Horizontal Boundary strength |
| 402 | */ |
| 403 | |
| 404 | /* Two bits per edge. |
| 405 | Stored in format. BS[15] | BS[14] | .. |BS[0]*/ |
| 406 | UWORD32 *pu4_pic_horz_bs; |
| 407 | |
| 408 | /** |
| 409 | * Flags to indicate if QP is constant through out a CTB - 1 bit for each CTB |
| 410 | * The bits are packed from LSB to MSB |
| 411 | * To get the flag corresponding to CTB with (ctb_x, ctb_y), use |
| 412 | * pu4_qp_const_in_ctb[(ctb_x + pic_wd_in_ctb * ctb_y) >> 3] & (1 << ((ctb_x + pic_wd_in_ctb * ctb_y) & 7)) |
| 413 | */ |
| 414 | UWORD8 *pu1_pic_qp_const_in_ctb; |
| 415 | |
| 416 | /** |
| 417 | * Qp array stored for each 8x8 pixels |
| 418 | */ |
| 419 | UWORD8 *pu1_pic_qp; |
| 420 | |
| 421 | /** |
| 422 | * Current TU structure - set to CTB tu_t pointer at the start of CTB processing and incremented |
| 423 | * for every TU |
| 424 | */ |
| 425 | tu_t *ps_tu; |
| 426 | |
| 427 | /** |
| 428 | * Points to an array of TU indices which is used to identify |
| 429 | * start index of tu_t in ps_pic_tu and also to identify number of |
| 430 | * TUs in the current CTB by subtracting current idx from next CTB's |
| 431 | * TU idx |
| 432 | */ |
| 433 | UWORD32 *pu4_pic_tu_idx; |
| 434 | |
| 435 | /** |
| 436 | * Points to an array of PU indices which is used to identify |
| 437 | * start index of pu_t in ps_pic_pu and also to identify number of |
| 438 | * PUs in the current CTB by subtracting current idx from next CTB's |
| 439 | * PU idx |
| 440 | */ |
| 441 | UWORD32 *pu4_pic_pu_idx; |
| 442 | |
| 443 | /** |
| 444 | * Current PU structure - set to CTB pu_t pointer at the start of CTB processing and incremented |
| 445 | * for every TU |
| 446 | */ |
| 447 | pu_t *ps_pu; |
| 448 | |
| 449 | /** |
| 450 | * Pointer to frame level pu_t for the current frame being parsed |
| 451 | * where MVs and Intra pred modes will be updated |
| 452 | */ |
| 453 | pu_t *ps_pic_pu; |
| 454 | |
| 455 | /** PU Index map per CTB. The indices in this map are w.r.t picture pu array and not |
| 456 | * w.r.t CTB pu array. |
| 457 | * This will be used during mv prediction and since neighbours will have different CTB pu map |
| 458 | * it will be easier if they all have indices w.r.t picture level PU array rather than CTB level |
| 459 | * PU array. |
| 460 | * pu1_pic_pu_map is map w.r.t CTB's pu_t array |
| 461 | */ |
| 462 | UWORD32 *pu4_pic_pu_idx_map; |
| 463 | |
| 464 | /** |
| 465 | * Variable to store the next ctb count to compute pu idx |
| 466 | */ |
| 467 | WORD32 i4_next_pu_ctb_cnt; |
| 468 | |
| 469 | /** |
| 470 | * Variable to store the next ctb count to compute tu idx |
| 471 | */ |
| 472 | WORD32 i4_next_tu_ctb_cnt; |
| 473 | /** |
| 474 | * Points to the array of slice indices which is used to identify the slice |
| 475 | * to which each CTB in a frame belongs. |
| 476 | */ |
| 477 | UWORD16 *pu1_slice_idx; |
| 478 | }bs_ctxt_t; |
| 479 | |
| 480 | typedef struct |
| 481 | { |
| 482 | /** |
| 483 | * Pointer to current PPS |
| 484 | */ |
| 485 | pps_t *ps_pps; |
| 486 | |
| 487 | /** |
| 488 | * Pointer to current SPS |
| 489 | */ |
| 490 | sps_t *ps_sps; |
| 491 | |
| 492 | /* |
| 493 | * Pointer to codec context |
| 494 | */ |
| 495 | codec_t *ps_codec; |
| 496 | |
| 497 | /** |
| 498 | * Pointer to current slice header structure |
| 499 | */ |
| 500 | slice_header_t *ps_slice_hdr; |
| 501 | |
| 502 | /** |
| 503 | * Pointer to the structure that contains BS and QP frame level arrays |
| 504 | */ |
| 505 | bs_ctxt_t s_bs_ctxt; |
| 506 | |
| 507 | /** |
| 508 | * CTB's x position within a picture in raster scan in CTB units |
| 509 | */ |
| 510 | WORD32 i4_ctb_x; |
| 511 | |
| 512 | /** |
| 513 | * CTB's y position within a picture in raster scan in CTB units |
| 514 | */ |
| 515 | |
| 516 | WORD32 i4_ctb_y; |
| 517 | |
| 518 | /** |
| 519 | * Current pictures loop filter flag map at 8x8 level |
| 520 | */ |
| 521 | UWORD8 *pu1_pic_no_loop_filter_flag; |
| 522 | |
| 523 | /** |
| 524 | * Current CTB's no_loop_filter_flags |
| 525 | * each element corresponds to one row - including the left CTB's last 8x8 |
| 526 | */ |
| 527 | UWORD16 au2_ctb_no_loop_filter_flag[9]; |
| 528 | |
| 529 | /* |
| 530 | * Pointer to 0th luma pixel in current pic |
| 531 | */ |
| 532 | UWORD8 *pu1_cur_pic_luma; |
| 533 | |
| 534 | /* |
| 535 | * Pointer to 0th chroma pixel in current pic |
| 536 | */ |
| 537 | UWORD8 *pu1_cur_pic_chroma; |
| 538 | |
| 539 | /* Points to the array of slice indices which is used to identify the slice |
| 540 | * to which each CTB in a frame belongs. |
| 541 | */ |
| 542 | UWORD16 *pu1_slice_idx; |
| 543 | |
| 544 | /* Specifies if the chroma format is yuv420sp_vu */ |
| 545 | WORD32 is_chroma_yuv420sp_vu; |
| 546 | |
| 547 | #ifdef GPU_BUILD |
| 548 | //TODO GPU : Later define it for ARM only version as well |
| 549 | /** |
| 550 | * Pointer to base slice header structure |
| 551 | */ |
| 552 | slice_header_t *ps_slice_hdr_base; |
| 553 | #endif |
| 554 | }deblk_ctxt_t; |
| 555 | |
| 556 | typedef struct |
| 557 | { |
| 558 | /** |
| 559 | * Pointer to current PPS |
| 560 | */ |
| 561 | pps_t *ps_pps; |
| 562 | |
| 563 | /** |
| 564 | * Pointer to current SPS |
| 565 | */ |
| 566 | sps_t *ps_sps; |
| 567 | |
| 568 | /* Pointer to codec context |
| 569 | * |
| 570 | */ |
| 571 | codec_t *ps_codec; |
| 572 | |
| 573 | /** |
| 574 | * Pointer to base slice header structure |
| 575 | */ |
| 576 | slice_header_t *ps_slice_hdr_base; |
| 577 | |
| 578 | /** |
| 579 | * Pointer to current slice header structure |
| 580 | */ |
| 581 | slice_header_t *ps_slice_hdr; |
| 582 | |
| 583 | /** |
| 584 | * Pointer to current tile structure |
| 585 | */ |
| 586 | tile_t *ps_tile; |
| 587 | /** |
| 588 | * CTB's x position within a picture in raster scan in CTB units |
| 589 | */ |
| 590 | WORD32 i4_ctb_x; |
| 591 | |
| 592 | /** |
| 593 | * CTB's y position within a picture in raster scan in CTB units |
| 594 | */ |
| 595 | |
| 596 | WORD32 i4_ctb_y; |
| 597 | |
| 598 | /** |
| 599 | * Current pictures loop filter flag map at 8x8 level |
| 600 | */ |
| 601 | UWORD8 *pu1_pic_no_loop_filter_flag; |
| 602 | |
| 603 | /* |
| 604 | * Pointer to 0th luma pixel in current pic |
| 605 | */ |
| 606 | UWORD8 *pu1_cur_pic_luma; |
| 607 | |
| 608 | /* |
| 609 | * Pointer to 0th chroma pixel in current pic |
| 610 | */ |
| 611 | UWORD8 *pu1_cur_pic_chroma; |
| 612 | |
| 613 | /** |
| 614 | * Pointer to frame level sao_t for the current frame being parsed |
| 615 | */ |
| 616 | sao_t *ps_pic_sao; |
| 617 | |
| 618 | /** |
| 619 | * Temporary buffer needed during SAO processing |
| 620 | */ |
| 621 | UWORD8 *pu1_tmp_buf_luma; |
| 622 | |
| 623 | /** |
| 624 | * Temporary buffer needed during SAO processing |
| 625 | */ |
| 626 | UWORD8 *pu1_tmp_buf_chroma; |
| 627 | |
| 628 | /** |
| 629 | * Left column of luma pixels - used by SAO |
| 630 | */ |
| 631 | UWORD8 *pu1_sao_src_left_luma; |
| 632 | |
| 633 | /** |
| 634 | * Top row of luma pixels - used by SAO |
| 635 | */ |
| 636 | UWORD8 *pu1_sao_src_top_luma; |
| 637 | |
| 638 | /** |
| 639 | * Left column of chroma pixels(interleaved) - used by SAO |
| 640 | */ |
| 641 | UWORD8 *pu1_sao_src_left_chroma; |
| 642 | |
| 643 | /** |
| 644 | * Top row of chroma pixels(interleaved) - used by SAO |
| 645 | */ |
| 646 | UWORD8 *pu1_sao_src_top_chroma; |
| 647 | |
| 648 | /** |
| 649 | * Top-left luma pixel - used by SAO (for the top CTB row) |
| 650 | */ |
| 651 | UWORD8 *pu1_sao_src_luma_top_left_ctb; |
| 652 | |
| 653 | /** |
| 654 | * Top-left chroma pixel(interleaved) - used by SAO (for the top CTB row) |
| 655 | */ |
| 656 | UWORD8 *pu1_sao_src_chroma_top_left_ctb; |
| 657 | |
| 658 | /** |
| 659 | * Top-left luma pixel - used by SAO (for the current CTB row) |
| 660 | */ |
| 661 | UWORD8 *pu1_sao_src_top_left_luma_curr_ctb; |
| 662 | |
| 663 | /** |
| 664 | * Top-left chroma pixel(interleaved) - used by SAO (for the current CTB row) |
| 665 | */ |
| 666 | UWORD8 *pu1_sao_src_top_left_chroma_curr_ctb; |
| 667 | |
| 668 | /** |
| 669 | * Top-right luma pixel - used by SAO (for the top CTB row) |
| 670 | */ |
| 671 | UWORD8 *pu1_sao_src_top_left_luma_top_right; |
| 672 | |
| 673 | /** |
| 674 | * Top-right chroma pixel(interleaved) - used by SAO (for the top CTB row) |
| 675 | */ |
| 676 | UWORD8 *pu1_sao_src_top_left_chroma_top_right; |
| 677 | |
| 678 | /** |
| 679 | * Bottom-left luma pixel - used by SAO |
| 680 | */ |
| 681 | UWORD8 u1_sao_src_top_left_luma_bot_left; |
| 682 | /** |
| 683 | * Pointer to array that stores bottom left luma pixel per row(interleaved) - used by SAO |
| 684 | */ |
| 685 | UWORD8 *pu1_sao_src_top_left_luma_bot_left; |
| 686 | |
| 687 | /** |
| 688 | * Bottom left chroma pixel(interleaved) - used by SAO |
| 689 | */ |
| 690 | UWORD8 au1_sao_src_top_left_chroma_bot_left[2]; |
| 691 | /** |
| 692 | * Pointer to array that stores bottom left chroma pixel per row(interleaved) - used by SAO |
| 693 | */ |
| 694 | UWORD8 *pu1_sao_src_top_left_chroma_bot_left; |
| 695 | |
| 696 | /* |
| 697 | * Slice counter in a picture. |
| 698 | */ |
| 699 | UWORD32 i4_cur_slice_idx; |
| 700 | /** |
| 701 | * Points to the array of slice indices which is used to identify the slice |
| 702 | * to which each CTB in a frame belongs. |
| 703 | */ |
| 704 | UWORD16 *pu1_slice_idx; |
| 705 | /** |
| 706 | * Points to the array of tile indices which is used to identify the slice |
| 707 | * to which each CTB in a frame belongs. |
| 708 | */ |
| 709 | UWORD16 *pu1_tile_idx; |
| 710 | |
| 711 | /* Specifies if the chroma format is yuv420sp_vu */ |
| 712 | WORD32 is_chroma_yuv420sp_vu; |
| 713 | |
| 714 | }sao_ctxt_t; |
| 715 | |
| 716 | typedef struct |
| 717 | { |
| 718 | /** Log2 CU's size */ |
| 719 | WORD32 i4_log2_cb_size; |
| 720 | |
| 721 | /** CU's x position */ |
| 722 | WORD32 i4_pos_x; |
| 723 | |
| 724 | /** CU's y position */ |
| 725 | WORD32 i4_pos_y; |
| 726 | /** |
| 727 | * Transquant Bypass enable flag at CU level - To be replicated at TU level |
| 728 | */ |
| 729 | WORD32 i4_cu_transquant_bypass; |
| 730 | /** |
| 731 | * Prediction mode |
| 732 | */ |
| 733 | WORD32 i4_pred_mode; |
| 734 | |
| 735 | /** |
| 736 | * Partition mode |
| 737 | */ |
| 738 | WORD32 i4_part_mode; |
| 739 | |
| 740 | /** |
| 741 | * Intra luma pred mode for current CU. In case of PART2Nx2N |
| 742 | * the first value is replicated to avoid checks later |
| 743 | */ |
| 744 | WORD32 ai4_intra_luma_pred_mode[4]; |
| 745 | |
| 746 | /** |
| 747 | * Previous intra luma pred flag used for intra pred mode computation |
| 748 | */ |
| 749 | WORD32 ai4_prev_intra_luma_pred_flag[4]; |
| 750 | |
| 751 | /** |
| 752 | * mpm index used in intra prediction mode computation |
| 753 | */ |
| 754 | WORD32 ai4_mpm_idx[4]; |
| 755 | /** |
| 756 | * Remaining intra pred mode |
| 757 | */ |
| 758 | WORD32 ai4_rem_intra_luma_pred_mode[4]; |
| 759 | /** |
| 760 | * Chroma pred mode index to be used to compute intra pred mode for chroma |
| 761 | */ |
| 762 | WORD32 i4_intra_chroma_pred_mode_idx; |
| 763 | /** |
| 764 | * Maximum transform depth |
| 765 | */ |
| 766 | WORD32 i4_max_trafo_depth; |
| 767 | |
| 768 | /** |
| 769 | * Luma CBF for current TU |
| 770 | */ |
| 771 | UWORD8 i1_cbf_luma; |
| 772 | |
| 773 | /** |
| 774 | * Cb CBF |
| 775 | */ |
| 776 | UWORD8 ai1_cbf_cb[MAX_TRAFO_DEPTH]; |
| 777 | |
| 778 | /** |
| 779 | * Cr CBF |
| 780 | */ |
| 781 | UWORD8 ai1_cbf_cr[MAX_TRAFO_DEPTH]; |
| 782 | |
| 783 | /** |
| 784 | * Intra split flag |
| 785 | */ |
| 786 | WORD32 i4_intra_split_flag; |
| 787 | |
| 788 | /** |
| 789 | * Current QP |
| 790 | */ |
| 791 | WORD32 i4_qp; |
| 792 | |
| 793 | /** |
| 794 | * Number of TUs in CU parsed before a change in QP is signaled |
| 795 | */ |
| 796 | WORD32 i4_tu_cnt; |
| 797 | |
| 798 | /** |
| 799 | * Cu QP delta |
| 800 | */ |
| 801 | WORD32 i4_cu_qp_delta; |
| 802 | |
| 803 | }parse_cu_t; |
| 804 | /** |
| 805 | * Structure contains few common state variables such as CTB positions, current SPS, PPS ids etc which are to be |
| 806 | * used in the parsing thread. By keeping it a different structure it is being explicitly signalled that these |
| 807 | * variables are specific to Parsing threads context and other threads should not update these elements |
| 808 | */ |
| 809 | typedef struct |
| 810 | { |
| 811 | /** |
| 812 | * CTB's x position within a picture in raster scan in CTB units |
| 813 | */ |
| 814 | WORD32 i4_ctb_x; |
| 815 | |
| 816 | /** |
| 817 | * CTB's y position within a picture in raster scan in CTB units |
| 818 | */ |
| 819 | |
| 820 | WORD32 i4_ctb_y; |
| 821 | |
| 822 | /** |
| 823 | * CTB's x position within a Tile in raster scan in CTB units |
| 824 | */ |
| 825 | WORD32 i4_ctb_tile_x; |
| 826 | |
| 827 | /** |
| 828 | * CTB's y position within a Tile in raster scan in CTB units |
| 829 | */ |
| 830 | |
| 831 | WORD32 i4_ctb_tile_y; |
| 832 | |
| 833 | /** |
| 834 | * CTB's x position within a Slice in raster scan in CTB units |
| 835 | */ |
| 836 | WORD32 i4_ctb_slice_x; |
| 837 | |
| 838 | /** |
| 839 | * CTB's y position within a Slice in raster scan in CTB units |
| 840 | */ |
| 841 | |
| 842 | WORD32 i4_ctb_slice_y; |
| 843 | |
| 844 | /** |
| 845 | * Index of the current Tile being parsed |
| 846 | */ |
| 847 | tile_t *ps_tile; |
| 848 | |
| 849 | /** |
| 850 | * Current slice idx - Used in multi-core cases to ensure slice header is |
| 851 | * preserved till the last CB of the slice is decoded |
| 852 | */ |
| 853 | WORD32 i4_cur_slice_idx; |
| 854 | /** |
| 855 | * Current slice idx - Used in multi-core cases to ensure slice header is |
| 856 | * preserved till the last CB of the slice is decoded |
| 857 | */ |
| 858 | WORD32 i4_cur_independent_slice_idx; |
| 859 | |
| 860 | /** |
| 861 | * Current slice idx - Used in multi-core cases to ensure slice header is |
| 862 | * preserved till the last CB of the slice is decoded |
| 863 | */ |
| 864 | WORD32 i4_cur_tile_idx; |
| 865 | |
| 866 | /** |
| 867 | * Pointer to current PPS |
| 868 | */ |
| 869 | pps_t *ps_pps; |
| 870 | |
| 871 | /** |
| 872 | * Pointer to current SPS |
| 873 | */ |
| 874 | sps_t *ps_sps; |
| 875 | |
| 876 | /** |
| 877 | * Signal that pic_init is called first time |
| 878 | */ |
| 879 | WORD32 i4_first_pic_init; |
| 880 | |
| 881 | /** |
| 882 | * Flag to indicate if CU QP delta is coded. |
| 883 | * By default it is set to 0 at the beginning of coding quad tree |
| 884 | */ |
| 885 | WORD32 i4_is_cu_qp_delta_coded; |
| 886 | |
| 887 | /** |
| 888 | * CU Qp delta |
| 889 | * By default it is set to 0 at the beginning of coding quad tree |
| 890 | */ |
| 891 | WORD32 i4_cu_qp_delta; |
| 892 | |
| 893 | /** |
| 894 | * Bitstream structure |
| 895 | */ |
| 896 | bitstrm_t s_bitstrm; |
| 897 | |
| 898 | /** |
| 899 | * Pointer frame level TU subblock coeff data |
| 900 | */ |
| 901 | void *pv_pic_tu_coeff_data; |
| 902 | |
| 903 | /** |
| 904 | * Pointer to TU subblock coeff data and number of coded subblocks and scan idx |
| 905 | * Incremented each time a coded subblock is parsed |
| 906 | * |
| 907 | */ |
| 908 | void *pv_tu_coeff_data; |
| 909 | |
| 910 | /** |
| 911 | * Current TU structure - set to CTB tu_t pointer at the start of CTB parsing and incremented |
| 912 | * for every TU |
| 913 | */ |
| 914 | tu_t *ps_tu; |
| 915 | |
| 916 | /** |
| 917 | * Current ctb's TU map |
| 918 | */ |
| 919 | UWORD8 *pu1_tu_map; |
| 920 | |
| 921 | /** |
| 922 | * Current PU structure - set to CTB pu_t pointer at the start of CTB parsing and incremented |
| 923 | * for every TU |
| 924 | */ |
| 925 | pu_t *ps_pu; |
| 926 | |
| 927 | /** |
| 928 | * Points to the array of slice indices which is used to identify the independent slice |
| 929 | * to which each CTB in a frame belongs. |
| 930 | */ |
| 931 | UWORD16 *pu1_slice_idx; |
| 932 | |
| 933 | /** |
| 934 | * Current PU index in a frame |
| 935 | */ |
| 936 | WORD32 i4_pic_pu_idx; |
| 937 | |
| 938 | /** |
| 939 | * Current TU index in a frame |
| 940 | */ |
| 941 | WORD32 i4_pic_tu_idx; |
| 942 | |
| 943 | /** |
| 944 | * Current PU structure - set to CTB pu_map pointer at the start of CTB parsing |
| 945 | */ |
| 946 | UWORD8 *pu1_pu_map; |
| 947 | |
| 948 | /** |
| 949 | * Current QP |
| 950 | */ |
| 951 | WORD32 u4_qp; |
| 952 | |
| 953 | /** |
| 954 | * Current Group's QP |
| 955 | */ |
| 956 | WORD32 u4_qpg; |
| 957 | |
| 958 | /** |
| 959 | * Number of PCM blocks in current CTB - Needed only during parsing |
| 960 | * If needed during recon then move it to ctb_t |
| 961 | */ |
| 962 | WORD32 i4_ctb_num_pcm_blks; |
| 963 | |
| 964 | /** |
| 965 | * PCM flag for the current CU |
| 966 | */ |
| 967 | WORD32 i4_cu_pcm_flag; |
| 968 | |
| 969 | /** |
| 970 | * CU related information to be used to populate tu_t and pu_t during |
| 971 | * pred unit and transform tree parsing. |
| 972 | */ |
| 973 | parse_cu_t s_cu; |
| 974 | |
| 975 | /** |
| 976 | * Pointer to pu_map for the current frame being parsed |
| 977 | */ |
| 978 | UWORD8 *pu1_pic_pu_map; |
| 979 | |
| 980 | /** |
| 981 | * Pointer to frame level pu_t for the current frame being parsed |
| 982 | * where MVs and Intra pred modes will be updated |
| 983 | */ |
| 984 | pu_t *ps_pic_pu; |
| 985 | |
| 986 | /** |
| 987 | * Pointer to tu_map for the current frame being parsed |
| 988 | */ |
| 989 | UWORD8 *pu1_pic_tu_map; |
| 990 | |
| 991 | /** |
| 992 | * Pointer to frame level tu_t for the current frame being parsed |
| 993 | * where transform unit related info will be updated |
| 994 | */ |
| 995 | tu_t *ps_pic_tu; |
| 996 | |
| 997 | /** |
| 998 | * Points to an array of TU indices which is used to identify |
| 999 | * start index of tu_t in ps_pic_tu and also to identify number of |
| 1000 | * TUs in the current CTB by subtracting current idx from next CTB's |
| 1001 | * TU idx |
| 1002 | */ |
| 1003 | UWORD32 *pu4_pic_tu_idx; |
| 1004 | |
| 1005 | /** |
| 1006 | * Points to an array of PU indices which is used to identify |
| 1007 | * start index of pu_t in ps_pic_pu and also to identify number of |
| 1008 | * PUs in the current CTB by subtracting current idx from next CTB's |
| 1009 | * PU idx |
| 1010 | */ |
| 1011 | UWORD32 *pu4_pic_pu_idx; |
| 1012 | |
| 1013 | |
| 1014 | /** |
| 1015 | * Current pictures intra mode map at 8x8 level |
| 1016 | */ |
| 1017 | UWORD8 *pu1_pic_intra_flag; |
| 1018 | |
| 1019 | /** |
| 1020 | * Current pictures loop filter flag map at 8x8 level |
| 1021 | */ |
| 1022 | UWORD8 *pu1_pic_no_loop_filter_flag; |
| 1023 | |
| 1024 | /** |
| 1025 | * Array to hold one row (top) of skip_flag flag stored at (8x8) level |
| 1026 | * 1 bit per (8x8) |
| 1027 | * read and written as a UWORD32 |
| 1028 | * LSB gives skip_flag for 0th 8x8 and MSB gives skip_flag for 31st 8x8 and so on |
| 1029 | * This is independent of CTB size or minCU size |
| 1030 | * Packed format requires extra calculations in extracting required bits but makes it easier |
| 1031 | * to store skip data for larger sizes such as 32 x 32 where 4 bits need to be set instead of |
| 1032 | * 4 bytes or for 64 x 64 where 8 bits need to be set instead of 8 bytes. |
| 1033 | */ |
| 1034 | UWORD32 *pu4_skip_cu_top; |
| 1035 | |
| 1036 | /** |
| 1037 | * Array to hold one 64 pixel column (left) of skip_flag flag stored at (8x8) level |
| 1038 | * 1 bit per (8x8) |
| 1039 | * read and written as a UWORD32 |
| 1040 | * LSB gives skip_flag for 0th 8x8 and MSB gives skip for 31st 8x8 and so on |
| 1041 | * This is independent of CTB size and allocated to store data for 64 pixels, of |
| 1042 | * this only first ctb_size number of bits (starting from MSB) will have valid data |
| 1043 | * This is also independent of min CU size and data is stored at 8x8 level. |
| 1044 | * Since only 8 bits are needed to represent left 64 pixels at 8x8 level, this is not an array |
| 1045 | */ |
| 1046 | UWORD32 u4_skip_cu_left; |
| 1047 | |
| 1048 | /** |
| 1049 | * Array to hold one row (top) of coding_tree_depth stored at (8x8) level |
| 1050 | * 2 bits per (8x8) pixels |
| 1051 | * read and written as a WORD32 |
| 1052 | * 2 LSBits give coding_tree_depth for 0th 8x8 and 2 MSBits give coding_tree_depth for 15th 8x8 and so on |
| 1053 | * This is independent of CTB size or minCU size |
| 1054 | */ |
| 1055 | UWORD32 *pu4_ct_depth_top; |
| 1056 | |
| 1057 | /** |
| 1058 | * Array to hold one 64 pixel column (left) of coding_tree_depth stored at (8x8) level |
| 1059 | * 2 bits per (8x8) pixels |
| 1060 | * read and written as a WORD32 |
| 1061 | * 2 LSBits give coding_tree_depth for 0th 8x8 and 2 MSBits give coding_tree_depth for 15th 8x8 and so on |
| 1062 | * This is independent of CTB size and allocated to store data for 64 pixels, of |
| 1063 | * this only first ctb_size * 2 number of bits (starting from MSB) will have valid data |
| 1064 | * This is also independent of min CU size and data is stored at 8x8 level. |
| 1065 | * Since only 16 bits are needed to represent left 64 pixels at 8x8 level, this is not an array |
| 1066 | */ |
| 1067 | UWORD32 u4_ct_depth_left; |
| 1068 | |
| 1069 | /** |
| 1070 | * Array to hold top (one row) luma_intra_pred_mode stored at (4x4) level for a CTB |
| 1071 | * 8 bits per (4x4) pixels |
| 1072 | * read and written as a UWORD8 |
| 1073 | * This is independent of CTB size or minCU size |
| 1074 | * This is independent of CTB size and allocated to store data for 64 pixels i.e. 64 bits is the size |
| 1075 | * Note this data is used only within a CTB, There is no inter CTB dependencies for this |
| 1076 | */ |
| 1077 | UWORD8 *pu1_luma_intra_pred_mode_top; |
| 1078 | |
| 1079 | /** |
| 1080 | * Array to hold left (one column) luma_intra_pred_mode stored at (4x4) level for a CTB |
| 1081 | * 8 bits per (4x4) pixels |
| 1082 | * read and written as a UWORD8 |
| 1083 | * This is independent of CTB size and allocated to store data for 64 pixels i.e. 64 bits is the size |
| 1084 | * This is also independent of min CU size and data is stored at 8x8 level. |
| 1085 | * This is used for prediction of next CTB within a row in a slice or tile |
| 1086 | */ |
| 1087 | UWORD8 *pu1_luma_intra_pred_mode_left; |
| 1088 | |
| 1089 | |
| 1090 | /** |
| 1091 | * Pointer to base of Video parameter set structure array |
| 1092 | */ |
| 1093 | vps_t *ps_vps_base; |
| 1094 | |
| 1095 | /** |
| 1096 | * Pointer to base of Sequence parameter set structure array |
| 1097 | */ |
| 1098 | sps_t *ps_sps_base; |
| 1099 | |
| 1100 | /** |
| 1101 | * Pointer to base of Picture parameter set structure array |
| 1102 | */ |
| 1103 | pps_t *ps_pps_base; |
| 1104 | |
| 1105 | /** |
| 1106 | * Pointer to base of slice header structure array |
| 1107 | */ |
| 1108 | slice_header_t *ps_slice_hdr_base; |
| 1109 | |
| 1110 | /** |
| 1111 | * Pointer to current slice header structure |
| 1112 | */ |
| 1113 | slice_header_t *ps_slice_hdr; |
| 1114 | |
| 1115 | |
| 1116 | /** |
| 1117 | * Error code during parse stage |
| 1118 | */ |
| 1119 | WORD32 i4_error_code; |
| 1120 | |
| 1121 | /** |
| 1122 | * Void pointer to process job context |
| 1123 | */ |
| 1124 | void *pv_proc_jobq; |
| 1125 | |
| 1126 | /* Cabac context */ |
| 1127 | cab_ctxt_t s_cabac; |
| 1128 | |
| 1129 | /* Current Coding tree depth */ |
| 1130 | WORD32 i4_ct_depth; |
| 1131 | |
| 1132 | /** Flag to signal end of frame */ |
| 1133 | WORD32 i4_end_of_frame; |
| 1134 | |
| 1135 | /** |
| 1136 | * Index of the next CTB parsed |
| 1137 | */ |
| 1138 | WORD32 i4_next_ctb_indx; |
| 1139 | |
| 1140 | /** |
| 1141 | * Pointer to the structure that contains BS and QP frame level arrays |
| 1142 | */ |
| 1143 | bs_ctxt_t s_bs_ctxt; |
| 1144 | |
| 1145 | /** |
| 1146 | * Pointer to the structure that contains deblock context |
| 1147 | */ |
| 1148 | deblk_ctxt_t s_deblk_ctxt; |
| 1149 | |
| 1150 | /** |
| 1151 | * Pointer to the structure that contains sao context |
| 1152 | */ |
| 1153 | sao_ctxt_t s_sao_ctxt; |
| 1154 | |
| 1155 | /** |
| 1156 | * QP Array for the current CTB |
| 1157 | * Used in QP prediction |
| 1158 | */ |
| 1159 | WORD8 ai1_8x8_cu_qp[MAX_CU_IN_CTB]; |
| 1160 | |
| 1161 | |
| 1162 | /** |
| 1163 | * Pointer to frame level sao_t for the current frame being parsed |
| 1164 | */ |
| 1165 | sao_t *ps_pic_sao; |
| 1166 | |
| 1167 | /** |
| 1168 | * Abs POC count of the frame |
| 1169 | */ |
| 1170 | WORD32 i4_abs_pic_order_cnt; |
| 1171 | |
| 1172 | /** |
| 1173 | * Pointer points to mv_buffer of current frame |
| 1174 | */ |
| 1175 | mv_buf_t *ps_cur_mv_buf; |
| 1176 | |
| 1177 | /** |
| 1178 | * Variable to store the next ctb count to compute pu idx |
| 1179 | */ |
| 1180 | WORD32 i4_next_pu_ctb_cnt; |
| 1181 | |
| 1182 | /** |
| 1183 | * Variable to store the next ctb count to compute tu idx |
| 1184 | */ |
| 1185 | WORD32 i4_next_tu_ctb_cnt; |
| 1186 | |
| 1187 | |
| 1188 | }parse_ctxt_t; |
| 1189 | |
| 1190 | /** |
| 1191 | * Pixel processing thread context |
| 1192 | */ |
| 1193 | |
| 1194 | typedef struct |
| 1195 | { |
| 1196 | /* Pointer to codec context |
| 1197 | * |
| 1198 | */ |
| 1199 | codec_t *ps_codec; |
| 1200 | |
| 1201 | /** |
| 1202 | * CTB's x position within a picture in raster scan in CTB units |
| 1203 | */ |
| 1204 | WORD32 i4_ctb_x; |
| 1205 | |
| 1206 | /** |
| 1207 | * CTB's y position within a picture in raster scan in CTB units |
| 1208 | */ |
| 1209 | |
| 1210 | WORD32 i4_ctb_y; |
| 1211 | |
| 1212 | /** |
| 1213 | * CTB's x position within a Tile in raster scan in CTB units |
| 1214 | */ |
| 1215 | WORD32 i4_ctb_tile_x; |
| 1216 | |
| 1217 | /** |
| 1218 | * CTB's y position within a Tile in raster scan in CTB units |
| 1219 | */ |
| 1220 | |
| 1221 | WORD32 i4_ctb_tile_y; |
| 1222 | |
| 1223 | /** |
| 1224 | * CTB's x position within a Slice in raster scan in CTB units |
| 1225 | */ |
| 1226 | WORD32 i4_ctb_slice_x; |
| 1227 | |
| 1228 | /** |
| 1229 | * CTB's y position within a Slice in raster scan in CTB units |
| 1230 | */ |
| 1231 | |
| 1232 | WORD32 i4_ctb_slice_y; |
| 1233 | |
| 1234 | /** |
| 1235 | * Current tile being processed |
| 1236 | */ |
| 1237 | tile_t *ps_tile; |
| 1238 | |
| 1239 | /** |
| 1240 | * Current slice idx - Used in multi-core cases to store slice index for |
| 1241 | * each ctb for sao filtering. |
| 1242 | */ |
| 1243 | WORD32 i4_cur_slice_idx; |
| 1244 | |
| 1245 | /** |
| 1246 | * Current tile idx - Used in multi-core cases to store tile index for |
| 1247 | * each ctb for sao filtering. |
| 1248 | */ |
| 1249 | WORD32 i4_cur_tile_idx; |
| 1250 | /** |
| 1251 | * Pointer to current PPS |
| 1252 | */ |
| 1253 | pps_t *ps_pps; |
| 1254 | |
| 1255 | /** |
| 1256 | * Pointer to current SPS |
| 1257 | */ |
| 1258 | sps_t *ps_sps; |
| 1259 | |
| 1260 | /** |
| 1261 | * Pointer to current slice header structure |
| 1262 | */ |
| 1263 | slice_header_t *ps_slice_hdr; |
| 1264 | |
| 1265 | /** |
| 1266 | * Error code during parse stage |
| 1267 | */ |
| 1268 | WORD32 i4_error_code; |
| 1269 | |
| 1270 | /** |
| 1271 | * Signal that pic_init is called first time |
| 1272 | */ |
| 1273 | WORD32 i4_first_pic_init; |
| 1274 | |
| 1275 | /** |
| 1276 | * Pointer frame level TU subblock coeff data |
| 1277 | */ |
| 1278 | void *pv_pic_tu_coeff_data; |
| 1279 | |
| 1280 | /** |
| 1281 | * Pointer to TU subblock coeff data and number of subblocks and scan idx |
| 1282 | * Incremented each time a coded subblock is processed |
| 1283 | * |
| 1284 | */ |
| 1285 | void *pv_tu_coeff_data; |
| 1286 | |
| 1287 | /** |
| 1288 | * Current TU structure - set to CTB tu_t pointer at the start of CTB processing and incremented |
| 1289 | * for every TU |
| 1290 | */ |
| 1291 | tu_t *ps_tu; |
| 1292 | |
| 1293 | /** |
| 1294 | * Current ctb's TU map |
| 1295 | */ |
| 1296 | UWORD8 *pu1_tu_map; |
| 1297 | |
| 1298 | /** |
| 1299 | * Current PU structure - set to CTB pu_t pointer at the start of CTB processing and incremented |
| 1300 | * for every TU |
| 1301 | */ |
| 1302 | pu_t *ps_pu; |
| 1303 | |
| 1304 | /** |
| 1305 | * Points to an array of TU indices which is used to identify |
| 1306 | * start index of tu_t in ps_pic_tu and also to identify number of |
| 1307 | * TUs in the current CTB by subtracting current idx from next CTB's |
| 1308 | * TU idx |
| 1309 | */ |
| 1310 | UWORD32 *pu4_pic_tu_idx; |
| 1311 | |
| 1312 | /** |
| 1313 | * Points to an array of PU indices which is used to identify |
| 1314 | * start index of pu_t in ps_pic_pu and also to identify number of |
| 1315 | * PUs in the current CTB by subtracting current idx from next CTB's |
| 1316 | * PU idx |
| 1317 | */ |
| 1318 | UWORD32 *pu4_pic_pu_idx; |
| 1319 | |
| 1320 | /** |
| 1321 | * Pointer to tu_map for the current frame being parsed |
| 1322 | */ |
| 1323 | UWORD8 *pu1_pic_tu_map; |
| 1324 | |
| 1325 | /** |
| 1326 | * Pointer to pu_map for the current frame being parsed |
| 1327 | * where MVs and Intra pred modes will be updated |
| 1328 | */ |
| 1329 | UWORD8 *pu1_pic_pu_map; |
| 1330 | |
| 1331 | /** |
| 1332 | * Pointer to frame level pu_t for the current frame being parsed |
| 1333 | * where MVs and Intra pred modes will be updated |
| 1334 | */ |
| 1335 | pu_t *ps_pic_pu; |
| 1336 | |
| 1337 | /** PU Index map per CTB. The indices in this map are w.r.t picture pu array and not |
| 1338 | * w.r.t CTB pu array. |
| 1339 | * This will be used during mv prediction and since neighbours will have different CTB pu map |
| 1340 | * it will be easier if they all have indices w.r.t picture level PU array rather than CTB level |
| 1341 | * PU array. |
| 1342 | * pu1_pic_pu_map is map w.r.t CTB's pu_t array |
| 1343 | */ |
| 1344 | UWORD32 *pu4_pic_pu_idx_map; |
| 1345 | |
| 1346 | /** |
| 1347 | * PU Index of top 4x4 neighbors stored for an entire row |
| 1348 | */ |
| 1349 | UWORD32 *pu4_pic_pu_idx_top; |
| 1350 | |
| 1351 | /** |
| 1352 | * PU Index of left 4x4 neighbors stored for 64 pixels |
| 1353 | */ |
| 1354 | UWORD32 *pu4_pic_pu_idx_left; |
| 1355 | |
| 1356 | /** |
| 1357 | * Holds top left PU index at CTB level - top left gets overwritten |
| 1358 | * by left CTB while updating top array. Before updating top at CTB |
| 1359 | * level required top-left index is backed up in the following |
| 1360 | */ |
| 1361 | UWORD32 u4_ctb_top_left_pu_idx; |
| 1362 | |
| 1363 | /** |
| 1364 | * Pointer to frame level tu_t for the current frame being parsed |
| 1365 | * where transform unit related info will be updated |
| 1366 | */ |
| 1367 | tu_t *ps_pic_tu; |
| 1368 | |
| 1369 | |
| 1370 | /** |
| 1371 | * Current PU structure - set to CTB pu_map pointer at the start of CTB parsing |
| 1372 | */ |
| 1373 | UWORD8 *pu1_pu_map; |
| 1374 | |
| 1375 | /** Current MV Bank's buffer ID */ |
| 1376 | WORD32 i4_cur_mv_bank_buf_id; |
| 1377 | |
| 1378 | /** |
| 1379 | * Current pictures intra mode map at 8x8 level |
| 1380 | */ |
| 1381 | UWORD8 *pu1_pic_intra_flag; |
| 1382 | |
| 1383 | /** |
| 1384 | * Current pictures loop filter flag map at 8x8 level |
| 1385 | */ |
| 1386 | UWORD8 *pu1_pic_no_loop_filter_flag; |
| 1387 | |
| 1388 | /** |
| 1389 | * Void pointer to process job context |
| 1390 | */ |
| 1391 | |
| 1392 | void *pv_proc_jobq; |
| 1393 | |
| 1394 | /** |
| 1395 | * Number of CTBs to be processed in the current Job |
| 1396 | */ |
| 1397 | WORD32 i4_ctb_cnt; |
| 1398 | /** |
| 1399 | * ID for the current context - Used for debugging |
| 1400 | */ |
| 1401 | WORD32 i4_id; |
| 1402 | |
| 1403 | /** |
| 1404 | * Flag to indicate if parsing status has to be checked |
| 1405 | * Needed when parsing and processing are done in different threads |
| 1406 | */ |
| 1407 | WORD32 i4_check_parse_status; |
| 1408 | |
| 1409 | /** |
| 1410 | * Flag to indicate if processing status of top row CTBs has to be checked |
| 1411 | * Needed when processing of different rows is done in different threads |
| 1412 | */ |
| 1413 | WORD32 i4_check_proc_status; |
| 1414 | |
| 1415 | /** |
| 1416 | * Holds Intra dequantization matrices |
| 1417 | */ |
| 1418 | WORD16 *api2_dequant_intra_matrix[4]; |
| 1419 | |
| 1420 | /** |
| 1421 | * Holds Inter dequantization matrices |
| 1422 | */ |
| 1423 | WORD16 *api2_dequant_inter_matrix[4]; |
| 1424 | |
| 1425 | |
| 1426 | /** |
| 1427 | * Temporary buffer 1 - Used as a scratch in inter_pred_ctb() |
| 1428 | */ |
| 1429 | WORD16 *pi2_inter_pred_tmp_buf1; |
| 1430 | |
| 1431 | /** |
| 1432 | * Temporary buffer 2 - Used as a scratch in inter_pred_ctb() |
| 1433 | */ |
| 1434 | WORD16 *pi2_inter_pred_tmp_buf2; |
| 1435 | |
| 1436 | /** |
| 1437 | * Temporary buffer 3 - Used as a scratch in inter_pred_ctb() |
| 1438 | */ |
| 1439 | WORD16 *pi2_inter_pred_tmp_buf3; |
| 1440 | |
| 1441 | /** |
| 1442 | * The above temporary buffers' stride |
| 1443 | */ |
| 1444 | WORD32 i4_inter_pred_tmp_buf_strd; |
| 1445 | /** |
| 1446 | * Picture stride |
| 1447 | * Used as prediction stride, destination stride while computing inverse transform |
| 1448 | */ |
| 1449 | WORD32 i4_pic_strd; |
| 1450 | |
| 1451 | /** |
| 1452 | * Picture qp offset for U |
| 1453 | */ |
| 1454 | WORD8 i1_pic_cb_qp_offset; |
| 1455 | |
| 1456 | /** |
| 1457 | * Slice qp offset for U |
| 1458 | */ |
| 1459 | WORD32 i1_slice_cb_qp_offset; |
| 1460 | |
| 1461 | /** |
| 1462 | * Picture qp offset for V |
| 1463 | */ |
| 1464 | WORD8 i1_pic_cr_qp_offset; |
| 1465 | |
| 1466 | /** |
| 1467 | * Slice qp offset for V |
| 1468 | */ |
| 1469 | WORD32 i1_slice_cr_qp_offset; |
| 1470 | |
| 1471 | /** Pointer to current picture buffer structure */ |
| 1472 | pic_buf_t *ps_cur_pic; |
| 1473 | |
| 1474 | /** Current pic_buf's picture buffer id */ |
| 1475 | WORD32 i4_cur_pic_buf_id; |
| 1476 | |
| 1477 | /** Pointer to 0th luma pixel in current pic */ |
| 1478 | UWORD8 *pu1_cur_pic_luma; |
| 1479 | |
| 1480 | /** Pointer to 0th chroma pixel in current pic */ |
| 1481 | UWORD8 *pu1_cur_pic_chroma; |
| 1482 | |
| 1483 | /** Intermediate buffer to be used during inverse transform */ |
| 1484 | WORD16 *pi2_itrans_intrmd_buf; |
| 1485 | |
| 1486 | /** Buffer to hold output of inverse scan */ |
| 1487 | WORD16 *pi2_invscan_out; |
| 1488 | |
| 1489 | /** |
| 1490 | * Top availability for current CTB level |
| 1491 | */ |
| 1492 | UWORD8 u1_top_ctb_avail; |
| 1493 | |
| 1494 | /** |
| 1495 | * Top right availability for current CTB level |
| 1496 | */ |
| 1497 | UWORD8 u1_top_rt_ctb_avail; |
| 1498 | /** |
| 1499 | * Top left availability for current CTB level |
| 1500 | */ |
| 1501 | UWORD8 u1_top_lt_ctb_avail; |
| 1502 | /** |
| 1503 | * left availability for current CTB level |
| 1504 | */ |
| 1505 | UWORD8 u1_left_ctb_avail; |
| 1506 | /** |
| 1507 | * TU count in current CTB |
| 1508 | */ |
| 1509 | WORD32 i4_ctb_tu_cnt; |
| 1510 | |
| 1511 | /** |
| 1512 | * Recon pointer to current CTB luma |
| 1513 | */ |
| 1514 | UWORD8 *pu1_cur_ctb_luma; |
| 1515 | /** |
| 1516 | * Recon pointer to current CTB chroma |
| 1517 | */ |
| 1518 | UWORD8 *pu1_cur_ctb_chroma; |
| 1519 | |
| 1520 | /** |
| 1521 | * PU count in current CTB |
| 1522 | */ |
| 1523 | WORD32 i4_ctb_pu_cnt; |
| 1524 | |
| 1525 | /** |
| 1526 | * PU count in current CTB |
| 1527 | */ |
| 1528 | WORD32 i4_ctb_start_pu_idx; |
| 1529 | |
| 1530 | /* Pointer to a structure describing output display buffer */ |
| 1531 | ivd_out_bufdesc_t *ps_out_buffer; |
| 1532 | |
| 1533 | /** Flag to indicate if ps_proc was intialized at least once in a frame. |
| 1534 | * This is needed to handle cases where a core starts to handle format conversion jobs directly |
| 1535 | */ |
| 1536 | WORD32 i4_init_done; |
| 1537 | |
| 1538 | /** |
| 1539 | * Pointer to the structure that contains BS and QP frame level arrays |
| 1540 | */ |
| 1541 | bs_ctxt_t s_bs_ctxt; |
| 1542 | |
| 1543 | /** |
| 1544 | * Pointer to the structure that contains deblock context |
| 1545 | */ |
| 1546 | deblk_ctxt_t s_deblk_ctxt; |
| 1547 | |
| 1548 | /** |
| 1549 | * Pointer to the structure that contains sao context |
| 1550 | */ |
| 1551 | sao_ctxt_t s_sao_ctxt; |
| 1552 | |
| 1553 | /** |
| 1554 | * Points to the array of slice indices which is used to identify the independent |
| 1555 | * slice to which each CTB in a frame belongs. |
| 1556 | */ |
| 1557 | UWORD16 *pu1_slice_idx; |
| 1558 | |
| 1559 | /** |
| 1560 | * Points to the array of slice indices which is used to identify the slice |
| 1561 | * to which each CTB in a frame belongs. |
| 1562 | */ |
| 1563 | UWORD16 *pu1_tile_idx; |
| 1564 | /** |
| 1565 | * Variable to store the next ctb count to compute pu idx |
| 1566 | */ |
| 1567 | WORD32 i4_next_pu_ctb_cnt; |
| 1568 | |
| 1569 | /** |
| 1570 | * Variable to store the next ctb count to compute tu idx |
| 1571 | */ |
| 1572 | WORD32 i4_next_tu_ctb_cnt; |
| 1573 | #ifdef GPU_BUILD |
| 1574 | //TODO GPU : Later define it for ARM only version as well |
| 1575 | /** Process status: one byte per CTB */ |
| 1576 | UWORD8 *pu1_proc_map; |
| 1577 | #endif |
| 1578 | #ifdef GPU_BUILD |
| 1579 | UWORD32 u4_gpu_inter_flag; |
| 1580 | #endif |
| 1581 | #ifdef GPU_BUILD |
| 1582 | //TODO GPU : Later define it for ARM only version as well |
| 1583 | /** |
| 1584 | * Pointer to base slice header structure |
| 1585 | */ |
| 1586 | slice_header_t *ps_slice_hdr_base; |
| 1587 | #endif |
| 1588 | /** |
| 1589 | * Number of ctb's to process in one loop |
| 1590 | */ |
| 1591 | WORD32 i4_nctb; |
| 1592 | }process_ctxt_t; |
| 1593 | #ifdef GPU_BUILD |
| 1594 | typedef struct |
| 1595 | { |
| 1596 | /** Pointer to private GPU memory */ |
| 1597 | void *pv_gpu_priv; |
| 1598 | |
| 1599 | /** |
| 1600 | * Array that contains the no of ctbs in each grain of the frame. |
| 1601 | * Right now maximum no of grains in frame hardcoded to 16. |
| 1602 | */ |
| 1603 | WORD32 ai4_ctbs_in_grain[16]; |
| 1604 | |
| 1605 | /** |
| 1606 | * Array that contains the height of each grain of the frame in ctbs. |
| 1607 | * Right now maximum no of grains in frame hardcoded to 16. |
| 1608 | */ |
| 1609 | WORD32 ai4_grain_ht_in_ctb[16]; |
| 1610 | |
| 1611 | /** |
| 1612 | * Array that contains the X position of each grain in the current |
| 1613 | * frame in CTB units |
| 1614 | */ |
| 1615 | WORD32 ai4_grain_pos_y[16]; |
| 1616 | |
| 1617 | /** |
| 1618 | * Variables to store maximum extend of motion vectors in for the current grain. |
| 1619 | */ |
| 1620 | //WORD32 i4_max_pu_y; |
| 1621 | //WORD32 i4_max_pu_x; |
| 1622 | |
| 1623 | /** |
| 1624 | * Parameter that holds current grain index. |
| 1625 | */ |
| 1626 | WORD32 i4_curr_grain_idx; |
| 1627 | |
| 1628 | /** |
| 1629 | * Arry to store coefficient offsets for each ctb row. |
| 1630 | * Currently allocated for frame width of 4096(ctb size 16 * 256). |
| 1631 | */ |
| 1632 | WORD32 ai4_tu_coeff_data_ofst[256]; |
| 1633 | |
| 1634 | /** |
| 1635 | * Arry to store slice id for at the beginning of each ctb row. |
| 1636 | * Currently allocated for frame width of 4096(ctb size 16 * 256). |
| 1637 | */ |
| 1638 | WORD32 ai4_cur_slice_idx[256]; |
| 1639 | |
| 1640 | /** |
| 1641 | * Variable to keep track of no of ctbs parsed in the current frame grain. |
| 1642 | */ |
| 1643 | WORD32 i4_curr_grain_ctb_cnt; |
| 1644 | }gpu_ctxt_t; |
| 1645 | #endif |
| 1646 | |
| 1647 | typedef void (*pf_inter_pred)(void *, |
| 1648 | void *, |
| 1649 | WORD32, |
| 1650 | WORD32, |
| 1651 | WORD8 *, |
| 1652 | WORD32, |
| 1653 | WORD32); |
| 1654 | |
| 1655 | |
| 1656 | typedef void (*pf_intra_pred)(UWORD8 *pu1_ref, |
| 1657 | WORD32 src_strd, |
| 1658 | UWORD8 *pu1_dst, |
| 1659 | WORD32 dst_strd, |
| 1660 | WORD32 nt, |
| 1661 | WORD32 mode); |
| 1662 | |
| 1663 | typedef void (*pf_itrans_recon)(WORD16 *pi2_src, |
| 1664 | WORD16 *pi2_tmp, |
| 1665 | UWORD8 *pu1_pred, |
| 1666 | UWORD8 *pu1_dst, |
| 1667 | WORD32 src_strd, |
| 1668 | WORD32 pred_strd, |
| 1669 | WORD32 dst_strd, |
| 1670 | WORD32 zero_cols, |
| 1671 | WORD32 zero_rows); |
| 1672 | |
| 1673 | typedef void (*pf_recon)(WORD16 *pi2_src, |
| 1674 | UWORD8 *pu1_pred, |
| 1675 | UWORD8 *pu1_dst, |
| 1676 | WORD32 src_strd, |
| 1677 | WORD32 pred_strd, |
| 1678 | WORD32 dst_strd, |
| 1679 | WORD32 zero_cols); |
| 1680 | |
| 1681 | typedef void (*pf_itrans_recon_dc)(UWORD8 *pu1_pred, |
| 1682 | UWORD8 *pu1_dst, |
| 1683 | WORD32 pred_strd, |
| 1684 | WORD32 dst_strd, |
| 1685 | WORD32 log2_trans_size, |
| 1686 | WORD16 i2_coeff_value); |
| 1687 | |
| 1688 | |
| 1689 | typedef void (*pf_sao_luma)(UWORD8 *, |
| 1690 | WORD32, |
| 1691 | UWORD8 *, |
| 1692 | UWORD8 *, |
| 1693 | UWORD8 *, |
| 1694 | UWORD8 *, |
| 1695 | UWORD8 *, |
| 1696 | UWORD8 *, |
| 1697 | WORD8 *, |
| 1698 | WORD32, |
| 1699 | WORD32); |
| 1700 | |
| 1701 | typedef void (*pf_sao_chroma)(UWORD8 *, |
| 1702 | WORD32, |
| 1703 | UWORD8 *, |
| 1704 | UWORD8 *, |
| 1705 | UWORD8 *, |
| 1706 | UWORD8 *, |
| 1707 | UWORD8 *, |
| 1708 | UWORD8 *, |
| 1709 | WORD8 *, |
| 1710 | WORD8 *, |
| 1711 | WORD32, |
| 1712 | WORD32); |
| 1713 | |
| 1714 | /** |
| 1715 | * Codec context |
| 1716 | */ |
| 1717 | |
| 1718 | struct _codec_t |
| 1719 | { |
| 1720 | /** |
| 1721 | * Max width the codec can support |
| 1722 | */ |
| 1723 | WORD32 i4_max_wd; |
| 1724 | |
| 1725 | /** |
| 1726 | * Max height the codec can support |
| 1727 | */ |
| 1728 | WORD32 i4_max_ht; |
| 1729 | |
| 1730 | /** |
| 1731 | * Width : pic_width_in_luma_samples |
| 1732 | */ |
| 1733 | WORD32 i4_wd; |
| 1734 | |
| 1735 | /** |
| 1736 | * Height : pic_height_in_luma_samples |
| 1737 | */ |
| 1738 | WORD32 i4_ht; |
| 1739 | |
| 1740 | /** |
| 1741 | * Display width after cropping |
| 1742 | */ |
| 1743 | WORD32 i4_disp_wd; |
| 1744 | |
| 1745 | /** |
| 1746 | * Display height after cropping |
| 1747 | */ |
| 1748 | WORD32 i4_disp_ht; |
| 1749 | |
| 1750 | /** |
| 1751 | * Display stride |
| 1752 | */ |
| 1753 | WORD32 i4_disp_strd; |
| 1754 | |
| Harish Mahendrakar | 707042f | 2014-06-04 10:31:48 -0700 | [diff] [blame^] | 1755 | /* |
| 1756 | * In case stream width/height is greater than max_wd/max_ht used during init, |
| 1757 | * it is stored in the following and in order to decode the current stream |
| 1758 | * decoder has to be recreated with these dimensions. |
| 1759 | */ |
| 1760 | /** |
| 1761 | * Stream width if it is greater than i4_max_wd |
| 1762 | */ |
| 1763 | WORD32 i4_new_max_wd; |
| 1764 | |
| 1765 | /** |
| 1766 | * Stream height if it is greater than i4_max_ht |
| 1767 | */ |
| 1768 | WORD32 i4_new_max_ht; |
| 1769 | |
| Harish Mahendrakar | 0d8951c | 2014-05-16 10:31:13 -0700 | [diff] [blame] | 1770 | /** |
| 1771 | * Stride of reference buffers. |
| 1772 | * For shared mode even display buffer will use the same stride |
| 1773 | */ |
| 1774 | WORD32 i4_strd; |
| 1775 | |
| 1776 | /** |
| 1777 | * Level specified during init |
| 1778 | */ |
| 1779 | WORD32 i4_init_level; |
| 1780 | |
| 1781 | /** |
| 1782 | * number of reference frames specified during init |
| 1783 | */ |
| 1784 | WORD32 i4_init_num_ref; |
| 1785 | |
| 1786 | /** |
| 1787 | * number of reorder frames specified during init |
| 1788 | */ |
| 1789 | WORD32 i4_init_num_reorder; |
| 1790 | |
| 1791 | /** |
| 1792 | * Number of extra display buffers allocated by application |
| 1793 | */ |
| 1794 | WORD32 i4_init_num_extra_disp_buf; |
| 1795 | |
| 1796 | /** |
| 1797 | * Number of cores to be used |
| 1798 | */ |
| 1799 | WORD32 i4_num_cores; |
| 1800 | |
| 1801 | /** |
| 1802 | * RASL output flag |
| 1803 | */ |
| 1804 | WORD32 i4_rasl_output_flag; |
| 1805 | |
| 1806 | /** |
| 1807 | * Pictures that are are degraded |
| 1808 | * 0 : No degrade |
| 1809 | * 1 : Only on non-reference frames |
| 1810 | * 2 : Use interval specified by u4_nondegrade_interval |
| 1811 | * 3 : All non-key frames |
| 1812 | * 4 : All frames |
| 1813 | */ |
| 1814 | WORD32 i4_degrade_pics; |
| 1815 | |
| 1816 | /** |
| 1817 | * Interval for pictures which are completely decoded without any degradation |
| 1818 | */ |
| 1819 | WORD32 i4_nondegrade_interval; |
| 1820 | |
| 1821 | /** |
| 1822 | * bit position (lsb is zero): Type of degradation |
| 1823 | * 0 : Disable SAO |
| 1824 | * 1 : Disable deblocking |
| 1825 | * 2 : Faster inter prediction filters |
| 1826 | * 3 : Fastest inter prediction filters |
| 1827 | */ |
| 1828 | WORD32 i4_degrade_type; |
| 1829 | |
| 1830 | /** Degrade pic count, Used to maintain the interval between non-degraded pics |
| 1831 | * |
| 1832 | */ |
| 1833 | WORD32 i4_degrade_pic_cnt; |
| 1834 | |
| 1835 | /** |
| 1836 | * Total number of display buffers to be used |
| 1837 | * In case of shared mode, this will be number of reference frames |
| 1838 | */ |
| 1839 | WORD32 i4_num_disp_bufs; |
| 1840 | |
| 1841 | /** |
| 1842 | * Flag to enable shared display buffer mode |
| 1843 | */ |
| 1844 | WORD32 i4_share_disp_buf; |
| 1845 | |
| 1846 | /** |
| 1847 | * Chroma format of display buffers. |
| 1848 | In shared mode only 420SP_UV and 420SP_VU are supported |
| 1849 | */ |
| 1850 | IV_COLOR_FORMAT_T e_chroma_fmt; |
| 1851 | |
| 1852 | /** |
| 1853 | * Chroma format of reference buffers. |
| 1854 | * In non-shared mode it will be 420SP_UV |
| 1855 | * In shared mode only 420SP_UV and 420SP_VU are supported |
| 1856 | */ |
| 1857 | IV_COLOR_FORMAT_T e_ref_chroma_fmt; |
| 1858 | |
| 1859 | /** |
| 1860 | * Frame skip mode |
| 1861 | */ |
| 1862 | IVD_FRAME_SKIP_MODE_T e_pic_skip_mode; |
| 1863 | |
| 1864 | /** |
| 1865 | * Display or decode order dump of output |
| 1866 | */ |
| 1867 | IVD_DISPLAY_FRAME_OUT_MODE_T e_pic_out_order; |
| 1868 | |
| 1869 | /** |
| 1870 | * Coding type of the picture that is decoded |
| 1871 | */ |
| 1872 | IV_PICTURE_CODING_TYPE_T e_dec_pic_type; |
| 1873 | |
| 1874 | /** |
| 1875 | * Flag to signal if a frame was decoded in this call |
| 1876 | */ |
| 1877 | WORD32 i4_pic_decoded; |
| 1878 | |
| 1879 | /** |
| 1880 | * Flag to signal if picture data is present in the current input bitstream |
| 1881 | */ |
| 1882 | WORD32 i4_pic_present; |
| 1883 | |
| 1884 | /** |
| 1885 | * Flag to disable deblocking of a frame |
| 1886 | */ |
| 1887 | WORD32 i4_disable_deblk_pic; |
| 1888 | |
| 1889 | /** |
| 1890 | * Flag to disable sao of a frame |
| 1891 | */ |
| 1892 | WORD32 i4_disable_sao_pic; |
| 1893 | |
| 1894 | /** |
| 1895 | * Flag to use full pel MC |
| 1896 | */ |
| 1897 | WORD32 i4_fullpel_inter_pred; |
| 1898 | /** |
| 1899 | * Flush mode |
| 1900 | */ |
| 1901 | WORD32 i4_flush_mode; |
| 1902 | |
| 1903 | /** |
| 1904 | * Decode header mode |
| 1905 | */ |
| 1906 | WORD32 i4_header_mode; |
| 1907 | |
| 1908 | /** |
| 1909 | * Header in slice mode |
| 1910 | */ |
| 1911 | WORD32 i4_header_in_slice_mode; |
| 1912 | |
| 1913 | /** |
| 1914 | * Flag to signal sps done |
| 1915 | */ |
| 1916 | WORD32 i4_sps_done; |
| 1917 | |
| 1918 | /** |
| 1919 | * Flag to signal pps done |
| 1920 | */ |
| 1921 | WORD32 i4_pps_done; |
| 1922 | |
| 1923 | /** |
| 1924 | * To signal successful completion of init |
| 1925 | */ |
| 1926 | WORD32 i4_init_done; |
| 1927 | |
| 1928 | /** |
| 1929 | * To signal that at least one picture was decoded |
| 1930 | */ |
| 1931 | WORD32 i4_first_pic_done; |
| 1932 | |
| 1933 | /** |
| 1934 | * To signal error in slice |
| 1935 | */ |
| 1936 | WORD32 i4_slice_error; |
| 1937 | |
| 1938 | /** |
| 1939 | * Reset flag - Codec is reset if this flag is set |
| 1940 | */ |
| 1941 | WORD32 i4_reset_flag; |
| 1942 | |
| 1943 | /** |
| 1944 | * Number of pictures decoded till now |
| 1945 | */ |
| 1946 | UWORD32 u4_pic_cnt; |
| 1947 | |
| 1948 | /** |
| 1949 | * Number of pictures displayed till now |
| 1950 | */ |
| 1951 | UWORD32 u4_disp_cnt; |
| 1952 | |
| 1953 | /** |
| 1954 | * Current error code |
| 1955 | */ |
| 1956 | WORD32 i4_error_code; |
| 1957 | |
| 1958 | /** |
| 1959 | * Pointer to input bitstream. This is incremented everytime a NAL is processed |
| 1960 | */ |
| 1961 | UWORD8 *pu1_inp_bitsbuf; |
| 1962 | |
| 1963 | /** |
| 1964 | * Offset to first byte after the start code in current NAL |
| 1965 | */ |
| 1966 | WORD32 i4_nal_ofst; |
| 1967 | |
| 1968 | /** |
| 1969 | * Length of the NAL unit including the emulation bytes |
| 1970 | */ |
| 1971 | WORD32 i4_nal_len; |
| 1972 | |
| 1973 | /** |
| 1974 | * Number of emulation prevention bytes present in the current NAL |
| 1975 | */ |
| 1976 | WORD32 i4_num_emln_bytes; |
| 1977 | |
| 1978 | /** |
| 1979 | * Number of bytes remaining in the input bitstream |
| 1980 | */ |
| 1981 | /** |
| 1982 | * Decremented everytime a NAL is processed |
| 1983 | */ |
| 1984 | WORD32 i4_bytes_remaining; |
| 1985 | |
| 1986 | /** |
| 1987 | * Pointer to bitstream after emulation prevention |
| 1988 | */ |
| 1989 | UWORD8 *pu1_bitsbuf; |
| 1990 | |
| 1991 | /** |
| 1992 | * Size of intermediate bitstream buffer |
| 1993 | */ |
| 1994 | UWORD32 u4_bitsbuf_size; |
| 1995 | |
| 1996 | /** |
| 1997 | * Pointer to hold TU data for a set of CTBs or a picture |
| 1998 | */ |
| 1999 | #ifndef GPU_BUILD |
| 2000 | void *pv_tu_data; |
| 2001 | #else |
| 2002 | void *apv_tu_data[2]; |
| 2003 | #endif |
| 2004 | /** |
| 2005 | * Holds mem records passed during init. |
| 2006 | * This will be used to return the mem records during retrieve call |
| 2007 | */ |
| 2008 | iv_mem_rec_t *ps_mem_rec_backup; |
| 2009 | |
| 2010 | /** |
| 2011 | * Process Job queue buffer base |
| 2012 | */ |
| 2013 | void *pv_proc_jobq_buf; |
| 2014 | |
| 2015 | /** |
| 2016 | * Process Job Queue mem tab size |
| 2017 | */ |
| 2018 | WORD32 i4_proc_jobq_buf_size; |
| 2019 | |
| 2020 | /** Parse status: one byte per CTB */ |
| 2021 | UWORD8 *pu1_parse_map; |
| 2022 | |
| 2023 | /** Process status: one byte per CTB */ |
| 2024 | #ifndef GPU_BUILD |
| 2025 | UWORD8 *pu1_proc_map; |
| 2026 | #else |
| 2027 | UWORD8 *apu1_proc_map[2]; |
| 2028 | #endif |
| 2029 | /** |
| 2030 | * Current pictures intra mode map at 8x8 level |
| 2031 | */ |
| 2032 | #ifndef GPU_BUILD |
| 2033 | UWORD8 *pu1_pic_intra_flag; |
| 2034 | #else |
| 2035 | UWORD8 *apu1_pic_intra_flag[2]; |
| 2036 | #endif |
| 2037 | /** |
| 2038 | * Current pictures loop filter flag map at 8x8 level |
| 2039 | */ |
| 2040 | #ifndef GPU_BUILD |
| 2041 | UWORD8 *pu1_pic_no_loop_filter_flag; |
| 2042 | #else |
| 2043 | UWORD8 *apu1_pic_no_loop_filter_flag[2]; |
| 2044 | #endif |
| 2045 | /** |
| 2046 | * MV Bank buffer manager |
| 2047 | */ |
| 2048 | void *pv_mv_buf_mgr; |
| 2049 | |
| 2050 | /** |
| 2051 | * Pointer to MV Buf structure array |
| 2052 | */ |
| 2053 | void *ps_mv_buf; |
| 2054 | |
| 2055 | /** |
| 2056 | * Base address for Motion Vector bank buffer |
| 2057 | */ |
| 2058 | void *pv_mv_bank_buf_base; |
| 2059 | |
| 2060 | /** |
| 2061 | * MV Bank size allocated |
| 2062 | */ |
| 2063 | WORD32 i4_total_mv_bank_size; |
| 2064 | |
| 2065 | /** |
| 2066 | * Picture buffer manager |
| 2067 | */ |
| 2068 | void *pv_pic_buf_mgr; |
| 2069 | |
| 2070 | /** |
| 2071 | * Pointer to Pic Buf structure array |
| 2072 | */ |
| 2073 | void *ps_pic_buf; |
| 2074 | |
| 2075 | /** |
| 2076 | * Base address for Picture buffer |
| 2077 | */ |
| 2078 | void *pv_pic_buf_base; |
| 2079 | |
| 2080 | /** |
| 2081 | * Total pic buffer size allocated |
| 2082 | */ |
| 2083 | WORD32 i4_total_pic_buf_size; |
| 2084 | |
| 2085 | |
| 2086 | /** |
| 2087 | * Picture buffer manager |
| 2088 | */ |
| 2089 | void *pv_disp_buf_mgr; |
| 2090 | |
| 2091 | /** |
| 2092 | * Current display buffer's buffer ID |
| 2093 | */ |
| 2094 | WORD32 i4_disp_buf_id; |
| 2095 | |
| 2096 | /** |
| 2097 | * Current display buffer |
| 2098 | */ |
| 2099 | pic_buf_t *ps_disp_buf; |
| 2100 | |
| 2101 | /** |
| 2102 | * Pointer to dpb manager structure |
| 2103 | */ |
| 2104 | void *pv_dpb_mgr; |
| 2105 | |
| 2106 | /** |
| 2107 | * Scaling matrices for each PPS |
| 2108 | */ |
| 2109 | WORD16 *pi2_scaling_mat; |
| 2110 | |
| 2111 | /** |
| 2112 | * Array containing Tile information for each PPS |
| 2113 | */ |
| 2114 | tile_t *ps_tile; |
| 2115 | |
| 2116 | /** |
| 2117 | * Timestamp associated with the current display output |
| 2118 | */ |
| 2119 | UWORD32 u4_ts; |
| 2120 | |
| 2121 | /** |
| 2122 | * Pointer to base of Video parameter set structure array |
| 2123 | */ |
| 2124 | vps_t *ps_vps_base; |
| 2125 | |
| 2126 | /** |
| 2127 | * Pointer to base of Sequence parameter set structure array |
| 2128 | */ |
| 2129 | sps_t *ps_sps_base; |
| 2130 | |
| 2131 | /** |
| 2132 | * Pointer to base of Picture parameter set structure array |
| 2133 | */ |
| 2134 | pps_t *ps_pps_base; |
| 2135 | |
| 2136 | /** |
| 2137 | * Pointer to base of slice header structure array |
| 2138 | */ |
| 2139 | #ifndef GPU_BUILD |
| 2140 | slice_header_t *ps_slice_hdr_base; |
| 2141 | #else |
| 2142 | slice_header_t *aps_slice_hdr_base[2]; |
| 2143 | #endif |
| 2144 | /** |
| 2145 | * Pointer to base of entry point offsets in a frame |
| 2146 | */ |
| 2147 | WORD32 *pi4_entry_ofst; |
| 2148 | |
| 2149 | /** |
| 2150 | * Current offset in pi4_entry_ofst |
| 2151 | */ |
| 2152 | WORD32 i4_cur_entry_ofst; |
| 2153 | |
| 2154 | /** |
| 2155 | * Parsing context |
| 2156 | */ |
| 2157 | parse_ctxt_t s_parse; |
| 2158 | |
| 2159 | /** |
| 2160 | * Processing context - One for each processing thread |
| 2161 | */ |
| 2162 | process_ctxt_t as_process[MAX_PROCESS_THREADS]; |
| 2163 | |
| 2164 | /** |
| 2165 | * Thread handle for each of the processing threads |
| 2166 | */ |
| 2167 | void *apv_process_thread_handle[MAX_PROCESS_THREADS]; |
| 2168 | |
| 2169 | /** |
| 2170 | * Thread created flag for each of the processing threads |
| 2171 | */ |
| 2172 | WORD32 ai4_process_thread_created[MAX_PROCESS_THREADS]; |
| 2173 | |
| 2174 | /** |
| 2175 | * Void pointer to process job context |
| 2176 | */ |
| 2177 | void *pv_proc_jobq; |
| 2178 | |
| 2179 | /* Number of CTBs processed together for better instruction cache handling */ |
| 2180 | WORD32 i4_proc_nctb; |
| 2181 | |
| 2182 | /** |
| 2183 | * Previous POC lsb |
| 2184 | */ |
| 2185 | WORD32 i4_prev_poc_lsb; |
| 2186 | |
| 2187 | /** |
| 2188 | * Previous POC msb |
| 2189 | */ |
| 2190 | WORD32 i4_prev_poc_msb; |
| 2191 | |
| 2192 | /** |
| 2193 | * Max POC lsb that has arrived till now |
| 2194 | */ |
| 2195 | WORD32 i4_max_prev_poc_lsb; |
| 2196 | |
| 2197 | /** Context for format conversion */ |
| 2198 | fmt_conv_t s_fmt_conv; |
| 2199 | |
| 2200 | /** Pointer to a structure describing output display buffer */ |
| 2201 | ivd_out_bufdesc_t *ps_out_buffer; |
| 2202 | /** |
| 2203 | * Variable to store the next ctb count to compute pu idx |
| 2204 | */ |
| 2205 | WORD32 i4_next_pu_ctb_cnt; |
| 2206 | |
| 2207 | /** |
| 2208 | * Variable to store the next ctb count to compute tu idx |
| 2209 | */ |
| 2210 | WORD32 i4_next_tu_ctb_cnt; |
| 2211 | |
| 2212 | /** Active SPS id - mainly to be used during codec initializations in shared mode */ |
| 2213 | WORD32 i4_sps_id; |
| 2214 | |
| 2215 | /** Number of ctbs to be decoded in one process call */ |
| 2216 | UWORD32 u4_nctb; |
| 2217 | |
| 2218 | /** Flag to enable scheduling of format conversion jobs ahead of processing jobs */ |
| 2219 | UWORD32 u4_enable_fmt_conv_ahead; |
| 2220 | |
| 2221 | /** Mask used to change MVs to full pel when configured to run in reduced complexity mode */ |
| 2222 | WORD32 i4_mv_frac_mask; |
| 2223 | #ifdef GPU_BUILD |
| 2224 | /* Two bits per edge. |
| 2225 | Stored in format. BS[15] | BS[14] | .. |BS[0]*/ |
| 2226 | UWORD32 *apu4_pic_vert_bs[2]; |
| 2227 | |
| 2228 | /** |
| 2229 | * Horizontal Boundary strength |
| 2230 | */ |
| 2231 | |
| 2232 | /* Two bits per edge. |
| 2233 | Stored in format. BS[15] | BS[14] | .. |BS[0]*/ |
| 2234 | UWORD32 *apu4_pic_horz_bs[2]; |
| 2235 | |
| 2236 | /** |
| 2237 | * Flags to indicate if QP is constant through out a CTB - 1 bit for each CTB |
| 2238 | * The bits are packed from LSB to MSB |
| 2239 | * To get the flag corresponding to CTB with (ctb_x, ctb_y), use |
| 2240 | * pu4_qp_const_in_ctb[(ctb_x + pic_wd_in_ctb * ctb_y) >> 3] & (1 << ((ctb_x + pic_wd_in_ctb * ctb_y) & 7)) |
| 2241 | */ |
| 2242 | UWORD8 *apu1_pic_qp_const_in_ctb[2]; |
| 2243 | |
| 2244 | /** |
| 2245 | * Qp array stored for each 8x8 pixels |
| 2246 | */ |
| 2247 | UWORD8 *apu1_pic_qp[2]; |
| 2248 | |
| 2249 | /** |
| 2250 | * Pointer to frame level sao_t for the current frame being parsed |
| 2251 | */ |
| 2252 | sao_t *aps_pic_sao[2]; |
| 2253 | |
| 2254 | /* GPU context structure */ |
| 2255 | gpu_ctxt_t s_gpu_ctxt; |
| 2256 | |
| 2257 | /* Flag to switch bw MC on GPU and CPU dynamically */ |
| 2258 | UWORD32 u4_gpu_enabled; |
| 2259 | |
| 2260 | /* Variable to store the view(ping or pong) for parsing */ |
| 2261 | UWORD32 u4_parsing_view; |
| 2262 | |
| 2263 | /* |
| 2264 | * Set the flag to remember to add the frame for flushing |
| 2265 | * call is a flush call. |
| 2266 | */ |
| 2267 | UWORD32 u4_add_last_frame; |
| 2268 | #endif |
| 2269 | /** Funtion pointers for inter_pred leaf level functions */ |
| 2270 | pf_inter_pred apf_inter_pred[22]; |
| 2271 | |
| 2272 | /** Funtion pointers for inter_pred_luma leaf level functions */ |
| 2273 | pf_intra_pred apf_intra_pred_luma[11]; |
| 2274 | |
| 2275 | /** Funtion pointers for inter_pred_chroma leaf level functions */ |
| 2276 | pf_intra_pred apf_intra_pred_chroma[11]; |
| 2277 | |
| 2278 | /** Funtion pointers for itrans_recon leaf level functions */ |
| 2279 | pf_itrans_recon apf_itrans_recon[8]; |
| 2280 | |
| 2281 | /** Funtion pointers for recon leaf level functions */ |
| 2282 | pf_recon apf_recon[8]; |
| 2283 | |
| 2284 | /** Funtion pointers for itrans_recon_dc leaf level functions */ |
| 2285 | pf_itrans_recon_dc apf_itrans_recon_dc[2]; |
| 2286 | |
| 2287 | /** Funtion pointers for sao_luma leaf level functions */ |
| 2288 | pf_sao_luma apf_sao_luma[4]; |
| 2289 | |
| 2290 | /** Funtion pointers for sao_chroma leaf level functions */ |
| 2291 | pf_sao_chroma apf_sao_chroma[4]; |
| 2292 | |
| 2293 | /** Funtion pointers for all the leaf level functions */ |
| 2294 | func_selector_t s_func_selector; |
| 2295 | /** Processor architecture */ |
| 2296 | IVD_ARCH_T e_processor_arch; |
| 2297 | /** Processor soc */ |
| 2298 | IVD_SOC_T e_processor_soc; |
| 2299 | }; |
| 2300 | |
| 2301 | #endif /* _IHEVCD_STRUCTS_H_ */ |