Mercurial > mplayer.hg
comparison DOCS/tech/colorspaces.txt @ 17680:786628f8db88
Add a practical description of endian-independent RGB/BGR coding
author | pacman |
---|---|
date | Fri, 24 Feb 2006 22:18:45 +0000 |
parents | 178020a16dae |
children | f01023c524c3 |
comparison
equal
deleted
inserted
replaced
17679:35c8d3361404 | 17680:786628f8db88 |
---|---|
133 1R2G1B1R2G1B IMGFMT_BGR4 | 133 1R2G1B1R2G1B IMGFMT_BGR4 |
134 1B2G1R1B2G1R IMGFMT_RGB4 | 134 1B2G1R1B2G1R IMGFMT_RGB4 |
135 | 135 |
136 Depending upon the CPU being little- or big-endian, different 'in memory' and | 136 Depending upon the CPU being little- or big-endian, different 'in memory' and |
137 'in register' formats will be equal (LE -> BGRA == BGR32 / BE -> ARGB == BGR32) | 137 'in register' formats will be equal (LE -> BGRA == BGR32 / BE -> ARGB == BGR32) |
138 | |
139 Practical coding guide: | |
140 | |
141 The 4, 8, 15, and 16 bit formats are defined so that the portable way to | |
142 access them is to load the pixel into an integer and use bitmasks. | |
143 | |
144 The 24 bit formats are defined so that the portable way to access them is | |
145 to address the 3 components as separate bytes, as in ((uint8_t *)pixel)[0], | |
146 ((uint8_t *)pixel)[1], ((uint8_t *)pixel)[2]. | |
147 | |
148 When a 32-bit format is identified by the four characters A, R, G, and B in | |
149 some order, the portable way to access it is by addressing the 4 components | |
150 as separate bytes. | |
151 | |
152 When a 32-bit format is identified by the 3 characters R, G, and B in some | |
153 order followed by the number 32, the portable way to access it is to load | |
154 the pixel into an integer and use bitmasks. | |
155 | |
156 When the above portable access methods are not used, you will need to write | |
157 2 versions of your code, and use #ifdef WORDS_BIGENDIAN to choose the correct | |
158 one. |