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),
31 BIT_ENCODE(0, 0, 0, 0, 0, 0, 2, 1, 1, 2, 3, 0, 0),
32 BIT_ENCODE(0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 2, 0, 0),
33 BIT_ENCODE(0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 2, 3, 0),
34 BIT_ENCODE(0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 3, 0),
35 BIT_ENCODE(0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0)
50 int w, h, s_pitch, d_pitch;
118 unsigned char *d, *dest;
119 int w, h, px, py, pixel, count;
121 const unsigned int *cursor;
129 for (py = 0; py < h; py++) {
132 for (px = 0; px < w;) {
134 for (count = 0; (px < w) && ((data & 0x3) == pixel); px++, data >>= 2)
163 int i, dist, min_wdist = 1000000, min_bdist = 1000000;
167 for (i = 0; i < 256; i++) {
169 if (dist < min_wdist) {
174 if (dist < min_bdist) {