• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __MSM_VIDC_UTILS_H__
2 #define __MSM_VIDC_UTILS_H__
3 
4 #include <linux/types.h>
5 
6 #define MSM_VIDC_HAL_INTERLACE_COLOR_FORMAT_NV12	0x2
7 #define MSM_VIDC_HAL_INTERLACE_COLOR_FORMAT_NV12_UBWC	0x8002
8 #define MSM_VIDC_EXTRADATA_FRAME_QP_ADV 0x1
9 
10 struct msm_vidc_extradata_header {
11 	unsigned int size;
12 	unsigned int:32; /** Keeping binary compatibility */
13 	unsigned int:32; /* with firmware and OpenMAX IL **/
14 	unsigned int type; /* msm_vidc_extradata_type */
15 	unsigned int data_size;
16 	unsigned char data[1];
17 };
18 
19 struct msm_vidc_interlace_payload {
20 	unsigned int format;
21 	unsigned int color_format;
22 };
23 
24 struct msm_vidc_framerate_payload {
25 	unsigned int frame_rate;
26 };
27 
28 struct msm_vidc_ts_payload {
29 	unsigned int timestamp_lo;
30 	unsigned int timestamp_hi;
31 };
32 
33 struct msm_vidc_concealmb_payload {
34 	unsigned int num_mbs;
35 };
36 
37 struct msm_vidc_recoverysei_payload {
38 	unsigned int flags;
39 };
40 
41 struct msm_vidc_aspect_ratio_payload {
42 	unsigned int size;
43 	unsigned int version;
44 	unsigned int port_index;
45 	unsigned int aspect_width;
46 	unsigned int aspect_height;
47 };
48 
49 struct msm_vidc_mpeg2_seqdisp_payload {
50 	unsigned int video_format;
51 	unsigned int color_descp;
52 	unsigned int color_primaries;
53 	unsigned int transfer_char;
54 	unsigned int matrix_coeffs;
55 	unsigned int disp_width;
56 	unsigned int disp_height;
57 };
58 
59 struct msm_vidc_input_crop_payload {
60 	unsigned int size;
61 	unsigned int version;
62 	unsigned int port_index;
63 	unsigned int left;
64 	unsigned int top;
65 	unsigned int width;
66 	unsigned int height;
67 };
68 
69 struct msm_vidc_misr_info {
70 	unsigned int misr_set;
71 	unsigned int misr_dpb_luma[8];
72 	unsigned int misr_dpb_chroma[8];
73 	unsigned int misr_opb_luma[8];
74 	unsigned int misr_opb_chroma[8];
75 };
76 struct msm_vidc_output_crop_payload {
77 	unsigned int size;
78 	unsigned int version;
79 	unsigned int port_index;
80 	unsigned int left;
81 	unsigned int top;
82 	unsigned int display_width;
83 	unsigned int display_height;
84 	unsigned int width;
85 	unsigned int height;
86 	unsigned int frame_num;
87 	unsigned int bit_depth_y;
88 	unsigned int bit_depth_c;
89 	struct msm_vidc_misr_info misr_info[2];
90 };
91 
92 struct msm_vidc_extradata_index {
93 	unsigned int type;
94 	union {
95 		struct msm_vidc_input_crop_payload input_crop;
96 		struct msm_vidc_aspect_ratio_payload aspect_ratio;
97 	};
98 };
99 
100 struct msm_vidc_panscan_window {
101 	unsigned int panscan_height_offset;
102 	unsigned int panscan_width_offset;
103 	unsigned int panscan_window_width;
104 	unsigned int panscan_window_height;
105 };
106 
107 struct msm_vidc_panscan_window_payload {
108 	unsigned int num_panscan_windows;
109 	struct msm_vidc_panscan_window wnd[1];
110 };
111 
112 struct msm_vidc_stream_userdata_payload {
113 	unsigned int type;
114 	unsigned int data[1];
115 };
116 
117 struct msm_vidc_frame_qp_payload {
118 	unsigned int frame_qp;
119 	unsigned int qp_sum;
120 	unsigned int skip_qp_sum;
121 	unsigned int skip_num_blocks;
122 	unsigned int total_num_blocks;
123 };
124 
125 struct msm_vidc_dts_payload {
126 	unsigned int timestamp_hi;
127 	unsigned int timestamp_lo;
128 };
129 
130 struct msm_vidc_frame_bits_info_payload {
131 	unsigned int frame_bits;
132 	unsigned int header_bits;
133 };
134 
135 struct msm_vidc_s3d_frame_packing_payload {
136 	unsigned int fpa_id;
137 	unsigned int cancel_flag;
138 	unsigned int fpa_type;
139 	unsigned int quin_cunx_flag;
140 	unsigned int content_interprtation_type;
141 	unsigned int spatial_flipping_flag;
142 	unsigned int frame0_flipped_flag;
143 	unsigned int field_views_flag;
144 	unsigned int current_frame_is_frame0_flag;
145 	unsigned int frame0_self_contained_flag;
146 	unsigned int frame1_self_contained_flag;
147 	unsigned int frame0_graid_pos_x;
148 	unsigned int frame0_graid_pos_y;
149 	unsigned int frame1_graid_pos_x;
150 	unsigned int frame1_graid_pos_y;
151 	unsigned int fpa_reserved_byte;
152 	unsigned int fpa_repetition_period;
153 	unsigned int fpa_extension_flag;
154 };
155 
156 struct msm_vidc_ubwc_cr_stats_info {
157 	unsigned int stats_tile_32;
158 	unsigned int stats_tile_64;
159 	unsigned int stats_tile_96;
160 	unsigned int stats_tile_128;
161 	unsigned int stats_tile_160;
162 	unsigned int stats_tile_192;
163 	unsigned int stats_tile_256;
164 };
165 
166 struct msm_vidc_yuv_stats_payload {
167 	unsigned int frame_qp;
168 	unsigned int texture;
169 	unsigned int luma_in_q16;
170 	unsigned int frame_difference;
171 };
172 
173 struct msm_vidc_vpx_colorspace_payload {
174 	unsigned int color_space;
175 	unsigned int yuv_range_flag;
176 	unsigned int sumsampling_x;
177 	unsigned int sumsampling_y;
178 };
179 
180 struct msm_vidc_roi_qp_payload {
181 	int upper_qp_offset;
182 	int lower_qp_offset;
183 	unsigned int b_roi_info;
184 	int mbi_info_size;
185 	unsigned int data[1];
186 };
187 
188 #define MSM_VIDC_EXTRADATA_ROI_DELTAQP 0x1
189 struct msm_vidc_roi_deltaqp_payload {
190 	unsigned int b_roi_info; /*Enable/Disable*/
191 	int mbi_info_size; /*Size of QP data*/
192 	unsigned int data[1];
193 };
194 
195 struct msm_vidc_hdr10plus_metadata_payload {
196 	unsigned int size;
197 	unsigned int data[1];
198 };
199 
200 struct msm_vidc_mastering_display_colour_sei_payload {
201 	unsigned int nDisplayPrimariesX[3];
202 	unsigned int nDisplayPrimariesY[3];
203 	unsigned int nWhitePointX;
204 	unsigned int nWhitePointY;
205 	unsigned int nMaxDisplayMasteringLuminance;
206 	unsigned int nMinDisplayMasteringLuminance;
207 };
208 
209 struct msm_vidc_content_light_level_sei_payload {
210 	unsigned int nMaxContentLight;
211 	unsigned int nMaxPicAverageLight;
212 };
213 
214 struct msm_vidc_vui_display_info_payload {
215 	unsigned int video_signal_present_flag;
216 	unsigned int video_format;
217 	unsigned int bit_depth_y;
218 	unsigned int bit_depth_c;
219 	unsigned int video_full_range_flag;
220 	unsigned int color_description_present_flag;
221 	unsigned int color_primaries;
222 	unsigned int transfer_characteristics;
223 	unsigned int matrix_coefficients;
224 	unsigned int chroma_location_info_present_flag;
225 	unsigned int chroma_format_idc;
226 	unsigned int separate_color_plane_flag;
227 	unsigned int chroma_sample_loc_type_top_field;
228 	unsigned int chroma_sample_loc_type_bottom_field;
229 };
230 
231 /* msm_vidc_extradata_type */
232 #define MSM_VIDC_EXTRADATA_NONE 0x00000000
233 #define MSM_VIDC_EXTRADATA_MB_QUANTIZATION 0x00000001
234 #define MSM_VIDC_EXTRADATA_INTERLACE_VIDEO 0x00000002
235 #define MSM_VIDC_EXTRADATA_TIMESTAMP 0x00000005
236 #define MSM_VIDC_EXTRADATA_S3D_FRAME_PACKING 0x00000006
237 #define MSM_VIDC_EXTRADATA_FRAME_RATE 0x00000007
238 #define MSM_VIDC_EXTRADATA_PANSCAN_WINDOW 0x00000008
239 #define MSM_VIDC_EXTRADATA_RECOVERY_POINT_SEI 0x00000009
240 #define MSM_VIDC_EXTRADATA_MPEG2_SEQDISP 0x0000000D
241 #define MSM_VIDC_EXTRADATA_STREAM_USERDATA 0x0000000E
242 #define MSM_VIDC_EXTRADATA_FRAME_QP 0x0000000F
243 #define MSM_VIDC_EXTRADATA_FRAME_BITS_INFO 0x00000010
244 #define MSM_VIDC_EXTRADATA_ROI_QP 0x00000013
245 #define MSM_VIDC_EXTRADATA_VPX_COLORSPACE_INFO 0x00000014
246 #define MSM_VIDC_EXTRADATA_MASTERING_DISPLAY_COLOUR_SEI 0x00000015
247 #define MSM_VIDC_EXTRADATA_CONTENT_LIGHT_LEVEL_SEI 0x00000016
248 #define MSM_VIDC_EXTRADATA_PQ_INFO 0x00000017
249 #define MSM_VIDC_EXTRADATA_COLOUR_REMAPPING_INFO_SEI 0x00000018
250 #define MSM_VIDC_EXTRADATA_UBWC_CR_STAT_INFO 0x00000019
251 #define MSM_VIDC_EXTRADATA_HDR10PLUS_METADATA 0x0000001A
252 #define MSM_VIDC_EXTRADATA_INPUT_CROP 0x0700000E
253 #define MSM_VIDC_EXTRADATA_OUTPUT_CROP 0x0700000F
254 #define MSM_VIDC_EXTRADATA_MULTISLICE_INFO 0x7F100000
255 #define MSM_VIDC_EXTRADATA_NUM_CONCEALED_MB 0x7F100001
256 #define MSM_VIDC_EXTRADATA_INDEX 0x7F100002
257 #define MSM_VIDC_EXTRADATA_ASPECT_RATIO 0x7F100003
258 #define MSM_VIDC_EXTRADATA_METADATA_LTR 0x7F100004
259 #define MSM_VIDC_EXTRADATA_METADATA_MBI 0x7F100005
260 #define MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO 0x7F100006
261 #define MSM_VIDC_EXTRADATA_ENC_DTS_INFO 0x7F100008
262 
263 /* msm_vidc_interlace_type */
264 #define MSM_VIDC_INTERLACE_FRAME_PROGRESSIVE 0x01
265 #define MSM_VIDC_INTERLACE_INTERLEAVE_FRAME_TOPFIELDFIRST 0x02
266 #define MSM_VIDC_INTERLACE_INTERLEAVE_FRAME_BOTTOMFIELDFIRST 0x04
267 #define MSM_VIDC_INTERLACE_FRAME_TOPFIELDFIRST 0x08
268 #define MSM_VIDC_INTERLACE_FRAME_BOTTOMFIELDFIRST 0x10
269 #define MSM_VIDC_INTERLACE_FRAME_MBAFF 0x20
270 
271 /* msm_vidc_framepack_type */
272 #define MSM_VIDC_FRAMEPACK_CHECKERBOARD 0x00
273 #define MSM_VIDC_FRAMEPACK_COLUMN_INTERLEAVE 0x01
274 #define MSM_VIDC_FRAMEPACK_ROW_INTERLEAVE 0x02
275 #define MSM_VIDC_FRAMEPACK_SIDE_BY_SIDE 0x03
276 #define MSM_VIDC_FRAMEPACK_TOP_BOTTOM 0x04
277 #define MSM_VIDC_FRAMEPACK_TEMPORAL_INTERLEAVE 0x05
278 
279 /* msm_vidc_recovery_sei */
280 #define MSM_VIDC_FRAME_RECONSTRUCTION_INCORRECT 0x0
281 #define MSM_VIDC_FRAME_RECONSTRUCTION_CORRECT 0x01
282 #define MSM_VIDC_FRAME_RECONSTRUCTION_APPROXIMATELY_CORRECT 0x02
283 
284 /* msm_vidc_userdata_type */
285 #define MSM_VIDC_USERDATA_TYPE_FRAME 0x1
286 #define MSM_VIDC_USERDATA_TYPE_TOP_FIELD 0x2
287 #define MSM_VIDC_USERDATA_TYPE_BOTTOM_FIELD 0x3
288 
289 /* See colour_primaries of ISO/IEC 14496 for significance */
290 /* msm_vidc_h264_color_primaries_values */
291 #define MSM_VIDC_RESERVED_1 0
292 #define MSM_VIDC_BT709_5 1
293 #define MSM_VIDC_UNSPECIFIED 2
294 #define MSM_VIDC_RESERVED_2 3
295 #define MSM_VIDC_BT470_6_M 4
296 #define MSM_VIDC_BT601_6_625 5
297 #define MSM_VIDC_BT470_6_BG MSM_VIDC_BT601_6_625
298 #define MSM_VIDC_BT601_6_525 6
299 #define MSM_VIDC_SMPTE_240M 7
300 #define MSM_VIDC_GENERIC_FILM 8
301 #define MSM_VIDC_BT2020 9
302 
303 /* msm_vidc_vp9_color_primaries_values */
304 #define MSM_VIDC_CS_UNKNOWN 0
305 #define MSM_VIDC_CS_BT_601 1
306 #define MSM_VIDC_CS_BT_709 2
307 #define MSM_VIDC_CS_SMPTE_170 3
308 #define MSM_VIDC_CS_SMPTE_240 4
309 #define MSM_VIDC_CS_BT_2020 5
310 #define MSM_VIDC_CS_RESERVED 6
311 #define MSM_VIDC_CS_RGB 7
312 
313 /* msm_vidc_h264_matrix_coeff_values */
314 #define MSM_VIDC_MATRIX_RGB 0
315 #define MSM_VIDC_MATRIX_BT_709_5 1
316 #define MSM_VIDC_MATRIX_UNSPECIFIED 2
317 #define MSM_VIDC_MATRIX_RESERVED 3
318 #define MSM_VIDC_MATRIX_FCC_47 4
319 #define MSM_VIDC_MATRIX_601_6_625 5
320 #define MSM_VIDC_MATRIX_BT470_BG MSM_VIDC_MATRIX_601_6_625
321 #define MSM_VIDC_MATRIX_601_6_525 6
322 #define MSM_VIDC_MATRIX_SMPTE_170M MSM_VIDC_MATRIX_601_6_525
323 #define MSM_VIDC_MATRIX_SMPTE_240M 7
324 #define MSM_VIDC_MATRIX_Y_CG_CO 8
325 #define MSM_VIDC_MATRIX_BT_2020 9
326 #define MSM_VIDC_MATRIX_BT_2020_CONST 10
327 
328 /* msm_vidc_h264_transfer_chars_values */
329 #define MSM_VIDC_TRANSFER_RESERVED_1 0
330 #define MSM_VIDC_TRANSFER_BT709_5 1
331 #define MSM_VIDC_TRANSFER_UNSPECIFIED 2
332 #define MSM_VIDC_TRANSFER_RESERVED_2 3
333 #define MSM_VIDC_TRANSFER_BT_470_6_M 4
334 #define MSM_VIDC_TRANSFER_BT_470_6_BG 5
335 #define MSM_VIDC_TRANSFER_601_6_625 6
336 #define MSM_VIDC_TRANSFER_601_6_525 MSM_VIDC_TRANSFER_601_6_625
337 #define MSM_VIDC_TRANSFER_SMPTE_240M 7
338 #define MSM_VIDC_TRANSFER_LINEAR 8
339 #define MSM_VIDC_TRANSFER_LOG_100_1 9
340 #define MSM_VIDC_TRANSFER_LOG_100_SQRT10_1 10
341 #define MSM_VIDC_TRANSFER_IEC_61966 11
342 #define MSM_VIDC_TRANSFER_BT_1361 12
343 #define MSM_VIDC_TRANSFER_SRGB 13
344 #define MSM_VIDC_TRANSFER_BT_2020_10 14
345 #define MSM_VIDC_TRANSFER_BT_2020_12 15
346 #define MSM_VIDC_TRANSFER_SMPTE_ST2084 16
347 #define MSM_VIDC_TRANSFER_SMPTE_ST428_1 17
348 #define MSM_VIDC_TRANSFER_HLG 18
349 
350 /* msm_vidc_pixel_depth */
351 #define MSM_VIDC_BIT_DEPTH_8 0
352 #define MSM_VIDC_BIT_DEPTH_10 1
353 #define MSM_VIDC_BIT_DEPTH_UNSUPPORTED 0XFFFFFFFF
354 
355 /* msm_vidc_video_format */
356 #define MSM_VIDC_COMPONENT 0
357 #define MSM_VIDC_PAL 1
358 #define MSM_VIDC_NTSC 2
359 #define MSM_VIDC_SECAM 3
360 #define MSM_VIDC_MAC 4
361 #define MSM_VIDC_UNSPECIFIED_FORMAT 5
362 #define MSM_VIDC_RESERVED_1_FORMAT 6
363 #define MSM_VIDC_RESERVED_2_FORMAT 7
364 
365 /* msm_vidc_color_desc_flag */
366 #define MSM_VIDC_COLOR_DESC_NOT_PRESENT 0
367 #define MSM_VIDC_COLOR_DESC_PRESENT 1
368 
369 /*  msm_vidc_pic_struct */
370 #define MSM_VIDC_PIC_STRUCT_MAYBE_INTERLACED 0x0
371 #define MSM_VIDC_PIC_STRUCT_PROGRESSIVE 0x1
372 
373 /*default when layer ID isn't specified*/
374 #define MSM_VIDC_ALL_LAYER_ID 0xFF
375 
376 #endif
377