MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / fconfig_buildlut

Function fconfig_buildlut

server/fakerconfig.cpp:208–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206
207
208static void fconfig_buildlut(FakerConfig &fc)
209{
210 if(fc.gamma != 0.0 && fc.gamma != 1.0 && fc.gamma != -1.0)
211 {
212 double g = fc.gamma > 0.0 ? 1.0 / fc.gamma : -fc.gamma;
213 for(int i = 0; i < 256; i++)
214 fc.gamma_lut[i] = (unsigned char)(255. * pow((double)i / 255., g) + 0.5);
215 for(int i = 0; i < 1024; i++)
216 fc.gamma_lut10[i] =
217 (unsigned short)(1023. * pow((double)i / 1023., g) + 0.5);
218 for(int i = 0; i < 65536; i++)
219 {
220 fc.gamma_lut16[i] =
221 (unsigned short)(255. * pow((double)(i / 256) / 255., g) + 0.5) << 8;
222 fc.gamma_lut16[i] |=
223 (unsigned short)(255. * pow((double)(i % 256) / 255., g) + 0.5);
224 }
225 }
226}
227
228
229#define FETCHENV_STR(envvar, s) \

Callers 1

fconfig_setgammaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected