initial import
[ICEs.git] / 195695 / xorg.i.5
1 typedef unsigned long long Fx64;
2 static void fxt1_quantize_ALPHA1(void)
3 {
4 unsigned int *cc;
5 const int n_vect = 3;
6 const int n_comp = 4;
7 float vec[1 + 1 + 1][4];
8 int i;
9 int j;
10 int k;
11 Fx64 hi;
12 int j1;
13 int j2;
14 int v1 = 0;
15 int v2 = 0;
16 float err = 1e9;
17 float tv[2 * 2][4];
18 for (j1 = 0; j1 < 2; j1++) {
19 for (j2 = 2; j2 < 4; j2++) {
20 float e = 0.0F;
21 for (i = 0; i < n_comp; i++) {
22 e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] -
23 tv[j2][i]);
24 }
25 if (e < err) {
26 v1 = j1;
27 }
28 }
29 }
30 for (i = 0; i < n_comp; i++)
31 vec[0][i] = tv[1 - v1][i];
32 for (j = n_vect - 1; j >= 0; j--)
33 for (i = 0; i < n_comp - 1; i++)
34 hi |= (unsigned int) (vec[j][i] / 8.0F);
35 ((Fx64 *) cc)[1] = hi;
36 }
37 static void fxt1_quantize(void)
38 {
39 int k;
40 for (k = 0; k < 4; k++)
41 fxt1_quantize_ALPHA1();
42 }
43 static void fxt1_encode(void)
44 {
45 fxt1_quantize();
46 }
47 static void texstore_rgba_fxt1(void)
48 {
49 fxt1_encode();
50 }
51 void *structfoo = texstore_rgba_fxt1;