• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2022 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19  */
20 /**
21  *******************************************************************************
22  * @file
23  *  isvcd_structs.h
24  *
25  * @brief
26  *  Contains structures required for decoder
27  *
28  * @author
29  *  Kishore
30  *
31  * @remarks
32  *  None
33  *
34  *******************************************************************************
35  */
36 
37 #ifndef _ISVCD_STRUCTS_H_
38 #define _ISVCD_STRUCTS_H_
39 
40 #include "isvcd_defs.h"
41 #include "isvcd_cabac.h"
42 #include "ih264d_structs.h"
43 #include "isvcd_iquant_itrans_residual_recon.h"
44 #include "isvcd_iquant_itrans_residual.h"
45 #include "isvcd_iquant_itrans.h"
46 #include "isvcd_pred_residual_recon.h"
47 
48 #include "isvcd_nal.h"
49 #include "isvcd_nal_structs.h"
50 #include "isvcd_nal_parse.h"
51 #include "isvcd_nal_parse_structs.h"
52 
53 #include "isvcd_intra_resamp.h"
54 #include "isvcd_ii_pred.h"
55 #include "isvcd_residual_resamp.h"
56 
57 #include "isvcd_vui.h"
58 
59 #define NUM_MB_PARTS 4
60 #define NUM_SUB_MB_PARTS 4
61 #define NUM_INTRA_SUB_BLOCKS 16
62 #define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
63 
64 #define ANNEX_B 0     /*!< Annex B stream*/
65 #define NON_ANNEX_B 1 /*!< Non Annex B RFC stream */
66 
67 #define BUFFER_ALIGN_4 4
68 
69 #define MAX_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
70 #define MAX_NON_VCL_NAL_BUFF_SIZE (1024 * 1024)
71 #define MAX_SCLD_REF_LAYER_OFFSET 32768
72 #define MIN_SCLD_REF_LAYER_OFFSET -32768
73 #define MAX_SVC_NAL_UNIT_TYPE 31
74 /*! Nal unit svc extennsion parameters */
75 
76 struct _SvcDecLyrStruct;
77 
78 typedef struct
79 {
80     UWORD8 u1_nal_ref_idc;              /** NAL ref idc of the Slice NAL unit */
81     UWORD8 u1_svc_ext_flag;             /** svc nal extension */
82     UWORD8 u1_idr_flag;                 /** IDR picture when dependency_id = maximum value of
83                                            dependency_id */
84     UWORD8 u1_priority_id;              /** priority identifier for the NAL unit */
85     UWORD8 u1_no_inter_layer_pred_flag; /** Usage of the inter-layer prediction */
86     UWORD8 u1_dependency_id;            /** dependency identifier for the NAL unit */
87     UWORD8 u1_quality_id;               /** quality identifier for the NAL unit */
88     UWORD8 u1_temporal_id;              /** temporal identifier for the NAL unit */
89     UWORD8 u1_use_ref_base_pic_flag;    /** specifies reference pictures for inter
90                                            prediction */
91     UWORD8 u1_discardable_flag;         /** current NAL unit is not used in dependant
92                                            decoding */
93     UWORD8 u1_output_flag;              /** decoded picture output and removal process */
94 
95 } dec_nal_unit_svc_ext_params_t;
96 
97 /* Structure to contain information about reference base pic marking */
98 typedef struct
99 {
100     UWORD8 u1_adaptive_ref_base_pic_marking_mode_flag;
101     UWORD32 u4_memory_management_base_control_operation;
102     UWORD32 u4_difference_of_base_pic_nums_minus1;
103     UWORD32 u4_long_term_base_pic_num;
104 
105 } dec_ref_base_pic_marking_params_t;
106 
107 /*! Sequence level parameters svc extension */
108 
109 typedef struct
110 {
111     /** Presence of deblocking filter for inter-layer prediction in the slice
112      * header */
113     UWORD8 u1_inter_layer_deblocking_filter_control_present_flag;
114     UWORD8 u1_extended_spatial_scalability_idc; /** Geometrical parameters for the
115                                                    resampling processes */
116     /** horizontal phase shift of the chroma components in units of half luma
117      * samples*/
118     UWORD8 u1_chroma_phase_x_plus1_flag;
119     /** vertical phase shift of the chroma components in units of half luma
120      * samples */
121     UWORD8 u1_chroma_phase_y_plus1;
122     /* horizontal phase shift of chroma in units of half luma samples used for
123      * inter-layer prediction */
124     UWORD8 u1_seq_ref_layer_chroma_phase_x_plus1_flag;
125     /* vertical phase shift of chroma in units of half luma samples used for
126      * inter-layer prediction */
127     UWORD8 u1_seq_ref_layer_chroma_phase_y_plus1;
128     WORD32 i4_seq_scaled_ref_layer_left_offset;      /** horizontal left offset */
129     WORD32 i4_seq_scaled_ref_layer_top_offset;       /** vertical top offset */
130     WORD32 i4_seq_scaled_ref_layer_right_offset;     /**horizontal right offset */
131     WORD32 i4_seq_scaled_ref_layer_bottom_offset;    /** vertical bottom offset */
132     UWORD8 u1_seq_tcoeff_level_prediction_flag;      /** presence of the syntax element
133                                                         adaptive_tcoeff_level_prediction_flag
134                                                       */
135     UWORD8 u1_adaptive_tcoeff_level_prediction_flag; /** presence of
136                                                         tcoeff_level_prediction_flag
137                                                       */
138     /**  specifies presence of syntax elements in slice headers that refer to the
139      * subset sequence parameter set */
140     UWORD8 u1_slice_header_restriction_flag;
141     UWORD8 u1_svc_vui_parameters_present_flag;
142     svc_vui_ext_t *ps_svc_vui_ext;
143 } dec_subset_seq_params_t;
144 
145 typedef struct
146 {
147     WORD32 i4_left_offset; /*!< Scaled horizontal offset of the top left
148                            corner luma sample of reference layer from
149                            the top left corner luma sample of the current
150                            layer. (In the units of num MBs) */
151     WORD32 i4_rt_offset;   /*!< Scaled horizontal offset of the bottom right
152                            corner luma sample of reference layer from
153                            the top left corner luma sample of the
154                            current layer. (In the units of num MBs) */
155     WORD32 i4_top_offset;  /*!< Scaled vertical offset of the top left
156                            corner luma sample of reference layer from
157                            the top left corner luma sample of the current
158                            layer. (In the units of num MBs) */
159     WORD32 i4_bot_offset;  /*!< Scaled vertical offset of the bottom right
160                            corner luma sample of reference layer from
161                            the top left corner luma sample of the current
162                            layer. (In the units of num MBs) */
163 } dec_svc_crop_wnd_offset_t;
164 
165 typedef struct
166 {
167     UWORD32 u4_ref_layer_dq_id;
168     UWORD32 u4_disable_inter_layer_deblk_filter_idc;
169     WORD32 i4_inter_layer_slice_alpha_c0_offset_div2;
170     WORD32 i4_inter_layer_slice_beta_offset_div2;
171     UWORD8 u1_constrained_intra_resampling_flag;
172     UWORD8 u1_ref_layer_chroma_phase_x_plus1_flag;
173     UWORD8 u1_ref_layer_chroma_phase_y_plus1;
174 
175     WORD32 i4_scaled_ref_layer_left_offset;
176     WORD32 i4_scaled_ref_layer_right_offset;
177     WORD32 i4_scaled_ref_layer_top_offset;
178     WORD32 i4_scaled_ref_layer_bottom_offset;
179     UWORD8 u1_slice_skip_flag;
180     UWORD32 u4_num_mbs_in_slice_minus1;
181     UWORD8 u1_adaptive_base_mode_flag;
182     UWORD8 u1_default_base_mode_flag;
183     UWORD8 u1_adaptive_motion_prediction_flag;
184     UWORD8 u1_default_motion_prediction_flag;
185     UWORD8 u1_adaptive_residual_prediction_flag;
186     UWORD8 u1_default_residual_prediction_flag;
187     UWORD8 u1_tcoeff_level_prediction_flag;
188     UWORD8 u1_scan_idx_start;
189     UWORD8 u1_scan_idx_end;
190     UWORD8 u1_base_pred_weight_table_flag;
191     dec_ref_base_pic_marking_params_t s_ref_base_pic_marking_svc_ext;
192     UWORD8 u1_store_ref_base_pic_flag; /* specifies when dependency_id is equal to
193                                           the max value of the VCL NAL units of
194                                           the coded picture */
195 
196 } dec_slice_svc_ext_params_t;
197 
198 /* Prefix NAL unit svc extension parameters*/
199 
200 typedef struct
201 {
202     dec_nal_unit_svc_ext_params_t s_nal_svc_ext;
203     dec_ref_base_pic_marking_params_t s_ref_base_pic_marking_svc_ext;
204     UWORD8 u1_store_ref_base_pic_flag;                  /* specifies when dependency_id is equal to
205                                                            the max value of the VCL NAL units of
206                                                            the coded picture */
207     UWORD8 u1_additional_prefix_nal_unit_ext_flag;      /* To indicate whether additional nal unit
208                                                            extension data flag syntax elements */
209     UWORD8 u1_additional_prefix_nal_unit_ext_data_flag; /*Used for FUTURE USE */
210 
211 } dec_prefix_nal_unit_svc_ext_params_t;
212 
213 typedef enum
214 {
215     LIST_0 = 0,
216     LIST_1 = 1,
217     NUM_REF_LISTS
218 } REF_LIST_T;
219 
220 typedef enum
221 {
222     INTRA_16x16 = 0,
223     INTRA_NXN
224 } INTRA_MB_PRED_MODE_T;
225 
226 /* Transform type */
227 typedef enum
228 {
229     T_4X4 = 0,
230     T_8X8,
231     T_PCM
232 } TRANSFORM_TYPE_T;
233 
234 typedef struct
235 {
236     vcl_node_t *ps_top_node; /*!< VCL node corresponding to top most
237                              layer in the access unit.
238                              */
239     vcl_node_t *ps_bot_node; /*!< VCL node corresponding to
240                              bottom most layer to be decoded in the
241                              access unit. This parameter keeps updated
242                              during course of decoding from base layer
243                              till top most layer.
244                              */
245 
246     WORD32 i4_num_res_lyrs;  /*!< Number of layers with
247                              different resolutions. Layers with spatial
248                              resoluton change flag equal to 0 are
249                              considered to be of same resolution as
250                              reference layer's resolution.
251                              */
252     /* following 2 parameter will be updated only if      */
253     /* the picture boundary is detected due to difference */
254     /* in slice header syntax                             */
255 
256     UWORD16 u2_frm_num_next;  /*!< frame number of the next
257                               slice after picture boundary detection
258                               */
259     WORD8 i1_nal_ref_id_next; /*!< nal ref id of the next slice after picture boundary detection
260                               range [-1,3];  -1 says the picture boundary is detected
261                               by DQID of the layers
262                               */
263 } vcl_nal_t;
264 
265 typedef struct
266 {
267     WORD32 i4_num_non_vcl_nals;              /*!< Total number of non vcl nals that are
268                                              extracted from the bitstream.
269                                              */
270 
271     non_vcl_buf_hdr_t *ps_first_non_vcl_nal; /*!< This shall point to first NON VCL NAL
272                                              that is extracted from the input bitstream. This
273                                              shall be set to NULL if there are no VCL NALs
274                                              present in the bitstream in a access unit */
275 
276 } non_vcl_nal_t;
277 
278 typedef struct
279 {
280     WORD16 i2_mv_x; /*!< motion vectors in horizontal direction
281                     QPEL units
282                     */
283     WORD16 i2_mv_y; /*!< motion vectors in vertical direction QPEL
284                     units
285                     */
286 } mot_vec_t;
287 
288 typedef struct
289 {
290     mot_vec_t as_mv[NUM_SUB_MB_PARTS];
291     WORD32 i4_ref_idx;
292 } mb_part_mv_t;
293 
294 typedef struct
295 {
296     /*
297     PRED_16X16,
298     PRED_16X8,
299     PRED_8X16,
300     PRED_8X8,
301     */
302     UWORD8 u1_part_type;
303 
304     UWORD8 u1_mv_cnt;
305     /*
306     0-1 bits   : 1st partition
307     2-3 bits   : 2nd partition
308     4-5 bits   : 3rd partition
309     6-7 bits   : 4th partition
310 
311     Value
312     00     : B_DIRECT
313     01     : L0
314     10     : L1
315     11     : BiPred
316     */
317     UWORD8 u1_pred_mode; /* Pred mode shall have valid value till
318                          mode motion prediction only. Hence this value shall
319                          not be used for the motion compensation
320                          */
321     UWORD8 au1_mot_pred_flags[2];
322     UWORD8 au1_sub_mb_part_ht_wd[NUM_MB_PARTS * NUM_SUB_MB_PARTS];
323     UWORD8 au1_sub_mb_num[NUM_MB_PARTS * NUM_SUB_MB_PARTS >> 1];
324     WORD8 ai1_sub_mb_part_type[NUM_MB_PARTS];
325     mb_part_mv_t as_mb_part_dmv[2][NUM_MB_PARTS];
326 } inter_mb_prms_t; /* We need to improve on commenting */
327 
328 typedef struct
329 {
330     /*
331     0   : I_16x16
332     1   : I_NXN
333     */
334     WORD32 i4_pred_mode;
335     WORD32 i4_chroma_intra_pred_mode;
336     WORD8 ai1_rem_intra_pred_mode[NUM_INTRA_SUB_BLOCKS];
337 } intra_mb_prms_t; /* We need to improve on commenting */
338 
339 typedef union
340 {
341     inter_mb_prms_t s_inter;
342     intra_mb_prms_t s_intra;
343 } mb_prms_ext_t;
344 
345 typedef struct
346 {
347     UWORD8 u1_chroma_nnz; /*! NNZs of Chroma. Here each bit corresonds
348                           to a NNZs of 4x4 sub block. Lower 4 bits are
349                           used for Cb and upper are used for Cr */
350     UWORD16 u2_luma_nnz;  /*! NNZs of Luma. Here each bit corresonds
351                           to a NNZs of 4x4 sub block in raster scan
352                           order. */
353     WORD8 i1_mb_mode;     /*! MB mode of an MB */
354 
355     WORD8 i1_tx_size;     /*! transform size of an MB */
356 
357     WORD8 i1_slice_id;
358 } inter_lyr_mb_prms_t;
359 
360 /* the following 2 structures are used store certain parameters  */
361 /* across units for each layer or each dependency layer          */
362 typedef struct
363 {
364     WORD32 i4_updated_sts; /*!< flag to indicate whether the
365                            params have been updated
366                            */
367     WORD32 i4_ref_dq_id;   /*!< place to hold the ref_dqid of previous
368                            access unit
369                            */
370     WORD32 i4_nal_ref_id;  /*!< place to hold the nal_ref_id of previous
371                            access unit
372                            */
373     UWORD16 u2_frm_num;    /*!< place to hold the frame number of
374                            previous access unit  will be used to
375                            handle Errors in "frame_num"
376                            syntax elements
377                            */
378 } prev_au_prms_t;
379 
380 typedef struct
381 {
382     WORD32 i4_updated_sts; /*!< flag to indicate whether the
383                            params have been updated
384                            */
385 
386     UWORD8 u1_pps_id;      /*!< PPS ID of an access unit for a particular
387                            layer. will be used in concealment of
388                            Errors in next access unit
389                            */
390 
391     UWORD8 u1_sps_id;      /*!< SPS ID of an access unit for a particular
392                            layer. will be used in concealment of
393                            Errors in next access unit
394                            */
395 
396 } prev_au_sps_pps_t;
397 
398 typedef enum
399 {
400     /*CABAC SVC related flags*/
401     CABAC_BASE_MODE_FLAG = 460,
402     CABAC_MOT_PRED_FLAG0 = 463,
403     CABAC_MOT_PRED_FLAG1 = 464,
404     CABAC_RES_PRED_FLAG = 465
405 
406 } svc_cabac_table_num_t;
407 
408 typedef struct
409 {
410     dec_seq_params_t *ps_seq;
411     dec_subset_seq_params_t s_sps_svc_ext;
412 
413     /* sequence associated frame paramateres*/
414     WORD32 i4_reorder_depth;
415     UWORD16 u2_disp_height;
416     UWORD16 u2_disp_width;
417     UWORD16 u2_pic_wd;
418     UWORD16 u2_pic_ht;
419     UWORD16 u2_frm_wd_y;
420     UWORD16 u2_frm_ht_y;
421     UWORD16 u2_frm_wd_uv;
422     UWORD16 u2_frm_ht_uv;
423     UWORD8 u1_pad_len_y_v;
424     UWORD8 u1_pad_len_cr_v;
425     UWORD16 u2_crop_offset_y;
426     UWORD16 u2_crop_offset_uv;
427 } dec_svc_seq_params_t;
428 
429 typedef struct
430 {
431     /*svc related flags*/
432     UWORD8 u1_base_mode_flag;
433     UWORD8 u1_residual_prediction_flag;
434     UWORD8 u1_crop_window_flag;
435     UWORD8 au1_motion_pred_flag[2];
436 } dec_svc_mb_info_t;
437 
438 typedef struct _SvcDecLyrStruct
439 {
440     dec_struct_t s_dec;
441 
442     /*Pred + Res = Target when csbp is zero*/
443     ih264_pred_residual_recon_ft *pf_pred_residual_recon_luma_4x4;
444 
445     ih264_pred_residual_recon_ft *pf_pred_residual_recon_luma_8x8;
446 
447     ih264_pred_residual_recon_ft *pf_pred_residual_recon_luma_16x16;
448 
449     ih264_pred_residual_recon_chroma_ft *pf_pred_residual_recon_chroma_4x4;
450 
451     ih264_pred_residual_recon_chroma_ft *pf_pred_residual_recon_chroma_8x8;
452 
453     /* IT + Res + Recon*/
454     ih264_iquant_itrans_residual_recon_ft *pf_iquant_itrans_residual_recon_luma_4x4;
455 
456     ih264_iquant_itrans_residual_recon_ft *pf_iquant_itrans_residual_recon_luma_4x4_dc;
457 
458     ih264_iquant_itrans_residual_recon_ft *pf_iquant_itrans_residual_recon_luma_8x8;
459 
460     ih264_iquant_itrans_residual_recon_ft *pf_iquant_itrans_residual_recon_luma_8x8_dc;
461 
462     ih264_iquant_itrans_residual_recon_chroma_ft *pf_iquant_itrans_residual_recon_chroma_4x4;
463 
464     ih264_iquant_itrans_residual_recon_chroma_ft *pf_iquant_itrans_residual_recon_chroma_4x4_dc;
465 
466     /* Res nnz*/
467     ih264_residual_ft *pf_residual_luma_4x4;
468     ih264_residual_ft *pf_residual_luma_8x8;
469     ih264_residual_ft *pf_residual_luma_16x16;
470 
471     ih264_residual_chroma_ft *pf_residual_chroma_cb_cr_8x8;
472 
473     /*IT + residual */
474     ih264_iquant_itrans_residual_ft *pf_iquant_itrans_residual_luma_4x4;
475 
476     ih264_iquant_itrans_residual_ft *pf_iquant_itrans_residual_luma_4x4_dc;
477 
478     ih264_iquant_itrans_residual_ft *pf_iquant_itrans_residual_luma_8x8;
479 
480     ih264_iquant_itrans_residual_ft *pf_iquant_itrans_residual_luma_8x8_dc;
481 
482     ih264_iquant_itrans_residual_chroma_ft *pf_iquant_itrans_residual_chroma_4x4;
483 
484     ih264_iquant_itrans_residual_chroma_ft *pf_iquant_itrans_residual_chroma_4x4_dc;
485 
486     /* IT */
487     ih264_iquant_itrans_ft *pf_iquant_itrans_luma_4x4;
488 
489     ih264_iquant_itrans_ft *pf_iquant_itrans_luma_4x4_dc;
490 
491     ih264_iquant_itrans_ft *pf_iquant_itrans_luma_8x8;
492 
493     ih264_iquant_itrans_ft *pf_iquant_itrans_luma_8x8_dc;
494 
495     ih264_iquant_itrans_chroma_ft *pf_iquant_itrans_chroma_4x4;
496 
497     ih264_iquant_itrans_chroma_ft *pf_iquant_itrans_chroma_4x4_dc;
498 
499     /**
500      *SVC extension parsing strcture place holders
501      */
502     dec_nal_unit_svc_ext_params_t *ps_nal_svc_ext;
503     dec_prefix_nal_unit_svc_ext_params_t s_pre_nal_unit_svc_ext;
504     dec_svc_crop_wnd_offset_t *ps_crop_wnd_offset;
505     UWORD8 *apu1_crop_wnd_flag[MAX_DEP_LYRS_IN_RES];
506 
507     /**
508      *contexts for the CABAC related parsing
509      */
510     bin_ctxt_model_t *ps_base_mode_flag;
511     bin_ctxt_model_t *ps_motion_prediction_flag_l0;
512     bin_ctxt_model_t *ps_motion_prediction_flag_l1;
513     bin_ctxt_model_t *ps_residual_prediction_flag;
514 
515     /**
516      * Function pointers to read Params common to CAVLC and CABAC
517      */
518     WORD32(*pf_parse_inter_mb_svc_ext)
519     (struct _SvcDecLyrStruct *ps_dec, dec_mb_info_t *ps_cur_mb_info,
520      dec_svc_mb_info_t *ps_svc_cur_mb_info, UWORD8 u1_mb_num, UWORD8 u1_num_mbsNby2);
521 
522     WORD32(*pf_parse_inter_slice_svc_ext)
523     (struct _SvcDecLyrStruct *ps_dec, dec_slice_params_t *ps_slice, UWORD16 u2_first_mb_in_slice);
524 
525     /**
526      * Function pointers to parse inter slice data
527      */
528 
529     WORD32(*pf_parse_svc_inter_slice)
530     (struct _SvcDecLyrStruct *ps_dec, dec_slice_params_t *ps_slice, UWORD16 u2_first_mb_in_slice);
531 
532     /* inter layer precition buffers */
533 
534     /* 4x4 level */
535     mv_pred_t *ps_il_pred_mv_bank_buf_base;
536 
537     /* 16x16 level */
538     inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms_base;
539     inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms_frm_start;
540     inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms_cur_mb;
541     UWORD16 u2_inter_lyr_mb_prms_stride;
542     UWORD32 u4_inter_lyr_mb_prms_size; /* in Bytes */
543 
544     /* full frame size : -255 -255 */
545     WORD16 *pi2_il_residual_resample_luma_base;
546     WORD16 *pi2_il_residual_resample_chroma_base;
547     WORD16 *pi2_il_residual_resample_mb_luma_frm_start;
548     WORD16 *pi2_il_residual_resample_mb_chroma_frm_start;
549 
550     UWORD16 u2_residual_resample_luma_stride;
551     UWORD16 u2_residual_resample_chroma_stride;
552     UWORD32 u4_residual_resample_luma_size;   /* in Bytes */
553     UWORD32 u4_residual_resample_chroma_size; /* in Bytes */
554 
555     mv_pred_t *ps_il_pred_mv_bank_buf_cur_mb;
556 
557     UWORD8 *pu1_crop_wnd_flag;
558     /*
559      * Layer info flag - Base layer; Intermediate Enhancement Layers; Target
560      * Enhacement Layer.
561      */
562     UWORD8 u1_layer_identifier;
563     /* layer id of the current layer */
564     UWORD8 u1_layer_id;
565     /* flag to indicate if spatial layers are dyadic */
566     UWORD8 u1_dyadic_flag;
567     /* flag to indicate if current layer is base layer */
568     UWORD8 u1_base_res_flag;
569     /* reference layer for inter layer prediction, no quality layers */
570     UWORD8 u1_ref_layer_id;
571 
572     UWORD8 u1_restricted_res_change_flag;
573 
574     res_prms_t s_res_prms;
575 
576     void *pv_ref_lyr_offset;
577     void *pv_mode_mv_sample_ctxt;
578     void *pv_ii_pred_ctxt;
579     void *pv_residual_sample_ctxt;
580 
581     void *pv_intra_sample_ctxt;
582     /*!< projected locations buffer pointer exported by Intra Upsampling module
583     for luma this buffer contains the projected offsets and window width in
584     reference layer for each MB (in horizontal direction) of current resolution
585     layer.*/
586     ref_mb_map_t *ps_intsam_luma_map_horz;
587 
588     /*!< projected locations buffer pointer exported by Intra Upsampling module
589       for chroma this buffer contains the projected offsets and window width in
590       reference layer
591       for each MB (in horizontal direction) of current resolution layer.*/
592     ref_mb_map_t *ps_intsam_chroma_map_horz;
593 
594     /*!< projected locations  buffer pointer exported by Intra Upsampling module
595        for luma this buffer contains the projected offsets and window width in
596        reference layer for each MB (in vertical direction) of current resolution
597        layer. */
598     ref_mb_map_t *ps_intsam_luma_map_vert;
599 
600     /*!<  projected locations buffer pointer exported by Intra Upsampling module
601        for chroma this buffer contains the projected offsets and window width in
602        reference layer for each MB (in vertical direction) of current resolution
603        layer.  */
604     ref_mb_map_t *ps_intsam_chroma_map_vert;
605 
606     /*!< projected locations buffer pointer exported by Residual Upsampling module
607     for luma. this buffer contains the projected offsets and window width in
608     reference layer for each MB (in horizontal direction) of current resolution
609     layer. */
610     ref_mb_map_t *ps_ressam_luma_map_horz;
611 
612     /*!< projected locations buffer pointer exported by Residual Upsampling module
613         for chroma. this buffer contains the projected offsets and window width in
614        reference layer
615         for each MB (in horizontal direction) of current resolution layer. */
616     ref_mb_map_t *ps_ressam_chroma_map_horz;
617 
618     /*!< projected locationscbuffer pointercexported by Residual Upsampling
619     modulec for chroma. this buffer contains the projected offsets and window
620     width in reference layer for each MB (in vertical direction) ofv    current
621     resolution layer. */
622     ref_mb_map_t *ps_ressam_luma_map_vert;
623 
624     /*!< projected locationscbuffer pointerccexported by Residual Upsampling
625     module for chroma.cthis buffer contains the projected offsets and window width
626     in reference layer for each MB (in vertical direction) of current resolution
627     layer.*/
628     ref_mb_map_t *ps_ressam_chroma_map_vert;
629 
630     /* pointer to decoder layer referered by current layer */
631     void *ps_dec_svc_ref_layer;
632     /* pointer to master context */
633     void *ps_svcd_ctxt;
634 
635     UWORD8 u1_inter_lyr_disable_dblk_filter_idc;
636     WORD8 i1_inter_lyr_slice_alpha_c0_offset;
637     WORD8 i1_inter_lyr_slice_beta_offset;
638 
639     UWORD8 *pu1_ii_resamp_buffer_luma;
640     UWORD8 *pu1_ii_resamp_buffer_chroma;
641 
642     dec_slice_svc_ext_params_t s_svc_slice_params;
643     dec_svc_seq_params_t *ps_subset_sps;
644     dec_svc_seq_params_t *ps_cur_subset_sps;
645     void *pv_scratch_subset_sps;
646 
647     /* Variables Required for N MB design */
648     dec_svc_mb_info_t *ps_svc_nmb_info;
649 
650     dec_svc_mb_info_t *ps_svc_frm_mb_info;
651 
652     void (*pf_svc_compute_bs)(struct _SvcDecLyrStruct *ps_svc_lyr_dec,
653                               struct _DecMbInfo *ps_cur_mb_info, const UWORD16 u2_mbxn_mb);
654 
655     UWORD16 *pu2_frm_res_luma_csbp;
656     WORD32 i4_frm_res_luma_csbp_stride;
657 
658     UWORD8 *pu1_svc_base_mode_flag;
659     WORD32 i4_frm_svc_base_mode_cabac_stride;
660     WORD32 i4_frm_svc_base_mode_cabac_size;
661     UWORD32 u4_pps_id_for_layer;
662     UWORD8 u1_error_in_cur_frame;
663 } svc_dec_lyr_struct_t;
664 
665 typedef struct
666 {
667     /* common parameters for all layers in SVC */
668     UWORD32 u4_num_cores;
669     IVD_ARCH_T e_processor_arch;
670     IVD_SOC_T e_processor_soc;
671     UWORD8 u1_target_layer_id;
672     UWORD8 u1_cur_layer_id;
673 
674     /* dcode context for all layers in SVC */
675     svc_dec_lyr_struct_t *ps_svc_dec_lyr;
676 
677     dec_pic_params_t *ps_pps;
678     dec_seq_params_t *ps_sps;
679     dec_svc_seq_params_t *ps_subset_sps;
680     struct _sei *ps_sei;
681     struct _sei *ps_sei_parse;
682 
683     /* attributes related to set tgt layer api func */
684     WORD32 u1_tgt_dep_id;
685     WORD32 u1_tgt_quality_id;
686     WORD32 u1_tgt_temp_id;
687     WORD32 u1_tgt_priority_id;
688 
689     ref_lyr_scaled_offset_t as_ref_lyr_offsets[MAX_NUM_RES_LYRS];
690 
691     void *pv_ref_lyr_offset;
692     void *pv_mode_mv_sample_ctxt;
693     void *pv_ii_pred_ctxt;
694     void *pv_residual_sample_ctxt;
695     void *pv_intra_sample_ctxt;
696 
697     void *pv_nal_parse_ctxt;
698     non_vcl_nal_t s_non_vcl_nal; /*!< NON VCL nal structure */
699     vcl_nal_t s_vcl_nal;         /*!< VCL nal structure */
700 
701     /*!< array to store the Did of bottom most layer in each resolution */
702     WORD32 ai4_dq_id_map[MAX_NUM_RES_LYRS];
703     WORD32 i4_error_code;
704     void *pv_vcl_nal_buff;
705     void *pv_non_vcl_nal_buff;
706 
707     /*!< array of structure to store the reference layer DQID,
708     poc syntax and frame num, for each depedency id
709     present in an access unit this will be used as reference
710     for the next access unit */
711     prev_au_prms_t as_au_prms_dep[MAX_DEPENDENCY_LYRS];
712     /*!< array to store the pps id for each layer in a resolution */
713     prev_au_sps_pps_t as_pps_sps_prev_au[MAX_TOTAL_LYRS];
714 
715     WORD32 i4_eos_flag;
716     UWORD8 u1_prev_num_res_layers;
717     UWORD32 u4_num_sps_ctr;
718     UWORD32 u4_num_pps_ctr;
719     UWORD8 u1_parse_nal_unit_error;
720     UWORD8 u1_exit_till_next_IDR;
721     UWORD8 u1_pre_parse_in_flush;
722 } svc_dec_ctxt_t;
723 
724 #endif /*_ISVCD_STRUCTS_H_*/