10 |
|
|
11 |
|
#include "color.h" |
12 |
|
|
13 |
< |
#define MAXGSHIFT 2 /* maximum shift for gamma table */ |
13 |
> |
#define MAXGSHIFT 15 /* maximum shift for gamma table */ |
14 |
|
|
15 |
|
static BYTE g_mant[256], g_nexp[256]; |
16 |
|
|
32 |
|
/* compute gamb -> colr mapping */ |
33 |
|
i = 0; |
34 |
|
mult = 256.0; |
35 |
< |
for (j = 255; j >= 0; j--) { |
36 |
< |
rept: |
37 |
< |
g_mant[j] = mult * pow((j+.5)/256.0, g); |
38 |
< |
if (g_mant[j] < 128) { |
35 |
> |
for (j = 255; j > 0; j--) { |
36 |
> |
while ((g_mant[j] = mult * pow(j/256.0, g)) < 128) { |
37 |
|
i++; |
38 |
|
mult *= 2.0; |
41 |
– |
goto rept; |
39 |
|
} |
40 |
|
g_nexp[j] = i; |
41 |
|
} |
42 |
+ |
g_mant[0] = 0; |
43 |
+ |
g_nexp[0] = COLXS; |
44 |
|
} |
45 |
|
|
46 |
|
|