OLD | NEW |
1 # Introduction | 1 # Introduction |
2 | 2 |
3 Formats (FOURCC) supported by libyuv are detailed here. | 3 Formats (FOURCC) supported by libyuv are detailed here. |
4 | 4 |
5 # Core Formats | 5 # Core Formats |
6 | 6 |
7 There are 2 core formats supported by libyuv - I420 and ARGB. All YUV formats c
an be converted to/from I420. All RGB formats can be converted to/from ARGB. | 7 There are 2 core formats supported by libyuv - I420 and ARGB. All YUV formats c
an be converted to/from I420. All RGB formats can be converted to/from ARGB. |
8 | 8 |
9 Filtering functions such as scaling and planar functions work on I420 and/or ARG
B. | 9 Filtering functions such as scaling and planar functions work on I420 and/or ARG
B. |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'), // Alias for 24BG. | 95 FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'), // Alias for 24BG. |
96 FOURCC_CM32 = FOURCC(0, 0, 0, 32), // Alias for BGRA kCMPixelFormat_32ARG
B | 96 FOURCC_CM32 = FOURCC(0, 0, 0, 32), // Alias for BGRA kCMPixelFormat_32ARG
B |
97 FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB | 97 FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB |
98 FOURCC_L555 = FOURCC('L', '5', '5', '5'), // Alias for RGBO. | 98 FOURCC_L555 = FOURCC('L', '5', '5', '5'), // Alias for RGBO. |
99 FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP. | 99 FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP. |
100 FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO. | 100 FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO. |
101 | 101 |
102 // 1 Auxiliary compressed YUV format set aside for capturer. | 102 // 1 Auxiliary compressed YUV format set aside for capturer. |
103 FOURCC_H264 = FOURCC('H', '2', '6', '4'), | 103 FOURCC_H264 = FOURCC('H', '2', '6', '4'), |
104 | 104 |
| 105 # Planar YUV |
| 106 The following formats contains a full size Y plane followed by 1 or 2 |
| 107 planes for UV: I420, I422, I444, I411, I400, NV21, NV12, I400 |
| 108 The size (subsampling) of the UV varies. |
| 109 I420, NV12 and NV21 are half width, half height |
| 110 I422, NV16 and NV61 are half width, full height |
| 111 I444, NV24 and NV42 are full width, full height |
| 112 I400 and J400 have no chroma channel. |
| 113 |
105 # The ARGB FOURCC | 114 # The ARGB FOURCC |
106 | 115 |
107 There are 4 ARGB layouts - ARGB, BGRA, ABGR and RGBA. ARGB is most common by fa
r, used for screen formats, and windows webcam drivers. | 116 There are 4 ARGB layouts - ARGB, BGRA, ABGR and RGBA. ARGB is most common by fa
r, used for screen formats, and windows webcam drivers. |
108 | 117 |
109 The fourcc describes the order of channels in a ***register***. | 118 The fourcc describes the order of channels in a ***register***. |
110 | 119 |
111 A fourcc provided by capturer, can be thought of string, e.g. "ARGB". | 120 A fourcc provided by capturer, can be thought of string, e.g. "ARGB". |
112 | 121 |
113 On little endian machines, as an int, this would have 'A' in the lowest byte. T
he FOURCC macro reverses the order: | 122 On little endian machines, as an int, this would have 'A' in the lowest byte. T
he FOURCC macro reverses the order: |
114 | 123 |
115 #define FOURCC(a, b, c, d) (((uint32)(a)) | ((uint32)(b) << 8) | ((uint32)(c
) << 16) | ((uint32)(d) << 24)) | 124 #define FOURCC(a, b, c, d) (((uint32)(a)) | ((uint32)(b) << 8) | ((uint32)(c
) << 16) | ((uint32)(d) << 24)) |
116 | 125 |
117 So the "ARGB" string, read as an uint32, is | 126 So the "ARGB" string, read as an uint32, is |
118 | 127 |
119 FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B') | 128 FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B') |
120 | 129 |
121 If you were to read ARGB pixels as uint32's, the alpha would be in the high byte
, and the blue in the lowest byte. In memory, these are stored little endian, s
o 'B' is first, then 'G', 'R' and 'A' last. | 130 If you were to read ARGB pixels as uint32's, the alpha would be in the high byte
, and the blue in the lowest byte. In memory, these are stored little endian, s
o 'B' is first, then 'G', 'R' and 'A' last. |
122 | 131 |
123 When calling conversion functions, the names match the FOURCC, so in this case i
t would be I420ToARGB(). | 132 When calling conversion functions, the names match the FOURCC, so in this case i
t would be I420ToARGB(). |
124 | 133 |
125 All formats can be converted to/from ARGB. | 134 All formats can be converted to/from ARGB. |
126 | 135 |
127 Most 'planar_functions' work on ARGB (e.g. ARGBBlend). | 136 Most 'planar_functions' work on ARGB (e.g. ARGBBlend). |
128 | 137 |
129 Some are channel order agnostic (e.g. ARGBScale). | 138 Some are channel order agnostic (e.g. ARGBScale). |
130 | 139 |
131 Some functions are symmetric (e.g. ARGBToBGRA is the same as BGRAToARGB, so its
a macro). | 140 Some functions are symmetric (e.g. ARGBToBGRA is the same as BGRAToARGB, so its
a macro). |
132 | 141 |
133 ARGBBlend expects preattenuated ARGB. The R,G,B are premultiplied by alpha. Oth
er functions don't care. | 142 ARGBBlend expects preattenuated ARGB. The R,G,B are premultiplied by alpha. Oth
er functions don't care. |
OLD | NEW |