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