1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Need OCD?</title>
<style type="text/css">
.Header1 {
margin: 0px 0 0 0;
font-size: xx-large;
font-weight: bold;
text-align: left;
line-height: normal;
background-color: #E0E0E0;
}
.Header2 {
font-size: xx-large;
font-weight: bold;
margin: 0px;
line-height: 100%;
}
.Header3 {
font-size: x-large;
font-weight: bold;
text-align: left;
line-height: 100%;
margin: 0px;
}
.note {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
margin-left: 40px;
}
.description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
.download { float: right; }
.inline_code {
font-family: "Courier New", Courier, monospace;
font-size: small;
}
.cmd_line {
background: #000;
color: #fff;
padding: 10px;
font-family: "Courier New", Courier, monospace;
font-size: small;
}
.code_block {
margin-left: 40px;
font-family: "Courier New", Courier, monospace;
font-size: small;
}
.filename {
font-family: Arial, Helvetica, sans-serif;
font-size: small;
}
.Code_Header {
font-size: xx-large;
font-weight: bold;
text-align: left;
font-family: "Courier New", Courier, monospace;
}
.Code_Header_2 {
font-size: x-large;
font-weight: bold;
text-align: left;
font-family: "Courier New", Courier, monospace;
}
.Code_Header_3 {
font-size: large;
font-weight: bold;
text-align: left;
font-family: "Courier New", Courier, monospace;
}
.indent {
margin-left: 40px;
}
.ctr_thinbord {
text-align: center;
border: 1px solid #000000;
}
.style4 {
border-width: 0px;
margin-left: 40px;
}
.style5 {
margin-left: 80px;
font-family: "Courier New", Courier, monospace;
font-size: small;
}
</style>
</head>
<body>
<table style="width: 100%; line-height: 100%;">
<tr>
<td style="width: 484px">
<img alt="" src="ocdlogo.jpg"/></td>
<td>
<p>OCD is a set of Open Color format Definitions.</p>
<p>Color formats are used in everything from BLTers to video codecs, and from cameras to displays. But although
there are plenty of common formats, the definition of the code specifying them is never the same. </p>
<p>OCD attempts to solve this problem. It provides logical color format codes, and
is extensible.</p>
<hr />
<table style="width: 100%">
<tr>
<td>
<div class="download"><img alt="CC BY-ND" longdesc="Creative Commons Attribution-NoDerivs 3.0 Unported License" src="http://i.creativecommons.org/l/by-nd/3.0/88x31.png" width="88" height="31" /></div>
<p class="Header2">License</p>
</td>
</tr>
<tr>
<td>
<div>
<p class="style17">The definitions are designed and maintained by Texas Instruments, Inc., but anyone is free to use them with no
cost or obligation.</p>
<p>This project is licensed under the <a href="http://creativecommons.org/licenses/by-nd/3.0/">Creative Commons
Attribution-NoDerivs 3.0 Unported License</a>.</p>
</div>
</td>
</tr>
</table>
<hr />
<table style="width: 100%">
<tr>
<td>
<p class="Header2">Source</p>
</td>
</tr>
<tr>
<td>
<div class="download">
<a href="http://github.com/graphics/ocd/zipball/master">
<img width="90" alt="download zip" src="http://github.com/images/modules/download/zip.png" border="0"/></a>
<a href="http://github.com/graphics/ocd/tarball/master">
<img width="90" alt ="download tar" src="http://github.com/images/modules/download/tar.png" border="0"/></a>
</div>
<div>
Get the source code on GitHub at <a href="http://github.com/graphics/ocd">graphics/ocd</a>, or download this
project in either
<a href="http://github.com/graphics/ocd/zipball/master">zip</a> or
<a href="http://github.com/graphics/ocd/tarball/master">tar</a> formats.</div>
<p>You can also clone the project with <a href="http://git-scm.com">Git</a> by running:</p>
<pre><a class="cmd_line">$ git clone git://github.com/graphics/ocd</a></pre>
</td>
</tr>
<tr><td><hr />
<table style="width: 100%">
<tr>
<td class="Header2">Wiki</td>
</tr>
<tr>
<td><a href="https://github.com/graphics/ocd/wiki">https://github.com/graphics/ocd/wiki</a></td>
</tr>
</table>
</td></tr>
</table>
</td>
</tr>
</table>
<hr />
<p class="Header1">Header File</p>
<p><span class="filename">ocd.h</span> contains the Open Color format Definitions.</p>
<p class="Header1">How does it work?</p>
<p>OCD was designed to allow a single 32-bit word (int) to specify the
color format. The color format is specified as an enumeration. The
enumeration values are constructed using bitfields.</p>
<p>OCD breaks off a chunk of those 32 bits to specify a vendor ID. With
this, OCD can allow vendors with very unique formats to obtain their own vendor
ID and specify any of 16 million formats of their own. Minimum sharing
here, but maximum flexibility.</p>
<p class="Code_Header_2">OCDFMTDEF_VENDOR_ALL</p>
<p>The power of OCD lies in the shared vendor ID. The
<span class="inline_code">OCDFMTDEF_VENDOR_ALL</span> vendor ID indicates that the common set of definitions is
being used. And this set of definitions is designed to specify pretty much
any reasonably common color format in use today.</p>
<p>When <span class="inline_code">OCDFMTDEF_VENDOR_ALL</span> is chosen, the remaining 24 bits of the format are
sub-divided into bitfields used to describe the format.</p>
<p class="Header2">Predefined Names</p>
<p>A set of enumeration values are already provided with predefined names.
It is easiest for clients to use these predefined values. They already cover most of
the formats likely to be encountered.</p>
<p class="note">NOTE: The naming conventions of the predefined formats are based on their byte
ordering, so they are not endian-dependent. The exceptions are the 16-bit
packed formats, which are little-endian.</p>
<p>Some examples:</p>
<p class="indent"><span class="inline_code">OCDFMT_RGB24</span> is a format
where each pixel consists of 3 bytes (24 bits). The first byte in memory
(at address A, read as a byte) is the red component. The second byte in
memory (at address A+1, read as a byte) is the green component. The third
byte in memory (at address A+2, read as a byte) is the blue component.</p>
<p class="indent">OCDFMT_xRGB24 is a format where each pixel consists of 4 bytes
(32 bits), but only 3 of these (24 bits) contain color information. The
remaining 8 bits are ignored on a read, or filled with 0s on a write.</p>
<p>If the format of interest is not already specified, it is still likely that
the format is supported by the VENDOR_ALL design. Using the bitfields below, new combinations can be constructed. These
combinations are already legal, but they just have not been given names.
Users of OCD can define their own names in a separate header file and include it
using the OCD_EXTERNAL_INCLUDE mechanism:</p>
<p class="indent">file: <span class="filename">myocdfmts.h</span></p>
<p class="style5">MYOCDFMT_ALPHAMONO8 = OCDFMT_MONO8 |<br />
OCDFMTDEF_ALPHA,</p>
<p class="indent">file: <span class="filename">mysource.c</span></p>
<p class="style5">#define OCD_EXTERNAL_INCLUDE "myocdfmts.h"<br />
#include <ocd.h></p>
<p class="Header2">VENDOR_ALL Bitfields</p>
<p>The following bitfields only apply to the <span class="inline_code">
OCDFMTDEF_VENDOR_ALL</span> color formats. </p>
<p class="Header3">Color Space</p>
<p>The first field specifies the color space. Currently there are five
color spaces defined, but there is room for three more if the need arises:</p>
<ul>
<li>Monochrome - <span class="inline_code">OCDFMTDEF_CS_MONO</span></li>
<li>Look-Up Table - <span class="inline_code">OCDFMTDEF_CS_LUT</span></li>
<li>RGB -<span class="inline_code"> OCDFMTDEF_CS_RGB</span></li>
<li>YCbCr (a.k.a. YUV) - <span class="inline_code">
OCDFMTDEF_CS_YCbCr</span></li>
<li>Alpha - <span class="inline_code">OCDFMTDEF_CS_ALPHA</span></li>
</ul>
<p>Once the color space has been selected, the remaining bits depend on that
choice:</p>
<p class="Code_Header_3">OCDFMTDEF_CS_MONO</p>
<table class="style4">
<tr>
<td class="ctr_thinbord">31:24</td>
<td class="ctr_thinbord">23:21</td>
<td class="ctr_thinbord">20:19</td>
<td class="ctr_thinbord">18</td>
<td class="ctr_thinbord">17</td>
<td class="ctr_thinbord">16</td>
<td class="ctr_thinbord">15:14</td>
<td class="ctr_thinbord">13:11</td>
<td class="ctr_thinbord">10</td>
<td class="ctr_thinbord">9</td>
<td class="ctr_thinbord">8:6</td>
<td class="ctr_thinbord">5:0</td>
</tr>
<tr>
<td class="ctr_thinbord">00000000</td>
<td class="ctr_thinbord">000</td>
<td class="ctr_thinbord">reserved<br />
(00)</td>
<td class="ctr_thinbord">alpha</td>
<td class="ctr_thinbord">non-premult/<br />
fill empty 0</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reversed</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">container<br />
size</td>
<td class="ctr_thinbord">color<br />
bits-1</td>
</tr>
</table>
<p class="Code_Header_3">OCDFMTDEF_CS_LUT</p>
<table class="style4">
<tr>
<td class="ctr_thinbord">31:24</td>
<td class="ctr_thinbord">23:21</td>
<td class="ctr_thinbord">20:19</td>
<td class="ctr_thinbord">18</td>
<td class="ctr_thinbord">17</td>
<td class="ctr_thinbord">16</td>
<td class="ctr_thinbord">15:14</td>
<td class="ctr_thinbord">13:11</td>
<td class="ctr_thinbord">10</td>
<td class="ctr_thinbord">9</td>
<td class="ctr_thinbord">8:6</td>
<td class="ctr_thinbord">5:0</td>
</tr>
<tr>
<td class="ctr_thinbord">00000000</td>
<td class="ctr_thinbord">001</td>
<td class="ctr_thinbord">reserved<br />
(00)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reversed</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">container<br />
size</td>
<td class="ctr_thinbord">color<br />
bits-1</td>
</tr>
</table>
<p class="Code_Header_3">OCDFMTDEF_CS_RGB</p>
<table class="style4">
<tr>
<td class="ctr_thinbord">31:24</td>
<td class="ctr_thinbord">23:21</td>
<td class="ctr_thinbord">20:19</td>
<td class="ctr_thinbord">18</td>
<td class="ctr_thinbord">17</td>
<td class="ctr_thinbord">16</td>
<td class="ctr_thinbord">15:14</td>
<td class="ctr_thinbord">13:11</td>
<td class="ctr_thinbord">10</td>
<td class="ctr_thinbord">9</td>
<td class="ctr_thinbord">8:6</td>
<td class="ctr_thinbord">5:0</td>
</tr>
<tr>
<td class="ctr_thinbord">00000000</td>
<td class="ctr_thinbord">010</td>
<td class="ctr_thinbord">reserved<br />
(00)</td>
<td class="ctr_thinbord">alpha</td>
<td class="ctr_thinbord">non-premult/<br />
fill empty 0</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(00)</td>
<td class="ctr_thinbord">layout</td>
<td class="ctr_thinbord">reversed</td>
<td class="ctr_thinbord">left<br />
justified</td>
<td class="ctr_thinbord">container<br />
size</td>
<td class="ctr_thinbord">color<br />
bits-1</td>
</tr>
</table>
<p class="Code_Header_3">OCDFMTDEF_CS_YCbCr</p>
<table class="style4">
<tr>
<td class="ctr_thinbord">31:24</td>
<td class="ctr_thinbord">23:21</td>
<td class="ctr_thinbord">20:19</td>
<td class="ctr_thinbord">18</td>
<td class="ctr_thinbord">17</td>
<td class="ctr_thinbord">16</td>
<td class="ctr_thinbord">15:14</td>
<td class="ctr_thinbord">13:11</td>
<td class="ctr_thinbord">10</td>
<td class="ctr_thinbord">9</td>
<td class="ctr_thinbord">8:6</td>
<td class="ctr_thinbord">5:0</td>
</tr>
<tr>
<td class="ctr_thinbord">00000000</td>
<td class="ctr_thinbord">011</td>
<td class="ctr_thinbord">standard</td>
<td class="ctr_thinbord">alpha</td>
<td class="ctr_thinbord">non-premult/<br />
fill empty 0</td>
<td class="ctr_thinbord">subsample<br />
position</td>
<td class="ctr_thinbord">subsampling</td>
<td class="ctr_thinbord">layout</td>
<td class="ctr_thinbord">reversed</td>
<td class="ctr_thinbord">left<br />
justified</td>
<td class="ctr_thinbord">container<br />
size</td>
<td class="ctr_thinbord">color<br />
bits-1</td>
</tr>
</table>
<p class="Code_Header_3">OCDFMTDEF_CS_ALPHA</p>
<table class="style4">
<tr>
<td class="ctr_thinbord">31:24</td>
<td class="ctr_thinbord">23:21</td>
<td class="ctr_thinbord">20:19</td>
<td class="ctr_thinbord">18</td>
<td class="ctr_thinbord">17</td>
<td class="ctr_thinbord">16</td>
<td class="ctr_thinbord">15:14</td>
<td class="ctr_thinbord">13:11</td>
<td class="ctr_thinbord">10</td>
<td class="ctr_thinbord">9</td>
<td class="ctr_thinbord">8:6</td>
<td class="ctr_thinbord">5:0</td>
</tr>
<tr>
<td class="ctr_thinbord">00000000</td>
<td class="ctr_thinbord">100</td>
<td class="ctr_thinbord">reserved<br />
(00)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">reserved<br />
(00)</td>
<td class="ctr_thinbord">reserved<br />
(00)</td>
<td class="ctr_thinbord">reversed</td>
<td class="ctr_thinbord">reserved<br />
(0)</td>
<td class="ctr_thinbord">container<br />
size</td>
<td class="ctr_thinbord">alpha<br />
bits-1</td>
</tr>
</table>
<p> </p>
<p class="Header3">Standard (YCbCr)</p>
<p>This field specifies the standard being used for this color space.</p>
<p>Currently, this field is only defined for the YCbCr color space:</p>
<ul>
<li><a href="http://www.itu.int/rec/R-REC-BT.601/en">ITU-R BT.601</a> - <span class="inline_code">
OCDFMTDEF_STD_ITUR_601_YCbCr</span></li>
<li><a href="http://www.itu.int/rec/R-REC-BT.709/en">ITU-R BT.709</a> - <span class="inline_code">
OCDFMTDEF_STD_ITUR_709_YCbCr</span></li>
<li><a href="http://www.w3.org/Graphics/JPEG/jfif3.pdf">Full Scale</a> - <span class="inline_code">
OCDFMTDEF_FULLSCALE_YCbCr</span></li>
</ul>
<p>We believe that this field will be used to add linear format support in the
very near future.</p>
<p class="Header3">Fill Empty 0 (Mono, RGB, YCbCr)</p>
<p>When there is no alpha included with a format, but the color components don't
fill up the container, the remainder of the bits must be filled with something
when written. When the <span class="inline_code">OCDFMTDEF_FILL_EMPTY_0</span>
flag is not set, they are filled with 1. This is done in case they are
later used as an alpha value, which will already represent an opaque pixel
(whether the pixel is premultiplied or not). When the flag is set, they are
filled with 0, to accommodate those environments where they are required to be
cleared when unused.</p>
<p class="Header3">Alpha (Mono, RGB, YCbCr)</p>
<p>The <span class="inline_code">OCDFMTDEF_ALPHA</span> bit indicates that the
format includes an alpha channel along with the main color components.</p>
<p class="Header3">Non-Premult (Mono, RGB, YCbCr)</p>
<p>Formats with alpha can have their color components pre-multiplied by the
alpha component or not. When the <span class="inline_code">
OCDFMTDEF_NON_PREMULT</span> bit is set, the color components are not
premultiplied by the accompanying alpha. When the bit is not set, the
color components are already multiplied by the alpha.</p>
<p class="Header3">Subsampling (YCbCr)</p>
<p>Some formats can be subsampled. At this point, only subsampled YCbCr is
supported.</p>
<ul>
<li>No subsampling - <span class="inline_code">
OCDFMTDEF_SUBSAMPLE_NONE</span></li>
<li>4:2:2 subsampling - <span class="inline_code">
OCDFMTDEF_SUBSAMPLE_422_YCbCr</span></li>
<li>4:2:0 subsampling - <span class="inline_code">
OCDFMTDEF_SUBSAMPLE_420_YCbCr</span></li>
<li>4:1:1 subsampling - <span class="inline_code">
OCDFMTDEF_SUBSAMPLE_411_YCbCr</span></li>
</ul>
<p class="Header3">Subsample Position (YCbCr)</p>
<p>Subsampling can have different equivalent positions relative to the pixels.
Vertical subsampling positions are consistent, so the following are supported to
control the horizontal subsampling position:</p>
<ul>
<li><span class="inline_code">OCDFMTDEF_SUBSAMPLE_HORZ_ALIGNED </span>- subsamples are aligned with first pixel (e.g. MPEG-2
spec)</li>
<li><span class="inline_code">OCDFMTDEF_SUBSAMPLE_HORZ_CENTERED
</span>- subsamples are centered between the pixels (e.g. MPEG-1
spec)</li>
</ul>
<p>NOTE: It is encouraged that users of OCD be generous when handling
subsampling positions. Allowing misaligned subsampling is preferable to
complete failure.</p>
<p class="Header3">Alpha Components (Alpha)</p>
<p>To support applying alpha values to the individual components of other color
spaces, the alpha color space can have more than one alpha value per pixel.
This field specifies how many:</p>
<ul>
<li><span class="inline_code">OCDFMTDEF_ALPHA_COMPONENTS_1 </span>- pixel contains 1 alpha value (default)</li>
<li><span class="inline_code">OCDFMTDEF_ALPHA_COMPONENTS_2
</span>- pixel contains 2 alpha values</li>
<li><span class="inline_code">OCDFMTDEF_ALPHA_COMPONENTS_3
</span>- pixel contains 3 alpha values; suitable for RGB
manipulation (e.g. FreeType/ClearType)</li>
<li><span class="inline_code">OCDFMTDEF_ALPHA_COMPONENTS_4
</span>-- pixel contains 4 alpha values</li>
</ul>
<p class="Header3">Layout (RGB, YCbCr)</p>
<p>The layout values, in conjunction with the reversed and left-justified
modifiers, specify how the pixel components are placed into memory. All
non-RGB/YCbCr formats are packed.</p>
<ul>
<li><span class="inline_code">OCDFMTDEF_PACKED </span>- pixel
components are sequential in memory, defaulting to RGB or CbCr
order, right justified</li>
<li><span class="inline_code">OCDFMTDEF_DISTRIBUTED </span>-
pixel components that don't fill the container are evenly
distributed within the container (e.g. 32 bits of ARGB in a
64-bit container is distributed 8 bits every 16 bits: xAxRxGxB)</li>
<li><span class="inline_code">OCDFMTDEF_2_PLANE_YCbCr </span>-
for subsampled formats only, Y plane is followed by subsampled
interleaved CbCr plane</li>
<li><span class="inline_code">OCDFMTDEF_3_PLANE_STACKED </span>-
pixel components are divided into planes that are sequential in
memory</li>
<li><span class="inline_code">
OCDFMTDEF_3_PLANE_SIDE_BY_SIDE_YCbCr </span>- for subsampled
formats only pixel components are divided into planes, with the
non-subsampled component followed by the subsampled components
stored side-by-side (lines interleaved) </li>
</ul>
<p class="Header3">Reversed (RGB, YCbCr)</p>
<p><span class="inline_code">OCDFMTDEF_REVERSED</span> indicates that the order
of the color components is the opposite of the defaults. For RGB formats,
this means BGR. For YCbCr formats, this means CrCb.</p>
<p class="Header3">Left-Justified (RGB, YCbCr)</p>
<p><span class="inline_code">OCDFMTDEF_LEFT_JUSTIFIED</span> indicates that the
color components are shifted to the left, as opposed to the default of shifting
to the right.</p>
<p>Some examples for <span class="inline_code">OCDFMTDEF_REVERSED</span> and
<span class="inline_code">OCDFMTDEF_LEFT_JUSTIFIED</span>:</p>
<ul>
<li>Packed RGB: x,R,G,B is the default byte order<ul>
<li>x,B,G,R is the format if
<span class="inline_code">OCDFMTDEF_REVERSED</span>
is set</li>
<li>R,G,B,x is the format if
<span class="inline_code">
OCDFMTDEF_LEFT_JUSTIFIED</span> is set</li>
<li>B,G,R,x is the format if
<span class="inline_code">OCDFMTDEF_REVERSED</span>
and <span class="inline_code">
OCDFMTDEF_LEFT_JUSTIFIED</span> are set</li>
</ul>
</li>
<li>Packed YCbCr 4:2:2: U,Y,V,Y is the default byte order<ul>
<li>V,Y,U,Y is the format if
<span class="inline_code">OCDFMTDEF_REVERSED</span>
is set</li>
<li>Y,U,Y,V is the format if
<span class="inline_code">
OCDFMTDEF_LEFT_JUSTIFIED</span> is set</li>
<li>Y,V,Y,U is the format if
<span class="inline_code">OCDFMTDEF_REVERSED</span>
and <span class="inline_code">
OCDFMTDEF_LEFT_JUSTIFIED</span> are set</li>
</ul>
</li>
<li>3-Plane YCbCr 4:2:2 or 4:2:0: The default is the Y
plane, followed by the Cb plane and then the Cr plane. The
Cb and Cr planes have half of the stride of the Y plane.<ul>
<li>If <span class="inline_code">
OCDFMTDEF_REVERSED</span> is set, the Cb and Cr
planes are reversed.</li>
<li><span class="inline_code">
OCDFMTDEF_LEFT_JUSTIFIED</span> has a special
case for this layout. When set, it
indicates that the Cb and Cr planes have the
same stride as the Y plane, and the Cb and Cr
data is shifted to the left.</li>
<li>If both <span class="inline_code">
OCDFMTDEF_LEFT_REVERSED</span> and
<span class="inline_code">
OCDFMTDEF_LEFT_JUSTIFIED</span> are set, the Cb
and Cr planes are reversed and double width.</li>
</ul>
</li>
<li>2-Plane YCbCr 4:2:2 or 4:2:0: The default is the Y
plane, followed by the CbCr interleaved plane, with the same
stride as the Y plane.<ul>
<li><span class="inline_code">OCDFMTDEF_REVERSED</span>
swaps the Cb and Cr components.</li>
</ul>
</li>
</ul>
<p class="Header3">Container (All)</p>
<p>The container field indicates the total size of all the bits of the color
components of a color format. This does not include the alpha component,
if it is present.</p>
<ul>
<li><span class="inline_code">OCDFMTDEF_CONTAINER_8BIT</span> -
Indicates the container is 8 bits. When the pixel
component size is 4 bits or less, multiple pixels are stored in
the container.</li>
<li><span class="inline_code">OCDFMTDEF_CONTAINER_16BIT</span> -
Indicates the container is 16 bits. When the pixel
component size is less than 16 bits, the remaining bits are
available to be used as an alpha channel.</li>
<li><span class="inline_code">OCDFMTDEF_CONTAINER_24BIT</span> -
Indicates the container is 24 bits. When the pixel
component size is less than 24 bits, the remaining bits are
available to be used as an alpha channel.</li>
<li><span class="inline_code">OCDFMTDEF_CONTAINER_32BIT</span> -
Indicates the container is 32 bits. When the pixel
component size is less than 32 bits, the remaining bits are
available to be used as an alpha channel.</li>
<li><span class="inline_code">OCDFMTDEF_CONTAINER_48BIT</span> -
Indicates the container is 48 bits. When the pixel
component size is less than 48 bits, the remaining bits are
available to be used as an alpha channel.</li>
<li><span class="inline_code">OCDFMTDEF_CONTAINER_64BIT</span> -
Indicates the container is 64 bits. When the pixel
component size is less than 64 bits, the remaining bits are
available to be used as an alpha channel.</li>
</ul>
<p class="Header3">Component Size (All)</p>
<p>The component size field specifies the total number of bits in the color
components, not including the alpha component. (It is specified in the
code with one subtracted.)</p>
<p class="note">NOTE: The alpha only color space uses this to specify the total number
of alpha bits.</p>
</body>
</html>
|