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