xref: /utopia/UTPA2-700.0.x/modules/mfe/drv/mfe_ex/cModel/parsetcommon.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 
79 /*!
80  **************************************************************************************
81  * \file
82  *    parsetcommon.h
83  * \brief
84  *    Picture and Sequence Parameter Sets, structures common to encoder and decoder
85  *
86  * \date 25 November 2002
87  * \author
88  *    Main contributors (see contributors.h for copyright, address and affiliation details)
89  *      - Stephan Wenger        <stewe@cs.tu-berlin.de>
90  ***************************************************************************************
91  */
92 
93 
94 // In the JVT syntax, frequently flags are used that indicate the presence of
95 // certain pieces of information in the NALU.  Here, these flags are also
96 // present.  In the encoder, those bits indicate that the values signaled to
97 // be present are meaningful and that this part of the syntax should be
98 // written to the NALU.  In the decoder, the flag indicates that information
99 // was received from the decoded NALU and should be used henceforth.
100 // The structure names were chosen as indicated in the JVT syntax
101 
102 #ifndef _PARSETCOMMON_H_
103 #define _PARSETCOMMON_H_
104 
105 #define MAXIMUMPARSETRBSPSIZE   1500UL
106 #define MAXIMUMPARSETNALUSIZE   1500UL
107 
108 #define MAXIMUMVALUEOFcpb_cnt   32UL
109 typedef struct
110 {
111 	MS_U32 cpb_cnt_minus1;                                   // ue(v)
112 	MS_U32 bit_rate_scale;                                   // u(4)
113 	MS_U32 cpb_size_scale;                                   // u(4)
114     MS_U32 bit_rate_value_minus1 [MAXIMUMVALUEOFcpb_cnt];  // ue(v)
115     MS_U32 cpb_size_value_minus1 [MAXIMUMVALUEOFcpb_cnt];  // ue(v)
116     MS_U32 cbr_flag              [MAXIMUMVALUEOFcpb_cnt];  // u(1)
117 	MS_U32 initial_cpb_removal_delay_length_minus1;          // u(5)
118 	MS_U32 cpb_removal_delay_length_minus1;                  // u(5)
119 	MS_U32 dpb_output_delay_length_minus1;                   // u(5)
120 	MS_U32 time_offset_length;                               // u(5)
121 } hrd_parameters_t;
122 
123 
124 typedef struct
125 {
126 	MS_BOOL      aspect_ratio_info_present_flag;                   // u(1)
127     MS_U32 aspect_ratio_idc;                               // u(8)
128 	MS_U32 sar_width;                                    // u(16)
129 	MS_U32 sar_height;                                   // u(16)
130 	MS_BOOL      overscan_info_present_flag;                       // u(1)
131     MS_BOOL      overscan_appropriate_flag;                      // u(1)
132 	MS_BOOL      video_signal_type_present_flag;                   // u(1)
133     MS_U32 video_format;                                   // u(3)
134     MS_BOOL      video_full_range_flag;                          // u(1)
135     MS_BOOL      colour_description_present_flag;                // u(1)
136 	MS_U32 colour_primaries;                             // u(8)
137 	MS_U32 transfer_characteristics;                     // u(8)
138 	MS_U32 matrix_coefficients;                          // u(8)
139 	MS_BOOL      chroma_location_info_present_flag;                // u(1)
140     MS_U32  chroma_sample_loc_type_top_field;               // ue(v)
141     MS_U32  chroma_sample_loc_type_bottom_field;            // ue(v)
142 	MS_BOOL      timing_info_present_flag;                         // u(1)
143     MS_U32 num_units_in_tick;                              // u(32)
144     MS_U32 time_scale;                                     // u(32)
145     MS_BOOL      fixed_frame_rate_flag;                          // u(1)
146 	MS_BOOL      nal_hrd_parameters_present_flag;                  // u(1)
147     hrd_parameters_t nal_hrd_parameters;                      // hrd_paramters_t
148 	MS_BOOL      vcl_hrd_parameters_present_flag;                  // u(1)
149     hrd_parameters_t vcl_hrd_parameters;                      // hrd_paramters_t
150 	// if ((nal_hrd_parameters_present_flag || (vcl_hrd_parameters_present_flag))
151     MS_BOOL      low_delay_hrd_flag;                             // u(1)
152 	MS_BOOL      pic_struct_present_flag;                        // u(1)
153 	MS_BOOL      bitstream_restriction_flag;                       // u(1)
154     MS_BOOL      motion_vectors_over_pic_boundaries_flag;        // u(1)
155     MS_U32 max_bytes_per_pic_denom;                        // ue(v)
156     MS_U32 max_bits_per_mb_denom;                          // ue(v)
157     MS_U32 log2_max_mv_length_vertical;                    // ue(v)
158     MS_U32 log2_max_mv_length_horizontal;                  // ue(v)
159     MS_U32 num_reorder_frames;                             // ue(v)
160     MS_U32 max_dec_frame_buffering;                        // ue(v)
161 } vui_seq_parameters_t;
162 
163 
164 #define MAXnum_slice_groups_minus1  8UL
165 typedef struct
166 {
167 	MS_BOOL   Valid;                  // indicates the parameter set is valid
168 	MS_U32 pic_parameter_set_id;                             // ue(v)
169 	MS_U32 seq_parameter_set_id;                             // ue(v)
170 	MS_BOOL   entropy_coding_mode_flag;                         // u(1)
171 
172 	MS_BOOL   transform_8x8_mode_flag;                          // u(1)
173 
174 	MS_BOOL   pic_scaling_matrix_present_flag;                  // u(1)
175 	MS_S32       pic_scaling_list_present_flag[12];                 // u(1)
176 
177 	// if( pic_order_cnt_type < 2 )  in the sequence parameter set
178 	MS_BOOL      pic_order_present_flag;                           // u(1)
179 	MS_U32 num_slice_groups_minus1;                          // ue(v)
180     MS_U32 slice_group_map_type;                        // ue(v)
181     // if( slice_group_map_type = = 0 )
182 	MS_U32 run_length_minus1[MAXnum_slice_groups_minus1]; // ue(v)
183     // else if( slice_group_map_type = = 2 )
184 	MS_U32 top_left[MAXnum_slice_groups_minus1];         // ue(v)
185 	MS_U32 bottom_right[MAXnum_slice_groups_minus1];     // ue(v)
186     // else if( slice_group_map_type = = 3 || 4 || 5
187 	MS_BOOL   slice_group_change_direction_flag;            // u(1)
188 	MS_U32 slice_group_change_rate_minus1;               // ue(v)
189     // else if( slice_group_map_type = = 6 )
190 	MS_U32 pic_size_in_map_units_minus1;                 // ue(v)
191 	MS_U8      *slice_group_id;                              // complete MBAmap u(v)
192 
193 	MS_S32 num_ref_idx_l0_active_minus1;                     // ue(v)
194 	MS_S32 num_ref_idx_l1_active_minus1;                     // ue(v)
195 	MS_BOOL   weighted_pred_flag;                               // u(1)
196 	MS_U32  weighted_bipred_idc;                              // u(2)
197 	MS_S32       pic_init_qp_minus26;                              // se(v)
198 	MS_S32       pic_init_qs_minus26;                              // se(v)
199 	MS_S32       chroma_qp_index_offset;                           // se(v)
200 
201 	MS_S32       cb_qp_index_offset;                               // se(v)
202 	MS_S32       cr_qp_index_offset;                               // se(v)
203 
204 	MS_BOOL   deblocking_filter_control_present_flag;           // u(1)
205 	MS_BOOL   constrained_intra_pred_flag;                      // u(1)
206 	MS_BOOL   redundant_pic_cnt_present_flag;                   // u(1)
207 	MS_BOOL   vui_pic_parameters_flag;                          // u(1)
208 } pic_parameter_set_rbsp_t;
209 
210 
211 #define MAXnum_ref_frames_in_pic_order_cnt_cycle  256UL
212 typedef struct
213 {
214 	MS_BOOL   Valid;                  // indicates the parameter set is valid
215 
216 	MS_U32 profile_idc;                                      // u(8)
217 	MS_BOOL   constrained_set0_flag;                            // u(1)
218 	MS_BOOL   constrained_set1_flag;                            // u(1)
219 	MS_BOOL   constrained_set2_flag;                            // u(1)
220 	MS_BOOL   constrained_set3_flag;                            // u(1)
221 	MS_U32 level_idc;                                        // u(8)
222 	MS_U32 seq_parameter_set_id;                             // ue(v)
223 	MS_U32 chroma_format_idc;                                // ue(v)
224 
225 	MS_U32 bit_depth_luma_minus8;                            // ue(v)
226 	MS_U32 bit_depth_chroma_minus8;                          // ue(v)
227 	MS_U32 log2_max_frame_num_minus4;                        // ue(v)
228 	MS_U32 pic_order_cnt_type;
229 	// if( pic_order_cnt_type == 0 )
230 	MS_U32 log2_max_pic_order_cnt_lsb_minus4;                 // ue(v)
231 	// else if( pic_order_cnt_type == 1 )
232       MS_BOOL delta_pic_order_always_zero_flag;               // u(1)
233       MS_S32     offset_for_non_ref_pic;                         // se(v)
234       MS_S32     offset_for_top_to_bottom_field;                 // se(v)
235       MS_U32 num_ref_frames_in_pic_order_cnt_cycle;          // ue(v)
236     // for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
237 	MS_S32   offset_for_ref_frame[MAXnum_ref_frames_in_pic_order_cnt_cycle];   // se(v)
238 	MS_U32 num_ref_frames;                                   // ue(v)
239 	MS_BOOL   gaps_in_frame_num_value_allowed_flag;             // u(1)
240 	MS_U32 pic_width_in_mbs_minus1;                          // ue(v)
241 	MS_U32 pic_height_in_map_units_minus1;                   // ue(v)
242 	MS_BOOL   frame_mbs_only_flag;                              // u(1)
243 	// if( !frame_mbs_only_flag )
244       MS_BOOL   mb_adaptive_frame_field_flag;                   // u(1)
245 	MS_BOOL   direct_8x8_inference_flag;                        // u(1)
246 	MS_BOOL   frame_cropping_flag;                              // u(1)
247       MS_U32 frame_cropping_rect_left_offset;                // ue(v)
248       MS_U32 frame_cropping_rect_right_offset;               // ue(v)
249       MS_U32 frame_cropping_rect_top_offset;                 // ue(v)
250       MS_U32 frame_cropping_rect_bottom_offset;              // ue(v)
251 	MS_BOOL   vui_parameters_present_flag;                      // u(1)
252       vui_seq_parameters_t vui_seq_parameters;                  // vui_seq_parameters_t
253       MS_U32  separate_colour_plane_flag;                       // u(1)
254 } seq_parameter_set_rbsp_t;
255 
256 #endif
257