Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: docs/formats.md

Issue 1703653002: Add all wiki pages as MarkDown documents + README.md (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Updated after review and fixed links Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « docs/filtering.md ('k') | docs/getting_started.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Introduction
2
3 Formats (FOURCC) supported by libyuv are detailed here.
4
5 # Core Formats
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.
8
9 Filtering functions such as scaling and planar functions work on I420 and/or ARG B.
10
11 # OSX Core Media Pixel Formats
12
13 This is how OSX formats map to libyuv
14
15 enum {
16 kCMPixelFormat_32ARGB = 32, FOURCC_BGRA
17 kCMPixelFormat_32BGRA = 'BGRA', FOURCC_ARGB
18 kCMPixelFormat_24RGB = 24, FOURCC_RAW
19 kCMPixelFormat_16BE555 = 16, Not supported.
20 kCMPixelFormat_16BE565 = 'B565', Not supported.
21 kCMPixelFormat_16LE555 = 'L555', FOURCC_RGBO
22 kCMPixelFormat_16LE565 = 'L565', FOURCC_RGBP
23 kCMPixelFormat_16LE5551 = '5551', FOURCC_RGBO
24 kCMPixelFormat_422YpCbCr8 = '2vuy', FOURCC_UYVY
25 kCMPixelFormat_422YpCbCr8_yuvs = 'yuvs', FOURCC_YUY2
26 kCMPixelFormat_444YpCbCr8 = 'v308', FOURCC_I444 ?
27 kCMPixelFormat_4444YpCbCrA8 = 'v408', Not supported.
28 kCMPixelFormat_422YpCbCr16 = 'v216', Not supported.
29 kCMPixelFormat_422YpCbCr10 = 'v210', FOURCC_V210 previously. Removed now.
30 kCMPixelFormat_444YpCbCr10 = 'v410', Not supported.
31 kCMPixelFormat_8IndexedGray_WhiteIsZero = 0x00000028, Not supported.
32 };
33
34
35 # FOURCC (Four Charactacter Code) List
36
37 The following is extracted from video_common.h as a complete list of formats sup ported by libyuv.
38
39 enum FourCC {
40 // 9 Primary YUV formats: 5 planar, 2 biplanar, 2 packed.
41 FOURCC_I420 = FOURCC('I', '4', '2', '0'),
42 FOURCC_I422 = FOURCC('I', '4', '2', '2'),
43 FOURCC_I444 = FOURCC('I', '4', '4', '4'),
44 FOURCC_I411 = FOURCC('I', '4', '1', '1'),
45 FOURCC_I400 = FOURCC('I', '4', '0', '0'),
46 FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
47 FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
48 FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
49 FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
50
51 // 2 Secondary YUV formats: row biplanar.
52 FOURCC_M420 = FOURCC('M', '4', '2', '0'),
53 FOURCC_Q420 = FOURCC('Q', '4', '2', '0'),
54
55 // 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp.
56 FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
57 FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'),
58 FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'),
59 FOURCC_24BG = FOURCC('2', '4', 'B', 'G'),
60 FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
61 FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'),
62 FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // rgb565 LE.
63 FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // argb1555 LE.
64 FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444 LE.
65
66 // 4 Secondary RGB formats: 4 Bayer Patterns.
67 FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'),
68 FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'),
69 FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'),
70 FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'),
71
72 // 1 Primary Compressed YUV format.
73 FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
74
75 // 5 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias.
76 FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
77 FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'),
78 FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'),
79 FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Linux version of I420.
80 FOURCC_J420 = FOURCC('J', '4', '2', '0'),
81 FOURCC_J400 = FOURCC('J', '4', '0', '0'),
82
83 // 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc .
84 FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420.
85 FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'), // Alias for I422.
86 FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'), // Alias for I444.
87 FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'), // Alias for YUY2.
88 FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'), // Alias for YUY2 on Mac.
89 FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'), // Alias for UYVY.
90 FOURCC_2VUY = FOURCC('2', 'v', 'u', 'y'), // Alias for UYVY on Mac.
91 FOURCC_JPEG = FOURCC('J', 'P', 'E', 'G'), // Alias for MJPG.
92 FOURCC_DMB1 = FOURCC('d', 'm', 'b', '1'), // Alias for MJPG on Mac.
93 FOURCC_BA81 = FOURCC('B', 'A', '8', '1'), // Alias for BGGR.
94 FOURCC_RGB3 = FOURCC('R', 'G', 'B', '3'), // Alias for RAW.
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
97 FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB
98 FOURCC_L555 = FOURCC('L', '5', '5', '5'), // Alias for RGBO.
99 FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP.
100 FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO.
101
102 // 1 Auxiliary compressed YUV format set aside for capturer.
103 FOURCC_H264 = FOURCC('H', '2', '6', '4'),
104
105 # The ARGB FOURCC
106
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.
108
109 The fourcc describes the order of channels in a ***register***.
110
111 A fourcc provided by capturer, can be thought of string, e.g. "ARGB".
112
113 On little endian machines, as an int, this would have 'A' in the lowest byte. T he FOURCC macro reverses the order:
114
115 #define FOURCC(a, b, c, d) (((uint32)(a)) | ((uint32)(b) << 8) | ((uint32)(c ) << 16) | ((uint32)(d) << 24))
116
117 So the "ARGB" string, read as an uint32, is
118
119 FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B')
120
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.
122
123 When calling conversion functions, the names match the FOURCC, so in this case i t would be I420ToARGB().
124
125 All formats can be converted to/from ARGB.
126
127 Most 'planar_functions' work on ARGB (e.g. ARGBBlend).
128
129 Some are channel order agnostic (e.g. ARGBScale).
130
131 Some functions are symmetric (e.g. ARGBToBGRA is the same as BGRAToARGB, so its a macro).
132
133 ARGBBlend expects preattenuated ARGB. The R,G,B are premultiplied by alpha. Oth er functions don't care.
OLDNEW
« no previous file with comments | « docs/filtering.md ('k') | docs/getting_started.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698