]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5_bsp/psu_cortexr5_0/libsrc/video_common_v4_3/src/xvidc.h
Update Zynq, MPSoc Cortex-A53 and MPSoc Cortex-R5 demo projects to build with the...
[freertos] / FreeRTOS / Demo / CORTEX_R5_UltraScale_MPSoC / RTOSDemo_R5_bsp / psu_cortexr5_0 / libsrc / video_common_v4_3 / src / xvidc.h
1 /*******************************************************************************
2  *
3  * Copyright (C) 2017 Xilinx, Inc.  All rights reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * Use of the Software is limited solely to applications:
16  * (a) running on a Xilinx device, or
17  * (b) that interact with a Xilinx device through a bus or interconnect.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22  * XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  *
27  * Except as contained in this notice, the name of the Xilinx shall not be used
28  * in advertising or otherwise to promote the sale, use or other dealings in
29  * this Software without prior written authorization from Xilinx.
30  *
31 *******************************************************************************/
32 /******************************************************************************/
33 /**
34  *
35  * @file xvidc.h
36  * @addtogroup video_common_v4_3
37  * @{
38  * @details
39  *
40  * Contains common structures, definitions, macros, and utility functions that
41  * are typically used by video-related drivers and applications.
42  *
43  * @note        None.
44  *
45  * <pre>
46  * MODIFICATION HISTORY:
47  *
48  * Ver   Who  Date     Changes
49  * ----- ---- -------- -----------------------------------------------
50  * 1.0   rc,  01/10/15 Initial release.
51  *       als
52  * 2.0   als  08/14/15 Added new video timings.
53  * 2.2   als  02/01/16 Functions with pointer arguments that don't modify
54  *                     contents now const.
55  *                     Added ability to insert a custom video timing table:
56  *                         XVidC_RegisterCustomTimingModes
57  *                         XVidC_UnregisterCustomTimingMode
58  *       yh            Added 3D support.
59  * 3.0   aad  05/13/16 Added API to search for RB video modes.
60  *       als  05/16/16 Added Y-only to color format enum.
61  * 3.1   rco  07/26/17 Moved timing table extern definition to xvidc.c
62  *                     Added video-in-memory color formats
63  *                     Updated XVidC_RegisterCustomTimingModes API signature
64  * 4.1   rco  11/23/17 Added new memory formats
65  *                     Added xil_printf include statement
66  *                     Added new API XVidC_GetVideoModeIdWBlanking
67  *                     Fix C++ warnings
68  * 4.2   jsr  07/22/17 Added new video modes, framerates, color formats for SDI
69  *                     New member AspectRatio is added to video stream structure
70  *                     Reordered XVidC_VideoMode enum variables and corrected the
71  *                     memory format enums
72  *       aad  07/10/17 Add XVIDC_VM_3840x2160_60_P_RB video format
73  *       vyc  10/04/17 Added new streaming alpha formats and new memory formats
74  *       aad  09/05/17 Add XVIDC_VM_1366x768_60_P_RB resolution
75  * 4.3   eb   26/01/18 Added API XVidC_GetVideoModeIdExtensive
76  *       jsr  02/22/18 Added XVIDC_CSF_YCBCR_420 color space format
77  *       vyc  04/04/18 Added BGR8 memory format
78  * </pre>
79  *
80 *******************************************************************************/
81
82 #ifndef XVIDC_H_  /* Prevent circular inclusions by using protection macros. */
83 #define XVIDC_H_
84
85 #ifdef __cplusplus
86 extern "C" {
87 #endif
88
89 /******************************* Include Files ********************************/
90
91 #include "xil_types.h"
92 #include "xil_printf.h"
93
94 /************************** Constant Definitions ******************************/
95
96 /**
97  * This typedef enumerates the list of available standard display monitor
98  * timings as specified in the xvidc_timings_table.c file. The naming format is:
99  *
100  * XVIDC_VM_<RESOLUTION>_<REFRESH RATE (HZ)>_<P|I>(_RB)
101  *
102  * Where RB stands for reduced blanking.
103  */
104 typedef enum {
105         /* Interlaced modes. */
106         XVIDC_VM_720x480_60_I = 0,
107         XVIDC_VM_720x576_50_I,
108         XVIDC_VM_1440x480_60_I,
109         XVIDC_VM_1440x576_50_I,
110         XVIDC_VM_1920x1080_48_I,
111         XVIDC_VM_1920x1080_50_I,
112         XVIDC_VM_1920x1080_60_I,
113         XVIDC_VM_1920x1080_96_I,
114         XVIDC_VM_1920x1080_100_I,
115         XVIDC_VM_1920x1080_120_I,
116         XVIDC_VM_2048x1080_48_I,
117         XVIDC_VM_2048x1080_50_I,
118         XVIDC_VM_2048x1080_60_I,
119         XVIDC_VM_2048x1080_96_I,
120         XVIDC_VM_2048x1080_100_I,
121         XVIDC_VM_2048x1080_120_I,
122
123
124         /* Progressive modes. */
125         XVIDC_VM_640x350_85_P,
126         XVIDC_VM_640x480_60_P,
127         XVIDC_VM_640x480_72_P,
128         XVIDC_VM_640x480_75_P,
129         XVIDC_VM_640x480_85_P,
130         XVIDC_VM_720x400_85_P,
131         XVIDC_VM_720x480_60_P,
132         XVIDC_VM_720x576_50_P,
133         XVIDC_VM_800x600_56_P,
134         XVIDC_VM_800x600_60_P,
135         XVIDC_VM_800x600_72_P,
136         XVIDC_VM_800x600_75_P,
137         XVIDC_VM_800x600_85_P,
138         XVIDC_VM_800x600_120_P_RB,
139         XVIDC_VM_848x480_60_P,
140         XVIDC_VM_1024x768_60_P,
141         XVIDC_VM_1024x768_70_P,
142         XVIDC_VM_1024x768_75_P,
143         XVIDC_VM_1024x768_85_P,
144         XVIDC_VM_1024x768_120_P_RB,
145         XVIDC_VM_1152x864_75_P,
146         XVIDC_VM_1280x720_24_P,
147         XVIDC_VM_1280x720_25_P,
148         XVIDC_VM_1280x720_30_P,
149         XVIDC_VM_1280x720_50_P,
150         XVIDC_VM_1280x720_60_P,
151         XVIDC_VM_1280x768_60_P,
152         XVIDC_VM_1280x768_60_P_RB,
153         XVIDC_VM_1280x768_75_P,
154         XVIDC_VM_1280x768_85_P,
155         XVIDC_VM_1280x768_120_P_RB,
156         XVIDC_VM_1280x800_60_P,
157         XVIDC_VM_1280x800_60_P_RB,
158         XVIDC_VM_1280x800_75_P,
159         XVIDC_VM_1280x800_85_P,
160         XVIDC_VM_1280x800_120_P_RB,
161         XVIDC_VM_1280x960_60_P,
162         XVIDC_VM_1280x960_85_P,
163         XVIDC_VM_1280x960_120_P_RB,
164         XVIDC_VM_1280x1024_60_P,
165         XVIDC_VM_1280x1024_75_P,
166         XVIDC_VM_1280x1024_85_P,
167         XVIDC_VM_1280x1024_120_P_RB,
168         XVIDC_VM_1360x768_60_P,
169         XVIDC_VM_1360x768_120_P_RB,
170         XVIDC_VM_1366x768_60_P,
171         XVIDC_VM_1366x768_60_P_RB,
172         XVIDC_VM_1400x1050_60_P,
173         XVIDC_VM_1400x1050_60_P_RB,
174         XVIDC_VM_1400x1050_75_P,
175         XVIDC_VM_1400x1050_85_P,
176         XVIDC_VM_1400x1050_120_P_RB,
177         XVIDC_VM_1440x240_60_P,
178         XVIDC_VM_1440x900_60_P,
179         XVIDC_VM_1440x900_60_P_RB,
180         XVIDC_VM_1440x900_75_P,
181         XVIDC_VM_1440x900_85_P,
182         XVIDC_VM_1440x900_120_P_RB,
183         XVIDC_VM_1600x1200_60_P,
184         XVIDC_VM_1600x1200_65_P,
185         XVIDC_VM_1600x1200_70_P,
186         XVIDC_VM_1600x1200_75_P,
187         XVIDC_VM_1600x1200_85_P,
188         XVIDC_VM_1600x1200_120_P_RB,
189         XVIDC_VM_1680x720_50_P,
190         XVIDC_VM_1680x720_60_P,
191         XVIDC_VM_1680x720_100_P,
192         XVIDC_VM_1680x720_120_P,
193         XVIDC_VM_1680x1050_50_P,
194         XVIDC_VM_1680x1050_60_P,
195         XVIDC_VM_1680x1050_60_P_RB,
196         XVIDC_VM_1680x1050_75_P,
197         XVIDC_VM_1680x1050_85_P,
198         XVIDC_VM_1680x1050_120_P_RB,
199         XVIDC_VM_1792x1344_60_P,
200         XVIDC_VM_1792x1344_75_P,
201         XVIDC_VM_1792x1344_120_P_RB,
202         XVIDC_VM_1856x1392_60_P,
203         XVIDC_VM_1856x1392_75_P,
204         XVIDC_VM_1856x1392_120_P_RB,
205         XVIDC_VM_1920x1080_24_P,
206         XVIDC_VM_1920x1080_25_P,
207         XVIDC_VM_1920x1080_30_P,
208         XVIDC_VM_1920x1080_48_P,
209         XVIDC_VM_1920x1080_50_P,
210         XVIDC_VM_1920x1080_60_P,
211         XVIDC_VM_1920x1080_100_P,
212         XVIDC_VM_1920x1080_120_P,
213         XVIDC_VM_1920x1200_60_P,
214         XVIDC_VM_1920x1200_60_P_RB,
215         XVIDC_VM_1920x1200_75_P,
216         XVIDC_VM_1920x1200_85_P,
217         XVIDC_VM_1920x1200_120_P_RB,
218         XVIDC_VM_1920x1440_60_P,
219         XVIDC_VM_1920x1440_75_P,
220         XVIDC_VM_1920x1440_120_P_RB,
221         XVIDC_VM_1920x2160_60_P,
222         XVIDC_VM_2048x1080_24_P,
223         XVIDC_VM_2048x1080_25_P,
224         XVIDC_VM_2048x1080_30_P,
225         XVIDC_VM_2048x1080_48_P,
226         XVIDC_VM_2048x1080_50_P,
227         XVIDC_VM_2048x1080_60_P,
228         XVIDC_VM_2048x1080_100_P,
229         XVIDC_VM_2048x1080_120_P,
230         XVIDC_VM_2560x1080_50_P,
231         XVIDC_VM_2560x1080_60_P,
232         XVIDC_VM_2560x1080_100_P,
233         XVIDC_VM_2560x1080_120_P,
234         XVIDC_VM_2560x1600_60_P,
235         XVIDC_VM_2560x1600_60_P_RB,
236         XVIDC_VM_2560x1600_75_P,
237         XVIDC_VM_2560x1600_85_P,
238         XVIDC_VM_2560x1600_120_P_RB,
239         XVIDC_VM_3840x2160_24_P,
240         XVIDC_VM_3840x2160_25_P,
241         XVIDC_VM_3840x2160_30_P,
242         XVIDC_VM_3840x2160_48_P,
243         XVIDC_VM_3840x2160_50_P,
244         XVIDC_VM_3840x2160_60_P,
245         XVIDC_VM_3840x2160_60_P_RB,
246         XVIDC_VM_4096x2160_24_P,
247         XVIDC_VM_4096x2160_25_P,
248         XVIDC_VM_4096x2160_30_P,
249         XVIDC_VM_4096x2160_48_P,
250         XVIDC_VM_4096x2160_50_P,
251         XVIDC_VM_4096x2160_60_P,
252         XVIDC_VM_4096x2160_60_P_RB,
253
254         XVIDC_VM_NUM_SUPPORTED,
255         XVIDC_VM_USE_EDID_PREFERRED,
256         XVIDC_VM_NO_INPUT,
257         XVIDC_VM_NOT_SUPPORTED,
258         XVIDC_VM_CUSTOM,
259
260         /* Marks beginning/end of interlaced/progressive modes in the table. */
261         XVIDC_VM_INTL_START = XVIDC_VM_720x480_60_I,
262         XVIDC_VM_PROG_START = XVIDC_VM_640x350_85_P,
263         XVIDC_VM_INTL_END = (XVIDC_VM_PROG_START - 1),
264         XVIDC_VM_PROG_END = (XVIDC_VM_NUM_SUPPORTED - 1),
265
266         /* Common naming. */
267         XVIDC_VM_480_60_I = XVIDC_VM_720x480_60_I,
268         XVIDC_VM_576_50_I = XVIDC_VM_720x576_50_I,
269         XVIDC_VM_1080_50_I = XVIDC_VM_1920x1080_50_I,
270         XVIDC_VM_1080_60_I = XVIDC_VM_1920x1080_60_I,
271         XVIDC_VM_VGA_60_P = XVIDC_VM_640x480_60_P,
272         XVIDC_VM_480_60_P = XVIDC_VM_720x480_60_P,
273         XVIDC_VM_SVGA_60_P = XVIDC_VM_800x600_60_P,
274         XVIDC_VM_XGA_60_P = XVIDC_VM_1024x768_60_P,
275         XVIDC_VM_720_50_P = XVIDC_VM_1280x720_50_P,
276         XVIDC_VM_720_60_P = XVIDC_VM_1280x720_60_P,
277         XVIDC_VM_WXGA_60_P = XVIDC_VM_1366x768_60_P,
278         XVIDC_VM_UXGA_60_P = XVIDC_VM_1600x1200_60_P,
279         XVIDC_VM_WSXGA_60_P = XVIDC_VM_1680x1050_60_P,
280         XVIDC_VM_1080_24_P = XVIDC_VM_1920x1080_24_P,
281         XVIDC_VM_1080_25_P = XVIDC_VM_1920x1080_25_P,
282         XVIDC_VM_1080_30_P = XVIDC_VM_1920x1080_30_P,
283         XVIDC_VM_1080_50_P = XVIDC_VM_1920x1080_50_P,
284         XVIDC_VM_1080_60_P = XVIDC_VM_1920x1080_60_P,
285         XVIDC_VM_WUXGA_60_P = XVIDC_VM_1920x1200_60_P,
286         XVIDC_VM_UHD2_60_P = XVIDC_VM_1920x2160_60_P,
287         XVIDC_VM_UHD_24_P = XVIDC_VM_3840x2160_24_P,
288         XVIDC_VM_UHD_25_P = XVIDC_VM_3840x2160_25_P,
289         XVIDC_VM_UHD_30_P = XVIDC_VM_3840x2160_30_P,
290         XVIDC_VM_UHD_60_P = XVIDC_VM_3840x2160_60_P,
291         XVIDC_VM_4K2K_60_P = XVIDC_VM_4096x2160_60_P,
292         XVIDC_VM_4K2K_60_P_RB = XVIDC_VM_4096x2160_60_P_RB,
293 } XVidC_VideoMode;
294
295 /**
296  * Progressive/interlaced video format.
297  */
298 typedef enum {
299         XVIDC_VF_PROGRESSIVE = 0,
300         XVIDC_VF_INTERLACED,
301         XVIDC_VF_UNKNOWN
302 } XVidC_VideoFormat;
303
304 /**
305  * Frame rate.
306  */
307 typedef enum {
308         XVIDC_FR_24HZ = 24,
309         XVIDC_FR_25HZ = 25,
310         XVIDC_FR_30HZ = 30,
311         XVIDC_FR_48HZ = 48,
312         XVIDC_FR_50HZ = 50,
313         XVIDC_FR_56HZ = 56,
314         XVIDC_FR_60HZ = 60,
315         XVIDC_FR_65HZ = 65,
316         XVIDC_FR_67HZ = 67,
317         XVIDC_FR_70HZ = 70,
318         XVIDC_FR_72HZ = 72,
319         XVIDC_FR_75HZ = 75,
320         XVIDC_FR_85HZ = 85,
321         XVIDC_FR_87HZ = 87,
322         XVIDC_FR_88HZ = 88,
323         XVIDC_FR_96HZ = 96,
324         XVIDC_FR_100HZ = 100,
325         XVIDC_FR_120HZ = 120,
326         XVIDC_FR_NUM_SUPPORTED = 18,
327         XVIDC_FR_UNKNOWN
328 } XVidC_FrameRate;
329
330 /**
331  * Color depth - bits per color component.
332  */
333 typedef enum {
334         XVIDC_BPC_6 = 6,
335         XVIDC_BPC_8 = 8,
336         XVIDC_BPC_10 = 10,
337         XVIDC_BPC_12 = 12,
338         XVIDC_BPC_14 = 14,
339         XVIDC_BPC_16 = 16,
340         XVIDC_BPC_NUM_SUPPORTED = 6,
341         XVIDC_BPC_UNKNOWN
342 } XVidC_ColorDepth;
343
344 /**
345  * Pixels per clock.
346  */
347 typedef enum {
348         XVIDC_PPC_1 = 1,
349         XVIDC_PPC_2 = 2,
350         XVIDC_PPC_4 = 4,
351         XVIDC_PPC_8 = 8,
352         XVIDC_PPC_NUM_SUPPORTED = 4,
353 } XVidC_PixelsPerClock;
354
355 /**
356  * Color space format.
357  */
358 typedef enum {
359         /* Streaming video formats */
360         XVIDC_CSF_RGB = 0,
361         XVIDC_CSF_YCRCB_444,
362         XVIDC_CSF_YCRCB_422,
363         XVIDC_CSF_YCRCB_420,
364         XVIDC_CSF_YONLY,
365         XVIDC_CSF_RGBA,
366         XVIDC_CSF_YCRCBA_444,
367
368         /* 6 empty slots reserved for video formats for future
369          * extension
370          */
371
372         /* Video in memory formats */
373         XVIDC_CSF_MEM_RGBX8 = 10,   // [31:0] x:B:G:R 8:8:8:8
374         XVIDC_CSF_MEM_YUVX8,        // [31:0] x:V:U:Y 8:8:8:8
375         XVIDC_CSF_MEM_YUYV8,        // [31:0] V:Y:U:Y 8:8:8:8
376         XVIDC_CSF_MEM_RGBA8,        // [31:0] A:B:G:R 8:8:8:8
377         XVIDC_CSF_MEM_YUVA8,        // [31:0] A:V:U:Y 8:8:8:8
378         XVIDC_CSF_MEM_RGBX10,       // [31:0] x:B:G:R 2:10:10:10
379         XVIDC_CSF_MEM_YUVX10,       // [31:0] x:V:U:Y 2:10:10:10
380         XVIDC_CSF_MEM_RGB565,       // [15:0] B:G:R 5:6:5
381         XVIDC_CSF_MEM_Y_UV8,        // [15:0] Y:Y 8:8, [15:0] V:U 8:8
382         XVIDC_CSF_MEM_Y_UV8_420,    // [15:0] Y:Y 8:8, [15:0] V:U 8:8
383         XVIDC_CSF_MEM_RGB8,         // [23:0] B:G:R 8:8:8
384         XVIDC_CSF_MEM_YUV8,         // [24:0] V:U:Y 8:8:8
385         XVIDC_CSF_MEM_Y_UV10,       // [31:0] x:Y:Y:Y 2:10:10:10 [31:0] x:U:V:U 2:10:10:10
386         XVIDC_CSF_MEM_Y_UV10_420,   // [31:0] x:Y:Y:Y 2:10:10:10 [31:0] x:U:V:U 2:10:10:10
387         XVIDC_CSF_MEM_Y8,           // [31:0] Y:Y:Y:Y 8:8:8:8
388         XVIDC_CSF_MEM_Y10,          // [31:0] x:Y:Y:Y 2:10:10:10
389         XVIDC_CSF_MEM_BGRA8,        // [31:0] A:R:G:B 8:8:8:8
390         XVIDC_CSF_MEM_BGRX8,        // [31:0] X:R:G:B 8:8:8:8
391         XVIDC_CSF_MEM_UYVY8,        // [31:0] Y:V:Y:U 8:8:8:8
392         XVIDC_CSF_MEM_BGR8,         // [23:0] R:G:B 8:8:8
393         XVIDC_CSF_MEM_END,          // End of memory formats
394
395         /* Streaming formats with components re-ordered */
396         XVIDC_CSF_YCBCR_422 = 64,
397         XVIDC_CSF_YCBCR_420,
398
399
400         XVIDC_CSF_NUM_SUPPORTED,    // includes the reserved slots
401         XVIDC_CSF_UNKNOWN,
402         XVIDC_CSF_STRM_START = XVIDC_CSF_RGB,
403         XVIDC_CSF_STRM_END   = XVIDC_CSF_YONLY,
404         XVIDC_CSF_MEM_START  = XVIDC_CSF_MEM_RGBX8,
405         XVIDC_CSF_NUM_STRM   = (XVIDC_CSF_STRM_END - XVIDC_CSF_STRM_START + 1),
406         XVIDC_CSF_NUM_MEM    = (XVIDC_CSF_MEM_END - XVIDC_CSF_MEM_START)
407 } XVidC_ColorFormat;
408
409
410 /**
411  * Image Aspect Ratio.
412  */
413 typedef enum {
414         XVIDC_AR_4_3 = 0,
415         XVIDC_AR_16_9 = 1
416 } XVidC_AspectRatio;
417
418 /**
419  * Color space conversion standard.
420  */
421 typedef enum {
422         XVIDC_BT_2020 = 0,
423         XVIDC_BT_709,
424         XVIDC_BT_601,
425         XVIDC_BT_NUM_SUPPORTED,
426         XVIDC_BT_UNKNOWN
427 } XVidC_ColorStd;
428
429 /**
430  * Color conversion output range.
431  */
432 typedef enum {
433         XVIDC_CR_16_235 = 0,
434         XVIDC_CR_16_240,
435         XVIDC_CR_0_255,
436         XVIDC_CR_NUM_SUPPORTED,
437         XVIDC_CR_UNKNOWN_RANGE
438 } XVidC_ColorRange;
439
440 /**
441  * 3D formats.
442  */
443 typedef enum {
444         XVIDC_3D_FRAME_PACKING = 0,     /**< Frame packing.         */
445         XVIDC_3D_FIELD_ALTERNATIVE,     /**< Field alternative.     */
446         XVIDC_3D_LINE_ALTERNATIVE,      /**< Line alternative.      */
447         XVIDC_3D_SIDE_BY_SIDE_FULL,     /**< Side-by-side (full).   */
448         XVIDC_3D_TOP_AND_BOTTOM_HALF,   /**< Top-and-bottom (half). */
449         XVIDC_3D_SIDE_BY_SIDE_HALF,     /**< Side-by-side (half).   */
450         XVIDC_3D_UNKNOWN
451 } XVidC_3DFormat;
452
453 /**
454  * 3D Sub-sampling methods.
455  */
456 typedef enum {
457         XVIDC_3D_SAMPLING_HORIZONTAL = 0, /**< Horizontal sub-sampling. */
458         XVIDC_3D_SAMPLING_QUINCUNX,       /**< Quincunx matrix.         */
459         XVIDC_3D_SAMPLING_UNKNOWN
460 } XVidC_3DSamplingMethod;
461
462 /**
463  * 3D Sub-sampling positions.
464  */
465 typedef enum {
466         XVIDC_3D_SAMPPOS_OLOR = 0,      /**< Odd/Left,  Odd/Right.  */
467         XVIDC_3D_SAMPPOS_OLER,          /**< Odd/Left,  Even/Right. */
468         XVIDC_3D_SAMPPOS_ELOR,          /**< Even/Left, Odd/Right.  */
469         XVIDC_3D_SAMPPOS_ELER,          /**< Even/Left, Even/Right. */
470         XVIDC_3D_SAMPPOS_UNKNOWN
471 } XVidC_3DSamplingPosition;
472
473 /****************************** Type Definitions ******************************/
474
475 /**
476  * Video timing structure.
477  */
478 typedef struct {
479         u16 HActive;
480         u16 HFrontPorch;
481         u16 HSyncWidth;
482         u16 HBackPorch;
483         u16 HTotal;
484         u8 HSyncPolarity;
485         u16 VActive;
486         u16 F0PVFrontPorch;
487         u16 F0PVSyncWidth;
488         u16 F0PVBackPorch;
489         u16 F0PVTotal;
490         u16 F1VFrontPorch;
491         u16 F1VSyncWidth;
492         u16 F1VBackPorch;
493         u16 F1VTotal;
494         u8 VSyncPolarity;
495 } XVidC_VideoTiming;
496
497 /**
498  * 3D Sampling info structure.
499  */
500 typedef struct {
501         XVidC_3DSamplingMethod   Method;
502         XVidC_3DSamplingPosition Position;
503 } XVidC_3DSamplingInfo;
504
505 /**
506  * 3D info structure.
507  */
508 typedef struct {
509         XVidC_3DFormat            Format;
510         XVidC_3DSamplingInfo  Sampling;
511 } XVidC_3DInfo;
512
513 /**
514  * Video stream structure.
515  */
516 typedef struct {
517         XVidC_ColorFormat         ColorFormatId;
518         XVidC_ColorDepth          ColorDepth;
519         XVidC_PixelsPerClock  PixPerClk;
520         XVidC_FrameRate           FrameRate;
521         XVidC_AspectRatio         AspectRatio;
522         u8                                IsInterlaced;
523         u8                                Is3D;
524         XVidC_3DInfo              Info_3D;
525         XVidC_VideoMode           VmId;
526         XVidC_VideoTiming         Timing;
527 } XVidC_VideoStream;
528
529 /**
530  * Video window structure.
531  */
532 typedef struct {
533         u32 StartX;
534         u32 StartY;
535         u32 Width;
536         u32 Height;
537 } XVidC_VideoWindow;
538
539 /**
540  * Video timing mode from the video timing table.
541  */
542 typedef struct {
543         XVidC_VideoMode         VmId;
544         const char                  Name[21];
545         XVidC_FrameRate         FrameRate;
546         XVidC_VideoTiming       Timing;
547 } XVidC_VideoTimingMode;
548
549 /**
550  * Callback type which represents a custom timer wait handler. This is only
551  * used for Microblaze since it doesn't have a native sleep function. To avoid
552  * dependency on a hardware timer, the default wait functionality is implemented
553  * using loop iterations; this isn't too accurate. Therefore a custom timer
554  * handler is used, the user may implement their own wait implementation.
555  *
556  * @param       TimerPtr is a pointer to the timer instance.
557  * @param       Delay is the duration (msec/usec) to be passed to the timer
558  *              function.
559  *
560 *******************************************************************************/
561 typedef void (*XVidC_DelayHandler)(void *TimerPtr, u32 Delay);
562
563 /**************************** Function Prototypes *****************************/
564
565 u32 XVidC_RegisterCustomTimingModes(const XVidC_VideoTimingMode *CustomTable,
566                                             u16 NumElems);
567 void XVidC_UnregisterCustomTimingModes(void);
568 u32 XVidC_GetPixelClockHzByHVFr(u32 HTotal, u32 VTotal, u8 FrameRate);
569 u32 XVidC_GetPixelClockHzByVmId(XVidC_VideoMode VmId);
570 XVidC_VideoFormat XVidC_GetVideoFormat(XVidC_VideoMode VmId);
571 u8 XVidC_IsInterlaced(XVidC_VideoMode VmId);
572 const XVidC_VideoTimingMode* XVidC_GetVideoModeData(XVidC_VideoMode VmId);
573 const char *XVidC_GetVideoModeStr(XVidC_VideoMode VmId);
574 const char *XVidC_GetFrameRateStr(XVidC_VideoMode VmId);
575 const char *XVidC_GetColorFormatStr(XVidC_ColorFormat ColorFormatId);
576 XVidC_FrameRate XVidC_GetFrameRate(XVidC_VideoMode VmId);
577 const XVidC_VideoTiming* XVidC_GetTimingInfo(XVidC_VideoMode VmId);
578 void XVidC_ReportStreamInfo(const XVidC_VideoStream *Stream);
579 void XVidC_ReportTiming(const XVidC_VideoTiming *Timing, u8 IsInterlaced);
580 const char *XVidC_Get3DFormatStr(XVidC_3DFormat Format);
581 u32 XVidC_SetVideoStream(XVidC_VideoStream *VidStrmPtr, XVidC_VideoMode VmId,
582                                      XVidC_ColorFormat ColorFormat, XVidC_ColorDepth Bpc,
583                                      XVidC_PixelsPerClock Ppc);
584 u32 XVidC_Set3DVideoStream(XVidC_VideoStream *VidStrmPtr, XVidC_VideoMode VmId,
585                                        XVidC_ColorFormat ColorFormat, XVidC_ColorDepth Bpc,
586                                        XVidC_PixelsPerClock Ppc, XVidC_3DInfo *Info3DPtr);
587 XVidC_VideoMode XVidC_GetVideoModeId(u32 Width, u32 Height, u32 FrameRate,
588                                              u8 IsInterlaced);
589 XVidC_VideoMode XVidC_GetVideoModeIdExtensive(XVidC_VideoTiming *Timing,
590                                                                                           u32 FrameRate,
591                                                                                           u8 IsInterlaced,
592                                                                                           u8 IsExtensive);
593 XVidC_VideoMode XVidC_GetVideoModeIdRb(u32 Width, u32 Height, u32 FrameRate,
594                                                u8 IsInterlaced, u8 RbN);
595 XVidC_VideoMode XVidC_GetVideoModeIdWBlanking(const XVidC_VideoTiming *Timing,
596                                                       u32 FrameRate, u8 IsInterlaced);
597
598 /******************* Macros (Inline Functions) Definitions ********************/
599
600 /*****************************************************************************/
601 /**
602  * This macro check if video stream is 3D or 2D.
603  *
604  * @param       VidStreamPtr is a pointer to the XVidC_VideoStream structure.
605  *
606  * @return      3D(1)/2D(0)
607  *
608  * @note        C-style signature:
609  *              u8 XDp_IsStream3D(XVidC_VideoStream *VidStreamPtr)
610  *
611  *****************************************************************************/
612 #define XVidC_IsStream3D(VidStreamPtr)       ((VidStreamPtr)->Is3D)
613
614 /*************************** Variable Declarations ****************************/
615
616 #ifdef __cplusplus
617 }
618 #endif
619
620 #endif /* XVIDC_H_ */
621 /** @} */