• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *  ihevc_structs.h
23  *
24  * @brief
25  *  Structure definitions used in the code
26  *
27  * @author
28  *  Ittiam
29  *
30  * @par List of Functions:
31  *
32  * @remarks
33  *  None
34  *
35  *******************************************************************************
36  */
37 
38 #ifndef _IHEVC_STRUCTS_H_
39 #define _IHEVC_STRUCTS_H_
40 
41 /**
42  * Picture buffer
43  */
44 typedef struct
45 {
46     UWORD8 *pu1_luma;
47     UWORD8 *pu1_chroma;
48 
49     WORD32 i4_abs_poc;
50     WORD32 i4_poc_lsb;
51     /** Used to store display Timestamp for current buffer */
52     WORD32 u4_ts;
53     UWORD8 u1_used_as_ref;
54 
55     UWORD8 u1_free_delay_cnt;
56 
57     /**
58      * buffer ID from buffer manager
59      */
60     UWORD8 u1_buf_id;
61 
62 }pic_buf_t;
63 
64 
65 /**
66  * Reference List
67  */
68 typedef struct
69 {
70     void *pv_pic_buf;
71 
72     void *pv_mv_buf;
73 
74     UWORD8 u1_used_as_ref;
75 
76 }ref_list_t;
77 
78 
79 /**
80  * SAO
81  */
82 typedef struct
83 {
84     /**
85      * sao_type_idx_luma
86      */
87     UWORD32      b3_y_type_idx   : 3;
88 
89     /**
90      * luma SaoOffsetVal[1]
91      */
92     WORD32      b4_y_offset_1   : 4;
93 
94     /**
95      * luma SaoOffsetVal[2]
96      */
97     WORD32      b4_y_offset_2   : 4;
98 
99     /**
100      * luma SaoOffsetVal[3]
101      */
102     WORD32      b4_y_offset_3   : 4;
103 
104     /**
105      * luma SaoOffsetVal[4]
106      */
107     WORD32      b4_y_offset_4   : 4;
108 
109     /**
110      * luma sao_band_position
111      */
112     UWORD32      b5_y_band_pos   : 5;
113 
114     WORD32                      : 0;
115 
116     /**
117      * sao_type_idx_chroma
118      */
119     UWORD32      b3_cb_type_idx  : 3;
120 
121     /**
122      * chroma SaoOffsetVal[1]
123      */
124     WORD32      b4_cb_offset_1  : 4;
125 
126     /**
127      * chroma SaoOffsetVal[2]
128      */
129     WORD32      b4_cb_offset_2  : 4;
130 
131     /**
132      * chroma SaoOffsetVal[3]
133      */
134     WORD32      b4_cb_offset_3  : 4;
135 
136     /**
137      * chroma SaoOffsetVal[4]
138      */
139     WORD32      b4_cb_offset_4  : 4;
140 
141     /**
142      * cb sao_band_position
143      */
144     UWORD32      b5_cb_band_pos  : 5;
145 
146     WORD32                      : 0;
147 
148     /**
149      * sao_type_idx_chroma
150      */
151     UWORD32      b3_cr_type_idx  : 3;
152 
153     /**
154      * chroma SaoOffsetVal[1]
155      */
156     WORD32      b4_cr_offset_1  : 4;
157 
158     /**
159      * chroma SaoOffsetVal[2]
160      */
161     WORD32      b4_cr_offset_2  : 4;
162 
163     /**
164      * chroma SaoOffsetVal[3]
165      */
166     WORD32      b4_cr_offset_3  : 4;
167 
168     /**
169      * chroma SaoOffsetVal[4]
170      */
171     WORD32      b4_cr_offset_4  : 4;
172 
173     /**
174      * cr sao_band_position
175      */
176     UWORD32      b5_cr_band_pos  : 5;
177 
178     WORD32                      : 0;
179 
180 }sao_t;
181 
182 /**
183  * SAO
184  */
185 typedef struct
186 {
187     /**
188      * sao_type_idx_luma
189      */
190     UWORD32      b3_y_type_idx   : 3;
191 
192     /**
193      * luma SaoOffsetVal[1]
194      */
195     WORD32      b8_y_offset_1   : 8;
196 
197     /**
198      * luma SaoOffsetVal[2]
199      */
200     WORD32      b8_y_offset_2   : 8;
201 
202     /**
203      * luma SaoOffsetVal[3]
204      */
205     WORD32      b8_y_offset_3   : 8;
206 
207     /**
208      * luma SaoOffsetVal[4]
209      */
210     WORD32      b8_y_offset_4   : 8;
211 
212     /**
213      * luma sao_band_position
214      */
215     UWORD32      b5_y_band_pos   : 5;
216 
217     WORD32                      : 0;
218 
219     /**
220      * sao_type_idx_chroma
221      */
222     UWORD32      b3_cb_type_idx  : 3;
223 
224     /**
225      * chroma SaoOffsetVal[1]
226      */
227     WORD32      b8_cb_offset_1  : 8;
228 
229     /**
230      * chroma SaoOffsetVal[2]
231      */
232     WORD32      b8_cb_offset_2  : 8;
233 
234     /**
235      * chroma SaoOffsetVal[3]
236      */
237     WORD32      b8_cb_offset_3  : 8;
238 
239     /**
240      * chroma SaoOffsetVal[4]
241      */
242     WORD32      b8_cb_offset_4  : 8;
243 
244     /**
245      * cb sao_band_position
246      */
247     UWORD32      b5_cb_band_pos  : 5;
248 
249     WORD32                      : 0;
250 
251     /**
252      * sao_type_idx_chroma
253      */
254     UWORD32      b3_cr_type_idx  : 3;
255 
256     /**
257      * chroma SaoOffsetVal[1]
258      */
259     WORD32      b8_cr_offset_1  : 8;
260 
261     /**
262      * chroma SaoOffsetVal[2]
263      */
264     WORD32      b8_cr_offset_2  : 8;
265 
266     /**
267      * chroma SaoOffsetVal[3]
268      */
269     WORD32      b8_cr_offset_3  : 8;
270 
271     /**
272      * chroma SaoOffsetVal[4]
273      */
274     WORD32      b8_cr_offset_4  : 8;
275 
276     /**
277      * cr sao_band_position
278      */
279     UWORD32      b5_cr_band_pos  : 5;
280 
281     WORD32                      : 0;
282 
283 }sao_10bd_t;
284 
285 /**
286  * Motion vector
287  */
288 typedef struct
289 {
290     /**
291      * Horizontal Motion Vector
292      */
293     WORD16 i2_mvx;
294 
295     /**
296      * Vertical Motion Vector
297      */
298     WORD16 i2_mvy;
299 }mv_t;
300 
301 /*****************************************************************************/
302 /* Following results in packed 48 bit structure. If mv_t included            */
303 /*  ref_pic_buf_id, then 8 bits will be wasted for each mv for aligning.     */
304 /*  Also using mv_t as elements directly instead of a pointer to l0 and l1   */
305 /*  mvs. Since pointer takes 4 bytes and MV itself is 4 bytes. It does not   */
306 /*  really help using pointers.                                              */
307 /*****************************************************************************/
308 
309 /**
310  * PU Motion Vector info
311  */
312 typedef struct
313 {
314     /**
315      *  L0 Motion Vector
316      */
317     mv_t s_l0_mv;
318 
319     /**
320      *  L1 Motion Vector
321      */
322     mv_t s_l1_mv;
323 
324     /**
325      *  L0 Ref index
326      */
327     WORD8   i1_l0_ref_idx;
328 
329     /**
330      *  L1 Ref index
331      */
332     WORD8   i1_l1_ref_idx;
333 
334     /**
335      *  L0 Ref Pic Buf ID
336      */
337     WORD8 i1_l0_ref_pic_buf_id;
338 
339     /**
340      *  L1 Ref Pic Buf ID
341      */
342     WORD8 i1_l1_ref_pic_buf_id;
343 
344 }pu_mv_t;
345 
346 /**
347  * PU information
348  */
349 typedef struct
350 {
351 
352     /**
353      *  PU motion vectors
354      */
355     pu_mv_t     mv;
356 
357     /**
358      *  PU X position in terms of min PU (4x4) units
359      */
360     UWORD32     b4_pos_x        : 4;
361 
362     /**
363      *  PU Y position in terms of min PU (4x4) units
364      */
365     UWORD32     b4_pos_y        : 4;
366 
367     /**
368      *  PU width in pixels = (b4_wd + 1) << 2
369      */
370     UWORD32     b4_wd           : 4;
371 
372     /**
373      *  PU height in pixels = (b4_ht + 1) << 2
374      */
375     UWORD32     b4_ht           : 4;
376 
377     /**
378      *  Intra or Inter flag for each partition - 0 or 1
379      */
380     UWORD32     b1_intra_flag   : 1;
381 
382 
383     /**
384      *  PRED_L0, PRED_L1, PRED_BI - Initialized in parsing only for MVP case
385      */
386     UWORD32     b2_pred_mode    : 2;
387 
388 
389 /**
390      *  Merge flag for each partition - 0 or 1
391      */
392     UWORD32     b1_merge_flag   : 1;
393 
394     /**
395      *  Merge index for each partition - 0 to 4
396      */
397     UWORD32     b3_merge_idx    : 3;
398 
399     /*************************************************************************/
400     /* Following two flags can be overloaded with b3_merge_idx if there      */
401     /* is need for additional bits                                           */
402     /*************************************************************************/
403 
404     /**
405      *  If merge is zero, following gives presence of mvd for L0 MV
406      */
407     UWORD32     b1_l0_mvp_idx   : 1;
408 
409     /**
410      *  If merge is zero, following gives presence of mvd for L1 MV
411      */
412     UWORD32     b1_l1_mvp_idx   : 1;
413 
414     /**
415      * Partition mode - Needed during MV merge stage
416      * Note: Part mode can be derived using pu_wd, pu_ht and minCB size
417      * If there is a need for bits, the following can be removed at the cost
418      * of more control code in MV Merge
419      */
420     UWORD32      b3_part_mode    : 3;
421 
422     /**
423      * Partition index - Needed during MV merge stage
424      */
425     UWORD32      b2_part_idx     : 2;
426 
427 
428 }pu_t;
429 
430 /**
431  * TU information
432  */
433 typedef struct
434 {
435     /**
436      *  TU X position in terms of min TU (4x4) units
437      */
438     UWORD32      b4_pos_x            : 4;
439 
440     /**
441      *  TU Y position in terms of min TU (4x4) units
442      */
443     UWORD32     b4_pos_y            : 4;
444 
445 
446     /*************************************************************************/
447     /* Luma TU size (width or height) = 1 << (b3_size + 2)                   */
448     /*   i.e. 0 : 4, 1 : 8, 2: 16, 3: 32, 4: 64                              */
449     /* Note: Though 64 x 64 TU is not possible, this size is supported to    */
450     /* signal SKIP CUs or PCM CUs etc where transform is not called          */
451     /* Chroma width will be half of luma except for 4x4 luma                 */
452     /*************************************************************************/
453     /**
454      * Luma TU size (width or height)
455      */
456     UWORD32     b3_size             : 3; //To be changed.
457 
458     /*************************************************************************/
459     /* Chroma present : For 4x4 Luma TUs only the fourth one contains Cb     */
460     /* Cr info. For the first three TUs in 8x8 (for 4x4 luma) this will      */
461     /* be zero. For all the other cases this will be 1                       */
462     /*************************************************************************/
463 
464     /**
465      * 4x4 Luma TUs only the fourth one contains cb,cr
466      * TODO: Check if this is really needed, cb_cbf and cr_cbf should be enough
467      */
468     //UWORD32      b1_chroma_present   : 1;
469 
470     /**
471      *  Y CBF
472      */
473     UWORD32      b1_y_cbf            : 1;
474 
475     /**
476      *  Cb CBF
477      */
478     UWORD32      b1_cb_cbf           : 1;
479 
480     /**
481      *  Cr CBF
482      */
483     UWORD32     b1_cr_cbf           : 1;
484 
485 
486     /**
487      *  Flag to indicate if it is the first TU in a CU
488      */
489     UWORD32     b1_first_tu_in_cu       : 1;
490 
491     /**
492      *  Transform quant bypass flag
493      */
494     UWORD32     b1_transquant_bypass  : 1;
495 
496     /**
497      *  Y Qp
498      */
499     //UWORD32     b6_qp               : 6; // BUG_FIX related to nighbour QP's in case of negative QP for HBD.
500     WORD32     b7_qp               : 7;
501 
502 
503     /**
504      *  Luma Intra Mode 0 - 34
505      */
506     UWORD32    b6_luma_intra_mode      : 6;
507 
508     /*************************************************************************/
509     /* Chroma Intra Mode Index 0 - 4: Actual mode (0, 1, 10, 26, 34, X) to be*/
510     /* derived using luma_intra_mode and the following                       */
511     /*************************************************************************/
512     /**
513      * Chroma Intra Mode Index 0 - 4
514      */
515     UWORD32    b3_chroma_intra_mode_idx    : 3;
516 
517 
518 }tu_t;
519 
520 /**
521  * CU information
522  */
523 typedef struct
524 {
525 
526     /**
527      *  CU X position in terms of min CU (8x8) units
528      */
529     UWORD32 b3_cu_pos_x :3;
530 
531     /**
532      *  CU Y position in terms of min CU (8x8) units
533      */
534     UWORD32 b3_cu_pos_y :3;
535 
536     /**
537      *  CU size in terms of min CU (8x8) units
538      */
539     UWORD32 b4_cu_size :4;
540 
541     /**
542      *  transquant bypass flag ; 0 for this encoder
543      */
544     UWORD32 b1_tq_bypass_flag :1;
545 
546     /**
547      *  CU skip flag
548      */
549     UWORD32 b1_skip_flag :1;
550 
551     /**
552      *  intra / inter CU flag
553      */
554     UWORD32 b1_pred_mode_flag :1;
555 
556     /**
557      *  indicates partition information for CU
558      *  For intra 0 : for 2Nx2N / 1 for NxN iff CU=minCBsize
559      *  For inter 0 : @sa PART_SIZE_E
560      */
561     UWORD32 b3_part_mode :3;
562 
563     /**
564      *  0 for this encoder
565      */
566     UWORD32 b1_pcm_flag :1;
567 
568     /**
569      *  only applicable for intra cu
570      */
571     UWORD32 b3_chroma_intra_pred_mode :3;
572 
573     /**
574      * only applicable for intra cu
575      */
576     UWORD32 b1_prev_intra_luma_pred_flag0 :1;
577 
578     /**
579      * only applicable for intra cu and pred_mode=NxN
580      */
581     UWORD32 b1_prev_intra_luma_pred_flag1 :1;
582 
583     /**
584      * only applicable for intra cu and pred_mode=NxN
585      */
586     UWORD32 b1_prev_intra_luma_pred_flag2 :1;
587 
588     /**
589      * only applicable for intra cu and pred_mode=NxN
590      */
591     UWORD32 b1_prev_intra_luma_pred_flag3 :1;
592 
593     /**
594      *  only applicable for luma intra cu
595      */
596     UWORD32 b2_mpm_idx0 :2;
597 
598     /**
599      *  only applicable for intra cu and pred_mode=NxN
600      */
601     UWORD32 b2_mpm_idx1 :2;
602 
603     /**
604      *  only applicable for intra cu and pred_mode=NxN
605      */
606     UWORD32 b2_mpm_idx2 :2;
607 
608     /**
609      *  only applicable for intra cu and pred_mode=NxN
610      */
611     UWORD32 b2_mpm_idx3 :2;
612 
613     /**
614      *  only applicable for intra cu
615      */
616     UWORD32 b5_rem_intra_pred_mode0 :5;
617 
618     /**
619      *  only applicable for intra cu and pred_mode=NxN
620      */
621     UWORD32 b5_rem_intra_pred_mode1 :5;
622 
623     /**
624      *  only applicable for intra cu and pred_mode=NxN
625      */
626     UWORD32 b5_rem_intra_pred_mode2 :5;
627 
628     /**
629      *  only applicable for intra cu and pred_mode=NxN
630      */
631     UWORD32 b5_rem_intra_pred_mode3 :5;
632 
633     /**
634      *  no residue flag for cu
635      */
636     UWORD32 b1_no_residual_syntax_flag :1;
637 
638 }cu_t;
639 
640 /*****************************************************************************/
641 /* Since the following data will be accessed linearly (no random access      */
642 /*  is needed for this) there is no need to store a frame level offset for   */
643 /*  each CTB's TU data. Only a pointer to this is stored in CTB's structure  */
644 /*****************************************************************************/
645 
646 typedef struct
647 {
648     /*************************************************************************/
649     /* Number of TUs filled in as_tu                                         */
650     /* Having the first entry as 32 bit data, helps in keeping each of       */
651     /* the structures aligned to 32 bits at CTB level                        */
652     /*************************************************************************/
653     /**
654      * Number of TUs filled in as_tu
655      */
656     WORD32 i4_tu_cnt;
657 
658     /**
659      *  Array to map each min TU unit to a corresponding entry in as_tu
660      */
661     UWORD8 au1_tu_map[MAX_TU_IN_CTB];
662 
663     /*************************************************************************/
664     /* TU level information                                                  */
665     /* Though the allocation for as_pu as done to handle worst case data,    */
666     /* only valid number of TUs will be filled in the following array.       */
667     /* Next CTB starts after the valid as_tu entries                         */
668     /*************************************************************************/
669     /**
670      *  TU level information
671      */
672     tu_t as_tu[MAX_TU_IN_CTB];
673 
674 }ctb_tu_list_t;
675 
676 /*****************************************************************************/
677 /* Info from last TU row of CTB is stored in a row level neighbour buffer    */
678 /* , which will be used for Boundary Strength computation                    */
679 /*****************************************************************************/
680 /**
681  *  CTB neighbor info
682  */
683 typedef struct
684 {
685     /**
686      *  Slice index of the ctb
687      */
688     UWORD16 u2_slice_idx;
689 
690     /*************************************************************************/
691     /* CBF of bottom TU row (replicated in 4 pixel boundary)                 */
692     /* MSB contains CBF of first TU in the last row and LSB contains CBF     */
693     /* of last TU in the last row                                            */
694     /*************************************************************************/
695     /**
696      * CBF of bottom TU row
697      */
698     UWORD16 u2_packed_cbf;
699 
700     /*************************************************************************/
701     /* QP of bottom TU row (replicated at 8 pixel boundary (Since QP can     */
702     /* not change at less than min CU granularity)                           */
703     /*************************************************************************/
704     /**
705      * QP of bottom TU row
706      */
707     UWORD8 au1_qp[MAX_CU_IN_CTB_ROW];
708 
709 }ctb_top_ny_info_t;
710 
711 /**
712  *  CTB level info
713  */
714 typedef struct _ctb_t
715 {
716     /*************************************************************************/
717     /* Tile boundary can be detected by looking at tile start x and tile     */
718     /* start y.  And based on the tile, slice and frame boundary the         */
719     /* following will be initialized.                                        */
720     /*************************************************************************/
721     /**
722      *  Pointer to left CTB
723      */
724     /*  If not available, this will be set to NULL   */
725     struct _ctb_t *ps_ctb_left;
726 
727     /**
728      *  Pointer to top-left CTB
729      */
730     /* If not available, this will be set to NULL   */
731     ctb_top_ny_info_t *ps_ctb_ny_topleft;
732 
733     /**
734      *  Pointer to top CTB
735      */
736     /* If not available, this will be set to NULL  */
737     ctb_top_ny_info_t *ps_ctb_ny_top;
738 
739     /**
740      *  Pointer to top-right CTB
741      */
742     /* If not available, this will be set to NULL */
743     ctb_top_ny_info_t *ps_ctb_ny_topright;
744 
745     /*************************************************************************/
746     /* Pointer to PU data.                                                   */
747     /* This points to a MV Bank stored at frame level. Though this           */
748     /* pointer can be derived by reading offset at frame level, it is        */
749     /* stored here for faster access. Can be removed if storage of CTB       */
750     /* structure is critical                                                 */
751     /*************************************************************************/
752     /**
753      * Pointer to PU data
754      */
755     pu_t *ps_pu;
756 
757     /*************************************************************************/
758     /* Pointer to a PU map stored at frame level,                            */
759     /* Though this pointer can be derived by multiplying CTB adress with     */
760     /* number of minTUs in a CTB, it is stored here for faster access.       */
761     /* Can be removed if storage of CTB structure is critical                */
762     /*************************************************************************/
763     /**
764      * Pointer to a PU map stored at frame level
765      */
766     UWORD8 *pu1_pu_map;
767 
768     /**
769      *  Number of TUs filled in as_tu
770      */
771     /*************************************************************************/
772     /* Having the first entry as 32 bit data, helps in keeping each of       */
773     /* the structures aligned to 32 bits at CTB level                        */
774     /*************************************************************************/
775     WORD32 i4_tu_cnt;
776 
777     /**
778      *  Array to map each min TU unit to a corresponding entry in as_tu
779      */
780     UWORD8 *pu1_tu_map;
781 
782     /**
783      *  TU level information
784      */
785     /*************************************************************************/
786     /* Though the allocation for as_pu as done to handle worst case data,    */
787     /* only valid number of TUs will be filled in the following array.       */
788     /* Next CTB starts after the valid as_tu entries                         */
789     /*************************************************************************/
790     tu_t *ps_tu;
791 
792     /**
793      *  Pointer to transform coeff data
794      */
795     /*************************************************************************/
796     /* Following format is repeated for every coded TU                       */
797     /* Luma Block                                                            */
798     /* num_coeffs      : 16 bits                                             */
799     /* zero_cols       : 8 bits ( 1 bit per 4 columns)                       */
800     /* sig_coeff_map   : ((TU Size * TU Size) + 31) >> 5 number of WORD32s   */
801     /* coeff_data      : Non zero coefficients                               */
802     /* Cb Block (only for last TU in 4x4 case else for every luma TU)        */
803     /* num_coeffs      : 16 bits                                             */
804     /* zero_cols       : 8 bits ( 1 bit per 4 columns)                       */
805     /* sig_coeff_map   : ((TU Size * TU Size) + 31) >> 5 number of WORD32s   */
806     /* coeff_data      : Non zero coefficients                               */
807     /* Cr Block (only for last TU in 4x4 case else for every luma TU)        */
808     /* num_coeffs      : 16 bits                                             */
809     /* zero_cols       : 8 bits ( 1 bit per 4 columns)                       */
810     /* sig_coeff_map   : ((TU Size * TU Size) + 31) >> 5 number of WORD32s   */
811     /* coeff_data      : Non zero coefficients                               */
812     /*************************************************************************/
813     void            *pv_coeff_data;
814 
815     /**
816      *  Slice to which the CTB belongs to
817      */
818     WORD32 i4_slice_idx;
819 
820     /**
821      *  CTB column position
822      */
823     WORD32 i4_pos_x;
824 
825     /**
826      *  CTB row position
827      */
828     WORD32 i4_pos_y;
829 
830     /**
831      *  Number of PUs filled in ps_pu
832      */
833     WORD32 i4_pu_cnt;
834 
835     /**
836      *  Index of current PU being processed in ps_pu
837      */
838     /*  Scratch variable set to 0 at the start of any PU processing function */
839     WORD32 i4_pu_idx;
840 
841     /**
842      * Vertical Boundary strength
843      */
844     /* Two bits per edge.
845     Stored in format. BS[15] | BS[14] | .. |BS[0]*/
846     UWORD32 *pu4_vert_bs;
847 
848     /**
849      * Horizontal Boundary strength
850      */
851 
852     /* Two bits per edge.
853     Stored in format. BS[15] | BS[14] | .. |BS[0]*/
854     UWORD32 *pu4_horz_bs;
855 
856     /**
857      *  Qp array stored for each 8x8 pixels
858      */
859     UWORD8 *pu1_qp;
860 
861     /**
862      *  Pointer to current frame's pu_t array
863      */
864     pu_t *ps_frm_pu;
865 
866     /**
867      * Pointer to current frame's pu_t index array, which stores starting index
868      * of pu_t for every CTB
869      */
870     UWORD32 *pu4_frm_pu_idx;
871 
872     /**
873      *  Pointer to current frame's pu map array
874      */
875     UWORD8 *pu1_frm_pu_map;
876 
877     /*************************************************************************/
878     /* Need to add encoder specific elements for identifying the order of    */
879     /* coding for CU, TU and PU if any                                       */
880     /*************************************************************************/
881 }ctb_t;
882 
883 /*****************************************************************************/
884 /* The following can be used to typecast coefficient data that is stored     */
885 /*  per subblock. Note that though i2_level is shown as an array that        */
886 /*  holds 16 coefficients, only the first few entries will be valid. Next    */
887 /*  subblocks data starts after the valid number of coefficients. Number     */
888 /*  of non-zero coefficients will be derived using number of non-zero bits   */
889 /*  in sig coeff map                                                         */
890 /*****************************************************************************/
891 /**
892  * Structure to hold coefficient info for a 4x4 subblock
893  */
894 typedef struct
895 {
896     /**
897      * sub block position
898      */
899     UWORD16 u2_subblk_pos;
900 
901     /**
902      * significant coefficient map
903      */
904     UWORD16 u2_sig_coeff_map;
905 
906     /**
907      * holds 16 coefficients
908      */
909     WORD16  ai2_level[SUBBLK_COEFF_CNT];
910 }tu_sblk_coeff_data_t;
911 
912 
913 
914 /*************************************************************************/
915 /* The following describes how each of the CU cases are handled          */
916 /*************************************************************************/
917 
918 /*************************************************************************/
919 /* For SKIP CU                                                           */
920 /* One Inter PU with appropriate MV                                      */
921 /* One TU which says Y, Cb and Cr CBF is zero with size equal to CB size */
922 /*************************************************************************/
923 
924 /*************************************************************************/
925 /* For Inter CU                                                          */
926 /* M Inter PU with appropriate MVs (M between 1 to 4)                    */
927 /* N TU (N is number of TU in CU)                                        */
928 /*************************************************************************/
929 
930 /*************************************************************************/
931 /* For Intra CU                                                          */
932 /* N TU (N is number of TU in CU)                                        */
933 /* N Intra PU with appropriate pred modes for luma and chroma            */
934 /*************************************************************************/
935 
936 /*************************************************************************/
937 /* For Intra PCM CU                                                      */
938 /* One TU which says transquant bypass is 1  with size equal to CB size  */
939 /* 1 Intra PU with pcm flag set to 1(which ensures no intra pred is done)*/
940 /*************************************************************************/
941 
942 /*************************************************************************/
943 /* For a CU where cu_transquant_bypass_flag is 1                         */
944 /* One TU which says transquant bypass is 1  with size equal to CB size  */
945 /* N Intra/Inter PUs                                                     */
946 /*************************************************************************/
947 
948 /*************************************************************************/
949 /* For a CU where no_residual_syntax_flag is 1                           */
950 /* One TU which says Y, Cb, Cr CBF is 0  with size equal to CB size      */
951 /* N Inter PUs                                                           */
952 /*************************************************************************/
953 
954 
955 /**
956  * Structure giving information about the tile
957  */
958 typedef struct
959 {
960     /* X position of the tile in the current frame in CTB units */
961     UWORD8 u1_pos_x;
962 
963     /* Y position of the tile in the current frame in CTB units */
964     UWORD8 u1_pos_y;
965 
966     /* Tile width in CTB units */
967     UWORD16 u2_wd;
968 
969     /* Tile height in CTB units */
970     UWORD16 u2_ht;
971 
972 }tile_t;
973 
974 /**
975  * Structure to hold Profile tier level info for a given layer
976  */
977 
978 typedef struct
979 {
980     /**
981      *  NAL unit type
982      */
983     WORD8 i1_nal_unit_type;
984 
985     /**
986      *  NAL temporal id
987      */
988     WORD8 i1_nuh_temporal_id;
989 }nal_header_t;
990 
991 /**
992  * Structure to hold Profile tier level info for a given layer
993  */
994 
995 typedef struct
996 {
997     /**
998      *  profile_space
999      */
1000     WORD8 i1_profile_space;
1001 
1002     /**
1003      *  tier_flag
1004      */
1005     WORD8 i1_tier_flag;
1006 
1007     /**
1008      *  profile_idc
1009      */
1010     WORD8 i1_profile_idc;
1011 
1012     /**
1013      *  profile_compatibility_flag[]
1014      */
1015     WORD8 ai1_profile_compatibility_flag[MAX_PROFILE_COMPATBLTY];
1016 
1017     /**
1018      * progressive_source_flag
1019      */
1020     WORD8 i1_general_progressive_source_flag;
1021 
1022     /**
1023      * interlaced_source_flag
1024      */
1025     WORD8 i1_general_interlaced_source_flag;
1026 
1027     /**
1028      * non_packed_constraint_flag
1029      */
1030     WORD8 i1_general_non_packed_constraint_flag;
1031 
1032     /**
1033      * frame_only_constraint_flag
1034      */
1035     WORD8 i1_frame_only_constraint_flag;
1036 
1037     /**
1038      *  level_idc
1039      */
1040     UWORD8 u1_level_idc;
1041 }profile_tier_lvl_t;
1042 
1043 /**
1044  * Structure to hold Profile tier level info for all layers
1045  */
1046 typedef struct
1047 {
1048     /**
1049      *  Profile and tier information for general
1050      */
1051     profile_tier_lvl_t s_ptl_gen;
1052 
1053     /**
1054      *  sub_layer_profile_present_flag[]
1055      */
1056     WORD8 ai1_sub_layer_profile_present_flag[VPS_MAX_SUB_LAYERS - 1];
1057 
1058     /**
1059      *  sub_layer_level_present_flag[]
1060      */
1061     WORD8 ai1_sub_layer_level_present_flag[VPS_MAX_SUB_LAYERS - 1];
1062 
1063     /**
1064      *  Profile and tier information for sub layers
1065      */
1066     profile_tier_lvl_t as_ptl_sub[VPS_MAX_SUB_LAYERS - 1];
1067 
1068 }profile_tier_lvl_info_t;
1069 
1070 /**
1071  * Structure to hold short term reference picture set info
1072  */
1073 typedef struct
1074 {
1075     /**
1076      *  delta_poc_s0_minus1[ i ] and delta_poc_s1_minus1[ i ]
1077      */
1078     WORD16 ai2_delta_poc[MAX_DPB_SIZE];
1079 
1080     /**
1081      *  inter_ref_pic_set_prediction_flag
1082      */
1083     WORD8 i1_inter_ref_pic_set_prediction_flag;
1084 
1085     /**
1086      *  num_negative_pics
1087      */
1088     WORD8 i1_num_neg_pics;
1089 
1090     /**
1091      *  num_positive_pics
1092      */
1093     WORD8 i1_num_pos_pics;
1094 
1095     /**
1096      *  used_by_curr_pic_s0_flag[ i ] and used_by_curr_pic_s1_flag[i]
1097      */
1098     WORD8 ai1_used[MAX_DPB_SIZE];
1099 
1100     /**
1101      *  Ref Idc
1102      */
1103     WORD8 ai1_ref_idc[MAX_DPB_SIZE];
1104 
1105     /**
1106      *  Sum of positive and negative pics for each refence
1107      */
1108     WORD8 i1_num_delta_pocs;
1109 
1110     /**
1111      *  Number of ref_idc
1112      */
1113     WORD8 i1_num_ref_idc;
1114 }stref_picset_t;
1115 
1116 /**
1117  * Structure to hold weighted prediction info such as weights and offsets
1118  */
1119 typedef struct
1120 {
1121     /** luma_log2_weight_denom */
1122     WORD8 i1_luma_log2_weight_denom;
1123 
1124     /** delta_chroma_log2_weight_denom */
1125     WORD8 i1_chroma_log2_weight_denom;
1126 
1127     /** luma_weight_l0_flag[ i ] */
1128     WORD8 i1_luma_weight_l0_flag[MAX_DPB_SIZE];
1129 
1130     /** chroma_weight_l0_flag[ i ] */
1131     WORD8 i1_chroma_weight_l0_flag[MAX_DPB_SIZE];
1132 
1133     /** delta_luma_weight_l0[ i ] */
1134     WORD16 i2_luma_weight_l0[MAX_DPB_SIZE];
1135 
1136     /** luma_offset_l0[ i ] */
1137     WORD16 i2_luma_offset_l0[MAX_DPB_SIZE];
1138 
1139     /** delta_chroma_weight_l0[ i ][ j ] */
1140     WORD16 i2_chroma_weight_l0_cb[MAX_DPB_SIZE];
1141 
1142     /** delta_chroma_offset_l0[ i ][ j ] */
1143     WORD16 i2_chroma_offset_l0_cb[MAX_DPB_SIZE];
1144 
1145     /** delta_chroma_weight_l0[ i ][ j ] */
1146     WORD16 i2_chroma_weight_l0_cr[MAX_DPB_SIZE];
1147 
1148     /** delta_chroma_offset_l0[ i ][ j ] */
1149     WORD16 i2_chroma_offset_l0_cr[MAX_DPB_SIZE];
1150 
1151     /** luma_weight_l1_flag[ i ] */
1152     WORD8 i1_luma_weight_l1_flag[MAX_DPB_SIZE];
1153 
1154     /** chroma_weight_l1_flag[ i ] */
1155     WORD8 i1_chroma_weight_l1_flag[MAX_DPB_SIZE];
1156 
1157     /** delta_luma_weight_l1[ i ] */
1158     WORD16 i2_luma_weight_l1[MAX_DPB_SIZE];
1159 
1160     /** luma_offset_l1[ i ] */
1161     WORD16 i2_luma_offset_l1[MAX_DPB_SIZE];
1162 
1163     /** delta_chroma_weight_l1[ i ][ j ] */
1164     WORD16 i2_chroma_weight_l1_cb[MAX_DPB_SIZE];
1165 
1166     /** delta_chroma_offset_l1[ i ][ j ] */
1167     WORD16 i2_chroma_offset_l1_cb[MAX_DPB_SIZE];
1168 
1169     /** delta_chroma_weight_l1[ i ][ j ] */
1170     WORD16 i2_chroma_weight_l1_cr[MAX_DPB_SIZE];
1171 
1172     /** delta_chroma_offset_l1[ i ][ j ] */
1173     WORD16 i2_chroma_offset_l1_cr[MAX_DPB_SIZE];
1174 
1175 }pred_wt_ofst_t;
1176 
1177 
1178 /**
1179  * Structure to hold Reference picture list modification info
1180  */
1181 typedef struct
1182 {
1183     /* ref_pic_list_modification_flag_l0 */
1184     WORD8 i1_ref_pic_list_modification_flag_l0;
1185 
1186     /* list_entry_l0[ i ] */
1187     WORD8 i1_list_entry_l0[16];
1188 
1189     /* ref_pic_list_modification_flag_l1 */
1190     WORD8 i1_ref_pic_list_modification_flag_l1;
1191 
1192     /* list_entry_l1[ i ] */
1193     WORD8 i1_list_entry_l1[16];
1194 }rplm_t;
1195 
1196 
1197 /**
1198  * Structure to hold VPS info
1199  */
1200 typedef struct
1201 {
1202     /**
1203      *  video_parameter_set_id
1204      */
1205     WORD8 i1_vps_id;
1206 
1207     /**
1208      *  vps_temporal_id_nesting_flag
1209      */
1210     WORD8 i1_vps_temporal_id_nesting_flag;
1211     /**
1212      * sub_layer_ordering_info_present_flag
1213      */
1214     WORD8 i1_sub_layer_ordering_info_present_flag;
1215     /**
1216      *  vps_max_sub_layers_minus1
1217      */
1218     WORD8 i1_vps_max_sub_layers;
1219 
1220     /**
1221      *  vps_max_dec_pic_buffering
1222      */
1223     WORD8 ai1_vps_max_dec_pic_buffering[VPS_MAX_SUB_LAYERS];
1224 
1225     /**
1226      *  vps_max_num_reorder_pics
1227      */
1228     WORD8 ai1_vps_max_num_reorder_pics[VPS_MAX_SUB_LAYERS];
1229 
1230     /**
1231      *  vps_max_latency_increase
1232      */
1233     WORD8 ai1_vps_max_latency_increase[VPS_MAX_SUB_LAYERS];
1234 
1235     /**
1236      *  vps_num_hrd_parameters
1237      */
1238     WORD8 i1_vps_num_hrd_parameters;
1239 
1240     /**
1241      * vps_max_nuh_reserved_zero_layer_id
1242      */
1243     WORD8 i1_vps_max_nuh_reserved_zero_layer_id;
1244 
1245     /**
1246      * vps_num_op_sets
1247      */
1248     WORD8 i1_vps_num_op_sets;
1249 
1250     /**
1251      * layer_id_included_flag
1252      */
1253     //WORD8 ai1_layer_id_included_flag[2][MAX_NUH_LAYERS];
1254     /**
1255      *  Profile, Tier and Level info
1256      */
1257     profile_tier_lvl_info_t s_ptl;
1258 
1259     /**
1260      * bit_rate_info_present_flag[i]
1261      */
1262     WORD8 ai1_bit_rate_info_present_flag[VPS_MAX_SUB_LAYERS];
1263 
1264 
1265     /**
1266      * pic_rate_info_present_flag[i]
1267      */
1268     WORD8 ai1_pic_rate_info_present_flag[VPS_MAX_SUB_LAYERS];
1269 
1270     /**
1271      * avg_bit_rate[i]
1272      */
1273     UWORD16 au2_avg_bit_rate[VPS_MAX_SUB_LAYERS];
1274     /**
1275      * max_bit_rate[i]
1276      */
1277     UWORD16 au2_max_bit_rate[VPS_MAX_SUB_LAYERS];
1278     /**
1279      * constant_pic_rate_idc[i]
1280      */
1281     WORD8 ai1_constant_pic_rate_idc[VPS_MAX_SUB_LAYERS];
1282     /**
1283      * avg_pic_rate[i]
1284      */
1285     UWORD16 au2_avg_pic_rate[VPS_MAX_SUB_LAYERS];
1286 }vps_t;
1287 
1288 /**
1289  * Sub-layer HRD parameters Info
1290  */
1291 typedef struct
1292 {
1293     /**
1294     *  (together with bit_rate_scale) specifies the
1295     *  maximum input bit rate for the i-th CPB
1296     */
1297     UWORD32 au4_bit_rate_value_minus1[32];
1298     /**
1299     *  together with cpb_size_scale to specify the
1300     *  CPB size when the CPB operates at the access unit level.
1301     */
1302     UWORD32 au4_cpb_size_value_minus1[32];
1303 
1304     /**
1305     * together with cpb_size_du_scale to specify the CPB size
1306     * when the CPB operates at sub-picture level
1307     */
1308     UWORD32 au4_cpb_size_du_value_minus1[32];
1309 
1310     /**
1311     * specifies the maximum input bit rate for the i-th CPB when the CPB
1312     * operates at the sub-picture level. bit_rate_du_value_minus1[ i ]
1313     * shall be in the range of 0 to 2^32 - 2
1314     */
1315     UWORD32 au4_bit_rate_du_value_minus1[32];
1316 
1317     /**
1318     * if 1, specifies that the HSS operates in a constant bit rate (CBR) mode
1319     * if 0, specifies that the HSS operates in a intermittent bit rate (CBR) mode
1320     */
1321     UWORD8  au1_cbr_flag[32];
1322 
1323 }sub_lyr_hrd_params_t;
1324 
1325 /**
1326  * HRD parameters Info
1327  */
1328 typedef struct
1329 {
1330 
1331     /**
1332     *   Indicates the presence of the
1333     *   num_units_in_ticks, time_scale flag
1334     */
1335     UWORD8 u1_timing_info_present_flag;
1336 
1337     /**
1338     *   Number of units that
1339     *   correspond to one increment of the
1340     *   clock. Indicates the  resolution
1341     */
1342     UWORD32 u4_num_units_in_tick;
1343 
1344     /**
1345     *   The number of time units that pass in one second
1346     */
1347     UWORD32 u4_time_scale;
1348 
1349     /**
1350     * Nal- hrd parameters flag
1351     */
1352     UWORD8 u1_nal_hrd_parameters_present_flag;
1353 
1354     /**
1355     * VCL- hrd parameters flag
1356     */
1357     UWORD8 u1_vcl_hrd_parameters_present_flag;
1358 
1359     /**
1360     * Indicates the presence of NAL-HRD params or VCL_HRD params
1361     * in the bitstream
1362     */
1363     UWORD8 u1_cpbdpb_delays_present_flag;
1364 
1365     /**
1366     * specifies that sub-picture level CPB removal delay parameters are
1367     * present in picture timing SEI messages
1368     */
1369     UWORD8 u1_sub_pic_cpb_params_present_flag;
1370 
1371     /**
1372     * specify the clock sub-tick
1373     * (the minimum interval of time that can be represented in the coded data when sub_pic_cpb_params_present_flag is equal to 1)
1374     */
1375     UWORD8 u1_tick_divisor_minus2;
1376 
1377     /**
1378     * specifies the length, in bits for the du cpb delay syntax in pt_sei
1379     */
1380     UWORD8 u1_du_cpb_removal_delay_increment_length_minus1;
1381 
1382     /**
1383     * Indicates presence of sub_pic_cpb_params in pic timing sei
1384     */
1385     UWORD8 u1_sub_pic_cpb_params_in_pic_timing_sei_flag;
1386 
1387     /**
1388     * specifies the length, in bits, of the pic_dpb_output_du_delay syntax
1389     * element in the picture timing SEI message and the
1390     * pic_spt_dpb_output_du_delay syntax element in the decoding unit
1391     * information SEI message
1392      */
1393     UWORD8 u1_dpb_output_delay_du_length_minus1;
1394 
1395     /**
1396     * (together with bit_rate_value_minus1) specifies the
1397     * maximum input bit rate of the i-th CPB
1398     */
1399     UWORD32 u4_bit_rate_scale;
1400 
1401     /**
1402     * (together with cpb_size_du_value_minus1) specfies
1403     * CPB size of the i-th CPB when the CPB operates
1404     * at the access unit level
1405     */
1406     UWORD32 u4_cpb_size_scale;
1407 
1408     /**
1409     * (together with cpb_size_du_value_minus1) specfies
1410     * CPB size of the i-th CPB when the CPB operates
1411     * at the sub-picture level
1412     */
1413     UWORD32 u4_cpb_size_du_scale;
1414 
1415 
1416     /**
1417     * specifies the length, in bits for initial cpb delay (nal/vcl)sysntax in bp sei
1418     */
1419     UWORD8  u1_initial_cpb_removal_delay_length_minus1;
1420 
1421     /**
1422     * specifies the length, in bits for the au cpb delay syntax in pt_sei
1423     */
1424     UWORD8  u1_au_cpb_removal_delay_length_minus1;
1425 
1426     /**
1427     * specifies the length, in bits, of the pic_dpb_output_delay syntax element in the pt SEI message
1428     */
1429     UWORD8  u1_dpb_output_delay_length_minus1;
1430 
1431     /**
1432     * if 1, , for the highest temporal sub-layers, the temporal distance between the HRD output times
1433     *  of consecutive pictures in output order is constrained refer to Table E-6
1434     */
1435     UWORD8 au1_fixed_pic_rate_general_flag[6];
1436 
1437     UWORD8 au1_fixed_pic_rate_within_cvs_flag[6];
1438 
1439     /**
1440     * if 1, , for the highest temporal sub-layers, the temporal distance (in clock ticks) between the
1441     * element units that specify HRD output times of consecutive pictures in output order is constrained
1442     * refer to Table E-6
1443     */
1444     UWORD8 au1_elemental_duration_in_tc_minus1[6];
1445 
1446     /**
1447     * specifies the HRD operational mode
1448     */
1449     UWORD8 au1_low_delay_hrd_flag[6];
1450 
1451     /**
1452     * 1 specifies the number of alternative CPB specifications in the
1453     * bitstream of the cvs when HighestTid is equal to i
1454     */
1455     UWORD8 au1_cpb_cnt_minus1[6];
1456 
1457 
1458     /**
1459     *  VUI level Sub-layer HRD parameters
1460     */
1461     sub_lyr_hrd_params_t as_sub_layer_hrd_params[6];
1462 
1463 }hrd_params_t;
1464 
1465 
1466 /**
1467  * Structure to hold VUI parameters Info
1468  */
1469 typedef struct
1470 {
1471     /**
1472     *  indicates the presence of aspect_ratio
1473     */
1474     UWORD8 u1_aspect_ratio_info_present_flag;
1475 
1476     /**
1477     *  specifies the aspect ratio of the luma samples
1478     */
1479     UWORD8 u1_aspect_ratio_idc;
1480 
1481     /**
1482     *  width of the luma samples. user dependent
1483     */
1484     UWORD16 u2_sar_width;
1485 
1486     /**
1487     *  hieght of the luma samples. user dependent
1488     */
1489     UWORD16 u2_sar_height;
1490 
1491     /**
1492     * if 1, specifies that the overscan_appropriate_flag is present
1493     * if 0, the preferred display method for the video signal is unspecified
1494     */
1495     UWORD8 u1_overscan_info_present_flag;
1496 
1497     /**
1498     * if 1,indicates that the cropped decoded pictures output
1499     * are suitable for display using overscan
1500     */
1501     UWORD8 u1_overscan_appropriate_flag;
1502 
1503     /**
1504     * if 1 specifies that video_format, video_full_range_flag and
1505     * colour_description_present_flag are present
1506     */
1507     UWORD8 u1_video_signal_type_present_flag;
1508 
1509     /**
1510     *
1511     */
1512     UWORD8 u1_video_format;
1513 
1514     /**
1515     * indicates the black level and range of the luma and chroma signals
1516     */
1517     UWORD8 u1_video_full_range_flag;
1518 
1519     /**
1520     * if 1,to 1 specifies that colour_primaries, transfer_characteristics
1521     * and matrix_coefficients are present
1522     */
1523     UWORD8 u1_colour_description_present_flag;
1524 
1525     /**
1526     * indicates the chromaticity coordinates of the source primaries
1527     */
1528     UWORD8 u1_colour_primaries;
1529 
1530     /**
1531     * indicates the opto-electronic transfer characteristic of the source picture
1532     */
1533     UWORD8 u1_transfer_characteristics;
1534 
1535     /**
1536     * the matrix coefficients used in deriving luma and chroma signals
1537     * from the green, blue, and red primaries
1538     */
1539     UWORD8 u1_matrix_coefficients;
1540 
1541     /**
1542     * if 1, specifies that chroma_sample_loc_type_top_field and
1543     * chroma_sample_loc_type_bottom_field are present
1544     */
1545     UWORD8 u1_chroma_loc_info_present_flag;
1546 
1547     /**
1548     * location of chroma samples
1549     */
1550     UWORD8 u1_chroma_sample_loc_type_top_field;
1551 
1552     UWORD8 u1_chroma_sample_loc_type_bottom_field;
1553 
1554     /**
1555     * if 1, indicates that the value of all decoded chroma samples is
1556     * equal to 1 << ( BitDepthC - 1 )
1557     */
1558     UWORD8 u1_neutral_chroma_indication_flag;
1559 
1560     /**
1561     *  1 indicates that the coded video sequence conveys pictures that represent fields
1562     *  0 indicates the pictures that represents field
1563     */
1564     UWORD8 u1_field_seq_flag;
1565 
1566     /**
1567     * specifies that picture timing SEI messages are present for every picture
1568     */
1569     UWORD8 u1_frame_field_info_present_flag;
1570 
1571     /**
1572     * 1 indicates that the default display window parameters follow next in the VUI
1573     */
1574     UWORD8 u1_default_display_window_flag;
1575 
1576     /**
1577     * specify the samples of the pictures in the coded video sequence
1578     * that are within the default display window,
1579     * in terms of a rectangular region specified in picture coordinates for display
1580     */
1581     UWORD32 u4_def_disp_win_left_offset;
1582 
1583     UWORD32 u4_def_disp_win_right_offset;
1584 
1585     UWORD32 u4_def_disp_win_top_offset;
1586 
1587     UWORD32 u4_def_disp_win_bottom_offset;
1588 
1589     /**
1590     *  to 1 specifies that the syntax structure hrd_parameters is present in the vui_parameters syntax structue
1591     */
1592     UWORD8 u1_vui_hrd_parameters_present_flag;
1593 
1594     /**
1595     *  VUI level HRD parameters
1596     */
1597     hrd_params_t s_vui_hrd_parameters;
1598 
1599     /**
1600     *   Indicates the presence of the
1601     *   num_units_in_ticks, time_scale flag
1602     */
1603     UWORD8 u1_vui_timing_info_present_flag;
1604 
1605     /**
1606     *   Number of units that
1607     *   correspond to one increment of the
1608     *   clock. Indicates the  resolution
1609     */
1610     UWORD32 u4_vui_num_units_in_tick;
1611 
1612     /**
1613     *   The number of time units that pass in one second
1614     */
1615     UWORD32 u4_vui_time_scale;
1616     /**
1617     * if 1, indicates that the POC for each picture in the coded video sequence (cvs) (not the first picture), in decoding order,
1618     * is proportional to the output time of the picture relative to that of the first picture in the cvs
1619     */
1620     UWORD8 u1_poc_proportional_to_timing_flag;
1621 
1622     /**
1623     * num_ticks_poc_diff_one_minus1 plus 1 specifies the number of clock ticks
1624     * corresponding to a difference of poc values equal to 1
1625     */
1626     UWORD8 u1_num_ticks_poc_diff_one_minus1;
1627 
1628     /**
1629     * 1, specifies that the following cvs bitstream restriction parameters are present
1630     */
1631     UWORD8 u1_bitstream_restriction_flag;
1632 
1633     /**
1634     *  if 1, indicates that each pps that is active in the cvs has
1635     *  the same value of the tile syntax elements
1636     */
1637     UWORD8 u1_tiles_fixed_structure_flag;
1638 
1639     /**
1640     * if 0, indicates that no pel outside the pic boundaries and
1641     * no sub-pels derived using pels outside the pic boundaries is used for inter prediction
1642     */
1643     UWORD8 u1_motion_vectors_over_pic_boundaries_flag;
1644 
1645     /**
1646     * if 1, indicates
1647     * all P/B slices belonging to the same pic have an identical refpic list0,
1648     * all B slices that belong to the same picture have an identical refpic list1.
1649     */
1650     UWORD8 u1_restricted_ref_pic_lists_flag;
1651 
1652     /**
1653     *   min_spatial_segmentation_idc, when not equal to 0, establishes a bound on the maximum possible size of distinct
1654     *   coded spatial segmentation regions in the pictures of the CVS. When min_spatial_segmentation_idc is not present, it is
1655     *   inferred to be equal to 0. The value of min_spatial_segmentation_idc shall be in the range of 0 to 4095, inclusive.
1656     *
1657     *   can be used by a decoder to calculate the maximum number of luma samples to be processed by one processing thread
1658     *
1659     *   If tiles=0 and entropy_sync=0 then
1660     *       no slice shall exceed ( 4 * PicSizeInSamplesY ) / minSpatialSegmentationTimes4 luma samples
1661     *
1662     *   If tiles=1 and entropy_sync=0 then
1663     *       no tile shall exceed ( 4 * PicSizeInSamplesY ) / minSpatialSegmentationTimes4 luma samples
1664     *
1665     *   If tiles=0 and entropy_sync=1 then
1666     *       ( 2 * pic_height_in_luma_samples + pic_width_in_luma_samples ) * CtbSizeY
1667     *               <= ( 4 * PicSizeInSamplesY ) / minSpatialSegmentationTimes4
1668     */
1669     UWORD32 u4_min_spatial_segmentation_idc;
1670     /**
1671     * Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units
1672     * associated with any coded picture
1673     */
1674     UWORD8 u1_max_bytes_per_pic_denom;
1675 
1676     /**
1677     *  Indicates an upper bound for the number of bits of coding_unit() data
1678     */
1679     UWORD8 u1_max_bits_per_mincu_denom;
1680 
1681     /**
1682     * Indicate the maximum absolute value of a decoded horizontal MV component
1683     * in quarter-pel luma units
1684     */
1685     UWORD8 u1_log2_max_mv_length_horizontal;
1686 
1687     /**
1688     * Indicate the maximum absolute value of a decoded vertical MV component
1689     * in quarter-pel luma units
1690     */
1691     UWORD8 u1_log2_max_mv_length_vertical;
1692 
1693 
1694 }vui_t;
1695 
1696 
1697 /**
1698  * Structure to hold SPS info
1699  */
1700 typedef struct
1701 {
1702     /**
1703      * pic_width_in_luma_samples
1704      */
1705     WORD16 i2_pic_width_in_luma_samples;
1706 
1707     /**
1708      *  pic_height_in_luma_samples
1709      */
1710     WORD16 i2_pic_height_in_luma_samples;
1711 
1712     /**
1713      *  pic_crop_left_offset
1714      */
1715     WORD16 i2_pic_crop_left_offset;
1716 
1717     /**
1718      *  pic_crop_right_offset
1719      */
1720     WORD16 i2_pic_crop_right_offset;
1721 
1722     /**
1723      *  pic_crop_top_offset
1724      */
1725     WORD16 i2_pic_crop_top_offset;
1726 
1727     /**
1728      *  pic_crop_bottom_offset
1729      */
1730     WORD16 i2_pic_crop_bottom_offset;
1731 
1732     /**
1733      *  seq_parameter_set_id
1734      */
1735     WORD8 i1_sps_id;
1736 
1737     /**
1738      *  video_parameter_set_id
1739      */
1740     WORD8 i1_vps_id;
1741 
1742     /**
1743      *  sps_max_sub_layers_minus1
1744      */
1745     WORD8 i1_sps_max_sub_layers;
1746 
1747     /**
1748      *  chroma_format_idc
1749      */
1750     WORD8 i1_chroma_format_idc;
1751 
1752     /**
1753      * Bit depth of luma samples
1754      */
1755     WORD8 i1_bit_depth_luma_minus8;
1756 
1757     /**
1758      * Bit depth of chrma samples
1759      */
1760     WORD8 i1_bit_depth_chroma_minus8;
1761 
1762     /* separate_colour_plane_flag */
1763     WORD8 i1_separate_colour_plane_flag;
1764 
1765     /**
1766      *  pic_cropping_flag
1767      */
1768     WORD8 i1_pic_cropping_flag;
1769 
1770     /**
1771      *  pcm_enabled_flag
1772      */
1773     WORD8 i1_pcm_enabled_flag;
1774 
1775     /**
1776      *  pcm_sample_bit_depth_luma
1777      */
1778     WORD8 i1_pcm_sample_bit_depth_luma;
1779 
1780     /**
1781      *  pcm_sample_bit_depth_chroma
1782      */
1783     WORD8 i1_pcm_sample_bit_depth_chroma;
1784 
1785     /**
1786      *  log2_max_pic_order_cnt_lsb_minus4
1787      */
1788     WORD8 i1_log2_max_pic_order_cnt_lsb;
1789     /**
1790      * sps_sub_layer_ordering_info_present_flag
1791      */
1792     WORD8 i1_sps_sub_layer_ordering_info_present_flag;
1793     /**
1794      *  sps_max_dec_pic_buffering
1795      */
1796     WORD8 ai1_sps_max_dec_pic_buffering[SPS_MAX_SUB_LAYERS];
1797 
1798     /**
1799      *  sps_max_num_reorder_pics
1800      */
1801     WORD8 ai1_sps_max_num_reorder_pics[SPS_MAX_SUB_LAYERS];
1802 
1803     /**
1804      *  sps_max_latency_increase
1805      */
1806     WORD8 ai1_sps_max_latency_increase[SPS_MAX_SUB_LAYERS];
1807 
1808     /**
1809      *  log2_min_coding_block_size_minus3
1810      */
1811     WORD8 i1_log2_min_coding_block_size;
1812 
1813     /**
1814      *  log2_diff_max_min_coding_block_size
1815      */
1816     WORD8 i1_log2_diff_max_min_coding_block_size;
1817 
1818     /**
1819      *  log2_min_transform_block_size_minus2
1820      */
1821     WORD8 i1_log2_min_transform_block_size;
1822 
1823     /**
1824      *  log2_diff_max_min_transform_block_size
1825      */
1826     WORD8 i1_log2_diff_max_min_transform_block_size;
1827 
1828     /**
1829      *  log2_min_pcm_coding_block_size_minus3
1830      */
1831     WORD8 i1_log2_min_pcm_coding_block_size;
1832 
1833     /**
1834      *  log2_diff_max_min_pcm_coding_block_size
1835      */
1836     WORD8 i1_log2_diff_max_min_pcm_coding_block_size;
1837 
1838     /**
1839      *  max_transform_hierarchy_depth_inter
1840      */
1841     WORD8 i1_max_transform_hierarchy_depth_inter;
1842 
1843     /**
1844      *  max_transform_hierarchy_depth_intra
1845      */
1846     WORD8 i1_max_transform_hierarchy_depth_intra;
1847 
1848     /**
1849      *  scaling_list_enable_flag
1850      */
1851     WORD8 i1_scaling_list_enable_flag;
1852 
1853     /**
1854      *  sps_scaling_list_data_present_flag
1855      */
1856     WORD8 i1_sps_scaling_list_data_present_flag;
1857 
1858     /**
1859      *  amp_enabled_flag
1860      */
1861     WORD8 i1_amp_enabled_flag;
1862 
1863     /**
1864      *  sample_adaptive_offset_enabled_flag
1865      */
1866     WORD8 i1_sample_adaptive_offset_enabled_flag;
1867 
1868     /**
1869      *  pcm_loop_filter_disable_flag
1870      */
1871     WORD8 i1_pcm_loop_filter_disable_flag;
1872 
1873     /**
1874      *  sps_temporal_id_nesting_flag
1875      */
1876     WORD8 i1_sps_temporal_id_nesting_flag;
1877 
1878     /**
1879      *  num_short_term_ref_pic_sets
1880      */
1881     WORD8 i1_num_short_term_ref_pic_sets;
1882 
1883     /**
1884      *  long_term_ref_pics_present_flag
1885      */
1886     WORD8 i1_long_term_ref_pics_present_flag;
1887 
1888     /**
1889      *  num_long_term_ref_pics_sps
1890      */
1891     WORD8 i1_num_long_term_ref_pics_sps;
1892 
1893     /**
1894      *  lt_ref_pic_poc_lsb_sps[]
1895      */
1896     WORD8 ai1_lt_ref_pic_poc_lsb_sps[MAX_LTREF_PICS_SPS];
1897 
1898     /**
1899      *  used_by_curr_pic_lt_sps_flag[]
1900      */
1901     WORD8 ai1_used_by_curr_pic_lt_sps_flag[MAX_LTREF_PICS_SPS];
1902 
1903     /**
1904      *  sps_temporal_mvp_enable_flag
1905      */
1906     WORD8 i1_sps_temporal_mvp_enable_flag;
1907 
1908     /**
1909      * strong_intra_smoothing_enable_flag
1910      */
1911     WORD8 i1_strong_intra_smoothing_enable_flag;
1912 
1913     /**
1914      *  vui_parameters_present_flag
1915      */
1916     WORD8 i1_vui_parameters_present_flag;
1917 
1918     /**
1919      * vui parameters Structure info
1920      */
1921     vui_t s_vui_parameters;
1922 
1923     /**
1924      *  Log2(CTB Size) in luma units
1925      */
1926 
1927     WORD8 i1_log2_ctb_size;
1928 
1929     /**
1930      * Maximum transform block size
1931      */
1932     WORD8 i1_log2_max_transform_block_size;
1933 
1934     /**
1935      *  Picture width in CTB units
1936      */
1937 
1938     WORD16 i2_pic_wd_in_ctb;
1939 
1940     /**
1941      *  Picture height in CTB units
1942      */
1943 
1944     WORD16 i2_pic_ht_in_ctb;
1945 
1946     /**
1947      * Picture width in min CB units
1948      */
1949 
1950     WORD16 i2_pic_wd_in_min_cb;
1951 
1952     /**
1953      *  Picture height in min CB units
1954      */
1955 
1956     WORD16 i2_pic_ht_in_min_cb;
1957 
1958     /**
1959      *  Picture size in CTB units
1960      */
1961     WORD32 i4_pic_size_in_ctb;
1962 
1963     /**
1964      *  Profile, Tier and Level info
1965      */
1966 
1967     profile_tier_lvl_info_t s_ptl;
1968 
1969     /**
1970      *  Short term reference pic set
1971      */
1972     stref_picset_t as_stref_picset[MAX_STREF_PICS_SPS];
1973 
1974     /**
1975      *  Pointer to scaling matrix
1976      */
1977     /*************************************************************************/
1978     /* Contanis the matrice in the following order in a 1D buffer            */
1979     /* Intra 4 x 4 Y, 4 x 4 U, 4 x 4 V                                       */
1980     /* Inter 4 x 4 Y, 4 x 4 U, 4 x 4 V                                       */
1981     /* Intra 8 x 8 Y, 8 x 8 U, 8 x 8 V                                       */
1982     /* Inter 8 x 8 Y, 8 x 8 U, 8 x 8 V                                       */
1983     /* Intra 16x16 Y, 16x16 U, 16x16 V                                       */
1984     /* Inter 16x16 Y, 16x16 U, 16x16 V                                       */
1985     /* Intra 32x32 Y                                                         */
1986     /* Inter 32x32 Y                                                         */
1987     /*************************************************************************/
1988     WORD16 *pi2_scaling_mat;
1989 
1990     /*
1991      * Flag indicating if the SPS is parsed
1992      */
1993     WORD8 i1_sps_valid;
1994 
1995 }sps_t;
1996 
1997 /**
1998  * Structure to hold PPS info
1999  */
2000 typedef struct
2001 {
2002     /**
2003      *  Pointer to scaling matrix
2004      */
2005     /*************************************************************************/
2006     /* Contanis the matrice in the following order in a 1D buffer            */
2007     /* Intra 4 x 4 Y, 4 x 4 U, 4 x 4 V                                       */
2008     /* Inter 4 x 4 Y, 4 x 4 U, 4 x 4 V                                       */
2009     /* Intra 8 x 8 Y, 8 x 8 U, 8 x 8 V                                       */
2010     /* Inter 8 x 8 Y, 8 x 8 U, 8 x 8 V                                       */
2011     /* Intra 16x16 Y, 16x16 U, 16x16 V                                       */
2012     /* Inter 16x16 Y, 16x16 U, 16x16 V                                       */
2013     /* Intra 32x32 Y                                                         */
2014     /* Inter 32x32 Y                                                         */
2015     /*************************************************************************/
2016     WORD16 *pi2_scaling_mat;
2017 
2018     /**
2019      *  Pointer to an array containing tile info such as position, width, height
2020      *  of each tile
2021      */
2022 
2023     /* column_width_minus1[ i ] and row_height_minus1[ i ] */
2024     tile_t *ps_tile;
2025 
2026     /**
2027      *  pic_parameter_set_id
2028      */
2029     WORD8 i1_pps_id;
2030 
2031     /**
2032      *  seq_parameter_set_id
2033      */
2034     WORD8 i1_sps_id;
2035 
2036     /**
2037      *  sign_data_hiding_flag
2038      */
2039     WORD8 i1_sign_data_hiding_flag;
2040 
2041     /**
2042      *  cabac_init_present_flag
2043      */
2044     WORD8 i1_cabac_init_present_flag;
2045 
2046     /**
2047      *  num_ref_idx_l0_default_active_minus1
2048      */
2049     WORD8 i1_num_ref_idx_l0_default_active;
2050 
2051     /**
2052      * num_ref_idx_l1_default_active_minus1
2053      */
2054     WORD8 i1_num_ref_idx_l1_default_active;
2055 
2056     /**
2057      *  pic_init_qp_minus26
2058      */
2059     WORD8 i1_pic_init_qp;
2060 
2061     /**
2062      *  constrained_intra_pred_flag
2063      */
2064     WORD8 i1_constrained_intra_pred_flag;
2065 
2066     /**
2067      *  transform_skip_enabled_flag
2068      */
2069     WORD8 i1_transform_skip_enabled_flag;
2070 
2071     /**
2072      *  cu_qp_delta_enabled_flag
2073      */
2074     WORD8 i1_cu_qp_delta_enabled_flag;
2075 
2076     /**
2077      * diff_cu_qp_delta_depth
2078      */
2079     WORD8 i1_diff_cu_qp_delta_depth;
2080 
2081     /**
2082      *  pic_cb_qp_offset
2083      */
2084     WORD8 i1_pic_cb_qp_offset;
2085 
2086     /**
2087      *  pic_cr_qp_offset
2088      */
2089     WORD8 i1_pic_cr_qp_offset;
2090 
2091     /**
2092      *  pic_slice_level_chroma_qp_offsets_present_flag
2093      */
2094     WORD8 i1_pic_slice_level_chroma_qp_offsets_present_flag;
2095 
2096     /**
2097      *  weighted_pred_flag
2098      */
2099     WORD8 i1_weighted_pred_flag;
2100 
2101     /**
2102      *  weighted_bipred_flag
2103      */
2104     WORD8 i1_weighted_bipred_flag;
2105 
2106     /**
2107      *  output_flag_present_flag
2108      */
2109     WORD8 i1_output_flag_present_flag;
2110 
2111     /**
2112      *  transquant_bypass_enable_flag
2113      */
2114     WORD8 i1_transquant_bypass_enable_flag;
2115 
2116     /**
2117      *  dependent_slice_enabled_flag
2118      */
2119     WORD8 i1_dependent_slice_enabled_flag;
2120 
2121     /**
2122      *  tiles_enabled_flag
2123      */
2124     WORD8 i1_tiles_enabled_flag;
2125 
2126     /**
2127      *  entropy_coding_sync_enabled_flag
2128      */
2129     WORD8 i1_entropy_coding_sync_enabled_flag;
2130 
2131     /**
2132      * entropy_slice_enabled_flag
2133      */
2134     WORD8 i1_entropy_slice_enabled_flag;
2135 
2136     /**
2137      *  num_tile_columns_minus1
2138      */
2139     WORD8 i1_num_tile_columns;
2140 
2141     /**
2142      *  num_tile_rows_minus1
2143      */
2144     WORD8 i1_num_tile_rows;
2145 
2146     /**
2147      *  uniform_spacing_flag
2148      */
2149     WORD8 i1_uniform_spacing_flag;
2150 
2151     /**
2152      *  loop_filter_across_tiles_enabled_flag
2153      */
2154     WORD8 i1_loop_filter_across_tiles_enabled_flag;
2155 
2156     /**
2157      *  loop_filter_across_slices_enabled_flag
2158      */
2159     WORD8 i1_loop_filter_across_slices_enabled_flag;
2160 
2161     /**
2162      *  deblocking_filter_control_present_flag
2163      */
2164     WORD8 i1_deblocking_filter_control_present_flag;
2165 
2166     /**
2167      *  deblocking_filter_override_enabled_flag
2168      */
2169     WORD8 i1_deblocking_filter_override_enabled_flag;
2170 
2171     /**
2172      *  pic_disable_deblocking_filter_flag
2173      */
2174     WORD8 i1_pic_disable_deblocking_filter_flag;
2175 
2176     /**
2177      *  beta_offset_div2
2178      */
2179     WORD8 i1_beta_offset_div2;
2180 
2181     /**
2182      *  tc_offset_div2
2183      */
2184     WORD8 i1_tc_offset_div2;
2185 
2186     /**
2187      *  pps_scaling_list_data_present_flag
2188      */
2189     WORD8 i1_pps_scaling_list_data_present_flag;
2190 
2191     /**
2192      * lists_modification_present_flag
2193      */
2194     WORD8 i1_lists_modification_present_flag;
2195 
2196     /**
2197      * num_extra_slice_header_bits
2198      */
2199     WORD8 i1_num_extra_slice_header_bits;
2200 
2201     /**
2202      *  log2_parallel_merge_level_minus2
2203      */
2204     WORD8 i1_log2_parallel_merge_level;
2205 
2206     /**
2207      *  slice_header_extension_present_flag
2208      */
2209     WORD8 i1_slice_header_extension_present_flag;
2210 
2211     /**
2212      *  slice_extension_present_flag
2213      */
2214     WORD8 i1_slice_extension_present_flag;
2215 
2216     /**
2217      *  scaling_list_dc_coef_minus8
2218      */
2219     /*************************************************************************/
2220     /* DC value of the scaling list                                          */
2221     /* Only 16 x 16 and 32 x 32 scaling lists have valid entries.            */
2222     /* Entries stored for all sizes for uniformity.                          */
2223     /* Remaining will be initialized to default values if used               */
2224     /*************************************************************************/
2225     UWORD8 au1_scaling_list_dc_coef[TOTAL_SCALE_MAT_COUNT];
2226 
2227     /**
2228      * Log2MinCuQpDeltaSize
2229      */
2230     WORD8 i1_log2_min_cu_qp_delta_size;
2231 
2232     /*
2233      * Flag indicating if the PPS is parsed
2234      */
2235     WORD8 i1_pps_valid;
2236 
2237 }pps_t;
2238 
2239 
2240 
2241 /**
2242  * Buffering Period SEI parameters Info
2243  */
2244 typedef struct
2245 {
2246     /**
2247     * specifies SPS Id active for the coded picture assosiated
2248     * with the bp message.
2249     */
2250     UWORD8  u1_sps_id;
2251 
2252     /**
2253     * Derived from Hrd parameters
2254     */
2255     UWORD8  u1_sub_pic_cpb_params_present_flag;
2256 
2257     /**
2258     * specifies the presence of the initial_alt_cpb_removal_delay[ i ]
2259     * and initial_alt_cpb_removal_offset[ i ] syntax elements
2260     */
2261     UWORD8  u1_rap_cpb_params_present_flag;
2262 
2263     /**
2264     * cbp removal delay used in buffering period SEI
2265     */
2266     UWORD32 cpb_delay_offset;
2267 
2268     /**
2269     * dbp removal delay used in buffering period SEI
2270     */
2271     UWORD32 dpb_delay_offset;
2272 
2273     /**
2274     * concatanation flag
2275     */
2276     UWORD8 concatenation_flag;
2277 
2278     /**
2279     * delata cbp removal delay
2280     */
2281     UWORD32 au_cpb_removal_delay_delta_minus1;
2282 
2283     /**
2284     * specify the default initial CPB removal delays, respectively,
2285     * for the CPB when the NAL HRD parameters are in use
2286     */
2287     UWORD32 au4_nal_initial_cpb_removal_delay[32];
2288 
2289     /**
2290     * specify the alternate initial CPB removal delays, respectively,
2291     * for the CPB when the NAL HRD parameters are in use
2292     */
2293     UWORD32 au4_nal_initial_alt_cpb_removal_delay[32];
2294 
2295     /**
2296     * specify the initial CPB removal delay offset, respectively,
2297     * for the CPB when the NAL HRD parameters are in use
2298     */
2299     UWORD32 au4_nal_initial_cpb_removal_delay_offset[32];
2300 
2301     /**
2302     * specify the alternate initial CPB removal delays offsets, respectively,
2303     * for the CPB when the NAL HRD parameters are in use
2304     */
2305     UWORD32 au4_nal_initial_alt_cpb_removal_delay_offset[32];
2306 
2307     /**
2308     * specify the default initial CPB removal delays, respectively,
2309     * for the CPB when the VCL HRD parameters are in use
2310     */
2311     UWORD32 au4_vcl_initial_cpb_removal_delay[32];
2312 
2313     /**
2314     * specify the initial alt CPB removal delays , respectively,
2315     * for the CPB when the VCL HRD parameters are in use
2316     */
2317     UWORD32 au4_vcl_initial_alt_cpb_removal_delay[32];
2318 
2319     /**
2320     * specify the initial CPB removal delay offset, respectively,
2321     * for the CPB when the VCL HRD parameters are in use
2322     */
2323     UWORD32 au4_vcl_initial_cpb_removal_delay_offset[32];
2324 
2325     /**
2326     * specify the alternate initial CPB removal delays offsets, respectively,
2327     * for the CPB when the VCL HRD parameters are in use
2328     */
2329     UWORD32 au4_vcl_initial_alt_cpb_removal_delay_offset[32];
2330 
2331     /**
2332     *  Inital CPB removal delay
2333     */
2334     UWORD32 u4_initial_cpb_removal_delay_length;
2335 
2336     /**
2337     *  CPB cnt for corr. sublayer
2338     */
2339     UWORD32 u4_cpb_cnt;
2340 
2341 
2342     /**
2343     * VBV buffer size used in buffering period SEI
2344     */
2345     UWORD32 u4_buffer_size_sei;
2346 
2347     /**
2348     * Encoder buffer fullness  used in buffering period SEI
2349     */
2350     UWORD32 u4_ebf_sei;
2351 
2352     /**
2353     * target bitrate used in buffering period SEI
2354     */
2355     UWORD32 u4_target_bit_rate_sei;
2356 
2357 
2358 
2359 
2360 }buf_period_sei_params_t;
2361 
2362 
2363 /**
2364  * Picture Timing SEI parameters Info
2365  */
2366 typedef struct
2367 {
2368     /**
2369     * derived from vui parameters
2370     */
2371     UWORD8 u1_frame_field_info_present_flag;
2372 
2373     /**
2374     * indicates whether a picture should be displayed as a
2375     * frame or as one or more fields
2376     */
2377     UWORD32 u4_pic_struct;
2378 
2379     UWORD8  u1_num_clk_ticks;
2380 
2381     /**
2382     * indicates whether a scan-type of the pic should be interpreted
2383     * as progressive or interlaced
2384     */
2385     UWORD8 u1_progressive_source_idc;
2386 
2387     /**
2388     * if 1, indicates if the current pic is a duplicte pic in output order
2389     */
2390     UWORD8 u1_duplicate_flag;
2391 
2392     /**
2393     * specifies the number clock ticks between the nominal CPB removal time
2394     * au associated with the pt SEI message and
2395     * the preceding au in decoding order that contained a bp SEI message
2396     */
2397     UWORD32 u4_au_cpb_removal_delay_minus1;
2398 
2399     /**
2400     * compute the DPB output time of the picture
2401     */
2402     UWORD32 u4_pic_dpb_output_delay;
2403 
2404     UWORD32 u4_pic_dpb_output_du_delay;
2405 
2406     /**
2407     * specifies the number of decoding units in the access unit
2408     * the picture timing SEI message is associated with
2409     */
2410     UWORD32 u4_num_decoding_units_minus1;
2411 
2412     /**
2413     * if 1 specifies that the du_common_cpb_removal_delay_increment_minus1 is present
2414     */
2415     UWORD32 u4_du_common_cpb_removal_delay_flag;
2416 
2417     /**
2418     * specifies the duration, in units of clock sub-ticks,
2419     * between the nominal CPB removal times of any two consecutive decoding units
2420     * in decoding order in the access unit associated with the pt_SEI message
2421     */
2422     UWORD32 u4_du_common_cpb_removal_delay_increment_minus1; //same as u4_du_cpb_removal_delay_increment_minus1
2423 
2424     /**
2425     * specifies the number of NAL units in the decoding unit of the access unit
2426     * the picture timing SEI message is associated with.
2427     * range from 0 to (pic size in ctby - 1)
2428     */
2429     UWORD32 u4_num_nalus_in_du_minus1;
2430 
2431     /**
2432     * specifies the duration, in units of clock sub-ticks,
2433     * between the nominal CPB removal times of the ( i + 1 )-th decoding unit and the i-th decoding unit,
2434     * in decoding order, in the access unit associated with the pt_SEI message
2435     */
2436     UWORD32 u4_du_cpb_removal_delay_increment_minus1;
2437 
2438 
2439 }pic_timing_sei_params_t;
2440 
2441 /**
2442  * Structure to hold Recovery point SEI parameters Info
2443  */
2444 typedef struct
2445 {
2446     /**
2447     * specifies the recovery point of output pictures in output order
2448     */
2449     WORD32 i4_recovery_poc_cnt;
2450 
2451     UWORD8 u1_exact_match_flag;
2452 
2453     /**
2454     * indicates the presence or absence of a broken link in the NAL unit
2455     * stream at the location of the recovery point SEI message
2456     */
2457 
2458     UWORD8 u1_broken_link_flag;
2459 
2460 }recovery_point_sei_params_t;
2461 /**
2462  * Structure to hold active parameter parameter set SEI parameters Info
2463  */
2464 typedef struct
2465 {
2466     /*
2467     * active vps id
2468     */
2469 
2470     UWORD8 u1_active_video_parameter_set_id;
2471 
2472     /*
2473     * default set to zero.
2474     */
2475     UWORD8 u1_self_contained_cvs_flag;
2476 
2477     UWORD8 u1_no_parameter_set_update_flag;
2478 
2479     UWORD8 u1_num_sps_ids_minus1;
2480 
2481     /*
2482     * active sps id
2483     */
2484     UWORD8 au1_active_seq_parameter_set_id[15];
2485 
2486 }active_parameter_set_sei_param_t;
2487 
2488 /**
2489  * Structure to hold SEI parameters Info
2490  */
2491 typedef struct
2492 {
2493 
2494     WORD8 i1_sei_parameters_present_flag;
2495 
2496     WORD8 i1_aud_present_flag;
2497 
2498     WORD8 i1_buf_period_params_present_flag;
2499 
2500     WORD8 i1_pic_timing_params_present_flag;
2501 
2502     WORD8 i1_recovery_point_params_present_flag;
2503 
2504     buf_period_sei_params_t  s_buf_period_sei_params;
2505 
2506     pic_timing_sei_params_t  s_pic_timing_sei_params;
2507 
2508     recovery_point_sei_params_t s_recovery_point_params;
2509 
2510     active_parameter_set_sei_param_t s_active_parameter_set_sei_params;
2511 
2512 
2513 }sei_params_t;
2514 
2515 
2516 
2517 /**
2518  * Structure to hold slice header info
2519  */
2520 typedef struct
2521 {
2522     /**
2523      *  entry_point_offset[ i ]
2524      */
2525     WORD32 *pi4_entry_point_offset;
2526 
2527     /**
2528      *  poc_lsb_lt[ i ]
2529      */
2530     WORD32 ai4_poc_lsb_lt[MAX_DPB_SIZE];
2531 
2532     /**
2533      *  slice_header_extension_length
2534      */
2535     WORD16 i2_slice_header_extension_length;
2536 
2537     /**
2538      *  slice_address
2539      */
2540     WORD16 i2_slice_address;
2541 
2542     /**
2543      *  first_slice_in_pic_flag
2544      */
2545     WORD8 i1_first_slice_in_pic_flag;
2546 
2547     /* PPS id */
2548     WORD8 i1_pps_id;
2549     /**
2550      *  no_output_of_prior_pics_flag
2551      */
2552     WORD8 i1_no_output_of_prior_pics_flag;
2553 
2554     /**
2555      *  dependent_slice_flag
2556      */
2557     WORD8 i1_dependent_slice_flag;
2558 
2559     /**
2560      *  slice_type
2561      */
2562     WORD8 i1_slice_type;
2563 
2564     /**
2565      *  pic_output_flag
2566      */
2567     WORD8 i1_pic_output_flag;
2568 
2569     /**
2570      *  colour_plane_id
2571      */
2572     WORD8 i1_colour_plane_id;
2573 
2574     /**
2575      *  pic_order_cnt_lsb
2576      */
2577     WORD32 i4_pic_order_cnt_lsb;
2578 
2579     /**
2580      *  absolute pic_order_cnt
2581      */
2582     WORD32 i4_abs_pic_order_cnt;
2583 
2584     /**
2585      *  short_term_ref_pic_set_sps_flag
2586      */
2587     WORD8 i1_short_term_ref_pic_set_sps_flag;
2588 
2589     /**
2590      *  short_term_ref_pic_set_idx
2591      */
2592     WORD8 i1_short_term_ref_pic_set_idx;
2593 
2594     /**
2595      *  num_long_term_sps
2596      */
2597     WORD8 i1_num_long_term_sps;
2598 
2599     /**
2600      *  num_long_term_pics
2601      */
2602     WORD8 i1_num_long_term_pics;
2603 
2604     /**
2605      *  lt_idx_sps[ i ]
2606      */
2607     WORD8 ai1_lt_idx_sps[MAX_DPB_SIZE];
2608 
2609     /**
2610      *  used_by_curr_pic_lt_flag[ i ]
2611      */
2612     WORD8 ai1_used_by_curr_pic_lt_flag[MAX_DPB_SIZE];
2613 
2614     /**
2615      *  delta_poc_msb_present_flag[ i ]
2616      */
2617     WORD8 ai1_delta_poc_msb_present_flag[MAX_DPB_SIZE];
2618 
2619     /**
2620      *  delta_poc_msb_cycle_lt[ i ]
2621      */
2622     WORD8 ai1_delta_poc_msb_cycle_lt[MAX_DPB_SIZE];
2623 
2624     /**
2625      *  slice_sao_luma_flag
2626      */
2627     WORD8 i1_slice_sao_luma_flag;
2628 
2629     /**
2630      *  slice_sao_chroma_flag
2631      */
2632     WORD8 i1_slice_sao_chroma_flag;
2633 
2634     /**
2635      *  slice_temporal_mvp_enable_flag
2636      */
2637     WORD8 i1_slice_temporal_mvp_enable_flag;
2638 
2639     /**
2640      *  num_ref_idx_active_override_flag
2641      */
2642     WORD8 i1_num_ref_idx_active_override_flag;
2643 
2644     /**
2645      *  num_ref_idx_l0_active_minus1
2646      */
2647     WORD8 i1_num_ref_idx_l0_active;
2648 
2649     /**
2650      *  num_ref_idx_l1_active_minus1
2651      */
2652     WORD8 i1_num_ref_idx_l1_active;
2653 
2654     /**
2655      *  mvd_l1_zero_flag
2656      */
2657     WORD8 i1_mvd_l1_zero_flag;
2658 
2659     /**
2660      *  cabac_init_flag
2661      */
2662     WORD8 i1_cabac_init_flag;
2663 
2664     /**
2665      *  collocated_from_l0_flag
2666      */
2667     WORD8 i1_collocated_from_l0_flag;
2668 
2669     /**
2670      *  collocated_ref_idx
2671      */
2672     WORD8 i1_collocated_ref_idx;
2673 
2674     /**
2675      * five_minus_max_num_merge_cand
2676      */
2677     WORD8 i1_max_num_merge_cand;
2678 
2679     /**
2680      *  slice_qp_delta
2681      */
2682     WORD8 i1_slice_qp_delta;
2683 
2684     /**
2685      *  slice_cb_qp_offset
2686      */
2687     WORD8 i1_slice_cb_qp_offset;
2688 
2689     /**
2690      *  slice_cr_qp_offset
2691      */
2692     WORD8 i1_slice_cr_qp_offset;
2693 
2694     /**
2695      *  deblocking_filter_override_flag
2696      */
2697     WORD8 i1_deblocking_filter_override_flag;
2698 
2699     /**
2700      *  slice_disable_deblocking_filter_flag
2701      */
2702     WORD8 i1_slice_disable_deblocking_filter_flag;
2703 
2704     /**
2705      *  beta_offset_div2
2706      */
2707     WORD8 i1_beta_offset_div2;
2708 
2709     /**
2710      *  tc_offset_div2
2711      */
2712     WORD8 i1_tc_offset_div2;
2713 
2714     /**
2715      *  slice_loop_filter_across_slices_enabled_flag
2716      */
2717     WORD8 i1_slice_loop_filter_across_slices_enabled_flag;
2718 
2719     /**
2720      *  NUmber of entry point offsets
2721      */
2722     WORD32 i4_num_entry_point_offsets;
2723 
2724     /**
2725      *  offset_len_minus1
2726      */
2727     WORD8 i1_offset_len;
2728 
2729     /**
2730      *  Entry point offsets
2731      */
2732     WORD32 *pu4_entry_point_offset;
2733 
2734     /**
2735      * Short term reference picture set
2736      */
2737     stref_picset_t s_stref_picset;
2738 
2739     /**
2740      *  Weight and offset info for Weighted prediction
2741      */
2742     pred_wt_ofst_t s_wt_ofst;
2743 
2744     /**
2745      *  Reference prediction list modification
2746      */
2747     rplm_t s_rplm;
2748 
2749     /**
2750      *  First CTB' X pos : slice_address % i2_pic_wd_in_ctb
2751      */
2752     WORD16 i2_ctb_x;
2753 
2754     /**
2755      *  First CTB' Y pos : slice_address / i2_pic_wd_in_ctb
2756      */
2757     WORD16 i2_ctb_y;
2758 
2759     /**
2760      * L0 Reference pic lists
2761      */
2762     ref_list_t as_ref_pic_list0[MAX_DPB_SIZE];
2763 
2764     /**
2765      * L1 Reference pic lists
2766      */
2767     ref_list_t as_ref_pic_list1[MAX_DPB_SIZE];
2768 
2769     /**
2770      * NAL unit type of the slice
2771      */
2772     WORD8 i1_nal_unit_type;
2773 
2774     /**
2775      * Low delay check flag
2776      */
2777     WORD8 i1_low_delay_flag;
2778 
2779     /**
2780      * The last independent slice's start ctb_x
2781      * If the current slice is independent, it is the same as the current CTBs ctb_x
2782      */
2783     WORD16 i2_independent_ctb_x;
2784 
2785     /**
2786      * The last independent slice's start ctb_y
2787      * If the current slice is independent, it is the same as the current CTBs ctb_y
2788      */
2789     WORD16 i2_independent_ctb_y;
2790 
2791     UWORD8 u1_parse_data_init_done;
2792 
2793     /**
2794      * Temporal ID in NAL header
2795      */
2796     WORD32 u4_nuh_temporal_id;
2797 }slice_header_t;
2798 
2799 
2800 
2801 
2802 
2803 
2804 
2805 
2806 #endif /* _IHEVC_STRUCTS_H_ */
2807