]> git.sesse.net Git - vlc/blob - src/video_output/vout_pictures.h
e9144b38a95e03a26a896323a9800963ccb4aa98
[vlc] / src / video_output / vout_pictures.h
1 /*****************************************************************************
2  * vout_pictures.h : picture management definitions
3  *****************************************************************************
4  * Copyright (C) 2002-2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Fourcc definitions that we can handle internally
26  *****************************************************************************/
27
28 /* Packed RGB for 8bpp */
29 #define FOURCC_RGB2         VLC_FOURCC('R','G','B','2')
30
31 /* Packed RGB 15bpp, usually 0x7c00, 0x03e0, 0x001f */
32 #define FOURCC_RV15         VLC_FOURCC('R','V','1','5')
33
34 /* Packed RGB 16bpp, usually 0xf800, 0x07e0, 0x001f */
35 #define FOURCC_RV16         VLC_FOURCC('R','V','1','6')
36
37 /* Packed RGB 24bpp, usually 0x00ff0000, 0x0000ff00, 0x000000ff */
38 #define FOURCC_RV24         VLC_FOURCC('R','V','2','4')
39
40 /* Packed RGB 32bpp, usually 0x00ff0000, 0x0000ff00, 0x000000ff */
41 #define FOURCC_RV32         VLC_FOURCC('R','V','3','2')
42
43 /* Packed RGBA 32bpp, like RV32 with 0xff000000 used for alpha */
44 #define FOURCC_RGBA         VLC_FOURCC('R','G','B','A')
45
46 /* Planar YUV 4:2:0, Y:U:V */
47 #define FOURCC_I420         VLC_FOURCC('I','4','2','0')
48 #define FOURCC_IYUV         VLC_FOURCC('I','Y','U','V')
49 #define FOURCC_J420         VLC_FOURCC('J','4','2','0')
50
51 /* Planar YUV 4:2:0, Y:V:U */
52 #define FOURCC_YV12         VLC_FOURCC('Y','V','1','2')
53
54 /* Packed YUV 4:2:2, U:Y:V:Y, interlaced */
55 #define FOURCC_IUYV         VLC_FOURCC('I','U','Y','V')
56
57 /* Packed YUV 4:2:2, U:Y:V:Y */
58 #define FOURCC_UYVY         VLC_FOURCC('U','Y','V','Y')
59 #define FOURCC_UYNV         VLC_FOURCC('U','Y','N','V')
60 #define FOURCC_Y422         VLC_FOURCC('Y','4','2','2')
61
62 /* Packed YUV 4:2:2, U:Y:V:Y, reverted */
63 #define FOURCC_cyuv         VLC_FOURCC('c','y','u','v')
64
65 /* Packed YUV 4:2:2, Y:U:Y:V */
66 #define FOURCC_YUY2         VLC_FOURCC('Y','U','Y','2')
67 #define FOURCC_YUNV         VLC_FOURCC('Y','U','N','V')
68
69 /* Packed YUV 4:2:2, Y:V:Y:U */
70 #define FOURCC_YVYU         VLC_FOURCC('Y','V','Y','U')
71
72 /* Packed YUV 2:1:1, Y:U:Y:V */
73 #define FOURCC_Y211         VLC_FOURCC('Y','2','1','1')
74
75 /* Planar YUV 4:1:1, Y:U:V */
76 #define FOURCC_I411         VLC_FOURCC('I','4','1','1')
77
78 /* Planar YUV 4:1:0, Y:U:V */
79 #define FOURCC_I410         VLC_FOURCC('I','4','1','0')
80 #define FOURCC_YVU9         VLC_FOURCC('Y','V','U','9')
81
82 /* Planar Y, packed UV, from Matrox */
83 #define FOURCC_YMGA         VLC_FOURCC('Y','M','G','A')
84
85 /* Planar 4:2:2, Y:U:V */
86 #define FOURCC_I422         VLC_FOURCC('I','4','2','2')
87 #define FOURCC_J422         VLC_FOURCC('J','4','2','2')
88
89 /* Planar 4:4:0, Y:U:V */
90 #define FOURCC_I440         VLC_FOURCC('I','4','4','0')
91 #define FOURCC_J440         VLC_FOURCC('J','4','4','0')
92
93 /* Planar 4:4:4, Y:U:V */
94 #define FOURCC_I444         VLC_FOURCC('I','4','4','4')
95 #define FOURCC_J444         VLC_FOURCC('J','4','4','4')
96
97 /* Planar 4:4:4:4 Y:U:V:A */
98 #define FOURCC_YUVA         VLC_FOURCC('Y','U','V','A')
99
100 /* Palettized YUV with palette element Y:U:V:A */
101 #define FOURCC_YUVP         VLC_FOURCC('Y','U','V','P')
102
103 /* Palettized RGB with palette element R:G:B */
104 #define FOURCC_RGBP         VLC_FOURCC('R','G','B','P')
105
106
107 /* Planar 8-bit grayscale */
108 #define FOURCC_GREY         VLC_FOURCC('G','R','E','Y')
109 #define FOURCC_Y800         VLC_FOURCC('Y','8','0','0')
110 #define FOURCC_Y8           VLC_FOURCC('Y','8',' ',' ')
111
112 /* Alignment of critical dynamic data structure
113  *
114  * Not all platforms support memalign so we provide a vlc_memalign wrapper
115  * void *vlc_memalign( size_t align, size_t size, void **pp_orig )
116  * *pp_orig is the pointer that has to be freed afterwards.
117  */
118 static inline
119 void *vlc_memalign (void **pp, size_t align, size_t size)
120 {
121 #if defined (HAVE_POSIX_MEMALIGN)
122     return posix_memalign (pp, align, size) ? NULL : *pp;
123 #elif defined (HAVE_MEMALIGN)
124     return *pp = memalign (align, size);
125 #else
126     unsigned char *ptr;
127
128     if (align < 1)
129         return NULL;
130
131     align--;
132     ptr = malloc (size + align);
133     if (ptr == NULL)
134         return NULL;
135
136     *pp = ptr;
137     ptr += align;
138     return (void *)(((uintptr_t)ptr) & ~align);
139 #endif
140 }
141