OSDN Git Service

update README a bit
authorRudolf Polzer <divverent@xonotic.org>
Sat, 16 Jul 2011 12:59:16 +0000 (14:59 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 16 Jul 2011 12:59:16 +0000 (14:59 +0200)
README.txt

index 0736b7c..0893ff0 100644 (file)
@@ -1,4 +1,90 @@
-nvironment variables:
+S2TC - Texture Compression using Color Cell Compression
+
+
+What is S2TC?
+
+S2TC is a texture compression scheme that encodes 4x4 blocks with a 2 color
+palette each. The storage format is chosen so that most current graphics cards
+can decode it without any special updates or shaders; however, the format is
+simpler and thus can allow for quicker online compression, or simpler decoding.
+
+S2TC textures are stored in a DDS (DirectDraw Surface) container. After the 128
+header bytes, alpha blocks and color blocks may follow. Blocks are encoded top
+to bottom, left to right.
+
+Notation:
+
+When nothing else is specified, pixels are ordered from top to bottom, then
+left to right. Bits are read from the least to the most significant bit. Larger
+than a byte values are stored little-endian.
+
+Subformats:
+
+DXT1:
+
+No alpha blocks are stored. Each color block starts with two 16-bit words c0,
+c1. The most significant 5 bits encode red, the least significant bits encode
+blue, the remaining 6 bits encode green. It must always be that c1 >= c0.
+
+The remaining 32 bits are a little endian longword, of which each two adjacent
+bits, encode one of the 16 pixels of the block. The two bits for a pixel can
+encode the following values:
+
+00 - color c0, alpha 255 (opaque)
+01 - color c1, alpha 255 (opaque)
+10 - reserved
+11 - no color, alpha 0 (transparent)
+
+DXT3:
+
+Before each color block, an alpha block is stored. The alpha block is a 64bit
+qword, of which each four adjacent bits encode one pixel value of alpha in
+standard 4bpp encoding.
+
+Each color block starts with two 16-bit words c0, c1. The most significant 5
+bits encode red, the least significant bits encode blue, the remaining 6 bits
+encode green. It must always be that c0 >= c1.
+
+The remaining 32 bits are a little endian dword, of which each two adjacent
+bits encode one of the 16 pixels of the block. The two bits for a pixel can
+encode the following values:
+
+00 - color c0
+01 - color c1
+10 - reserved
+11 - reserved
+
+DXT5:
+
+Before each color block, an alpha block is stored. The alpha block starts with
+two bytes for alpha values a0 and a1. It must always be that a1 >= a0. Then a
+48-bit integer is encoded, of which each three adjacent bits encode one of the
+16 alpha values of the block.
+
+000 - alpha a0
+001 - alpha a1
+010 - reserved
+011 - reserved
+100 - reserved
+101 - reserved
+110 - alpha 0 (transparent)
+111 - alpha 255 (opaque)
+
+Each color block starts with two 16-bit words c0, c1. The most significant 5
+bits encode red, the least significant bits encode blue, the remaining 6 bits
+encode green. It must always be that c0 >= c1.
+
+The remaining 32 bits are a little endian longword, of which each two adjacent
+bits encode one of the 16 pixels of the block. The two bits for a pixel can
+encode the following values:
+
+00 - color c0
+01 - color c1
+10 - reserved
+11 - reserved
+
+
+Environment variables:
 
 Color distance function: S2TC_COLORDIST_MODE (default: WAVG)
 RGB:           weighted YCbCr difference assuming linear input