[MPlayer-cvslog] CVS: main/DOCS/tech colorspaces.txt,1.14,1.15
Alan Curry CVS
syncmail at mplayerhq.hu
Fri Feb 24 23:18:47 CET 2006
CVS change done by Alan Curry CVS
Update of /cvsroot/mplayer/main/DOCS/tech
In directory mail:/var2/tmp/cvs-serv4788/DOCS/tech
Modified Files:
colorspaces.txt
Log Message:
Add a practical description of endian-independent RGB/BGR coding
Index: colorspaces.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/colorspaces.txt,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- colorspaces.txt 31 Mar 2005 22:45:03 -0000 1.14
+++ colorspaces.txt 24 Feb 2006 22:18:45 -0000 1.15
@@ -135,3 +135,24 @@
Depending upon the CPU being little- or big-endian, different 'in memory' and
'in register' formats will be equal (LE -> BGRA == BGR32 / BE -> ARGB == BGR32)
+
+Practical coding guide:
+
+The 4, 8, 15, and 16 bit formats are defined so that the portable way to
+access them is to load the pixel into an integer and use bitmasks.
+
+The 24 bit formats are defined so that the portable way to access them is
+to address the 3 components as separate bytes, as in ((uint8_t *)pixel)[0],
+((uint8_t *)pixel)[1], ((uint8_t *)pixel)[2].
+
+When a 32-bit format is identified by the four characters A, R, G, and B in
+some order, the portable way to access it is by addressing the 4 components
+as separate bytes.
+
+When a 32-bit format is identified by the 3 characters R, G, and B in some
+order followed by the number 32, the portable way to access it is to load
+the pixel into an integer and use bitmasks.
+
+When the above portable access methods are not used, you will need to write
+2 versions of your code, and use #ifdef WORDS_BIGENDIAN to choose the correct
+one.
More information about the MPlayer-cvslog
mailing list