OSDN Git Service

Avoid the case c0 == c1 when encoding
[android-x86/external-s2tc.git] / README.txt
1 S2TC Environment Variables
2 ==========================
3
4 Color Distance Function
5 -----------------------
6 The following color distance functions can be selected by setting the
7 environment variable `S2TC_COLORDIST_MODE`:
8
9 *   `RGB`: weighted YCbCr difference assuming linear input
10 *   `YUV`: weighted Y'Cb'Cr' difference assuming sRGB input
11 *   `SRGB`: weighted YCbCr difference assuming sRGB input
12 *   `SRGB_MIXED`: weighted "Y'(Y)Cb'Cr'" difference assuming sRGB input
13 *   `AVG`: standard average of component difference (generic)
14 *   `WAVG`: weighted RGB average of component difference
15 *   `NORMALMAP`: vector distance after normalization
16
17 The default is `WAVG`, which is a good compromise between speed and quality for
18 RGB and sRGB data. For optimum quality on sRGB input, try `SRGB_MIXED`.
19
20 The color distance function defines how "closeness" of pixel values is judged
21 when the pixel color values are evaluated, colors are selected, or during
22 refinement.
23
24 Color Selection
25 ---------------
26 The environment variable `S2TC_RANDOM_COLORS` can be set the following way:
27
28 *   `-1`: quick selection (darkest and brightest color are chosen, which is
29     similar to the method in the Color Cell Compression paper)
30 *   `0`: all 16 input colors of a block are considered
31 *   greater than `0`: additionally, that many random color values in the range
32     of the input color values are considered
33
34 The default is `-1`, which is fast but poor quality, however ideally suited for
35 online compression. For optimum quality, try `64`.
36
37 A bad color selection can later be compensated for by color refinement.
38
39 Color Refinement
40 ----------------
41 The environment variable `S2TC_REFINE_COLORS` can be set to the following values:
42
43 *   `NEVER`: never run color refinement
44 *   `ALWAYS`: unconditionally perform color refinement
45 *   `LOOP`: perform color refinement, evaluate its output and discard it if it
46     didn't improve quality, re-evaluate the pixel color values, and repeat
47     until no improvement could be made
48
49 The default is `ALWAYS`, which is fast and decent quality, and usually doesn't
50 make things worse. For optimum quality, try `LOOP`.
51
52 Color refinement recalculates the color palette of a block after the pixel
53 value decision by averaging the color values of those encoded as c0 or c1, and
54 is a technique that helps a lot of the initial color selection was poor (e.g.
55 if `S2TC_RANDOM_COLORS` was not set, or set to `-1`).