Home | History | Annotate | Download | only in video

Lines Matching refs:gamma

24 /* Gamma correction support */
27 #include <math.h> /* Used for calculating gamma ramps */
41 static void CalculateGammaRamp(float gamma, Uint16 *ramp)
45 /* 0.0 gamma is all black */
46 if ( gamma <= 0.0f ) {
52 /* 1.0 gamma is identity */
53 if ( gamma == 1.0f ) {
59 /* Calculate a real gamma ramp */
61 gamma = 1.0f / gamma;
63 value = (int)(pow((double)i/256.0, gamma)*65535.0+0.5);
71 static void CalculateGammaFromRamp(float *gamma, Uint16 *ramp)
79 *gamma = 1.0;
89 *gamma = 1.0f / (sum / count);
116 /* Calculating the gamma by integrating the gamma ramps isn't exact,
157 /* Lazily allocate the gamma tables */
158 if ( ! video->gamma ) {
162 /* Fill the gamma table with the new values */
164 SDL_memcpy(&video->gamma[0*256], red, 256*sizeof(*video->gamma));
167 SDL_memcpy(&video->gamma[1*256], green, 256*sizeof(*video->gamma));
170 SDL_memcpy(&video->gamma[2*256], blue, 256*sizeof(*video->gamma));
173 /* Gamma correction always possible on split palettes */
186 /* Try to set the gamma ramp in the driver */
189 succeeded = video->SetGammaRamp(this, video->gamma);
191 SDL_SetError("Gamma ramp manipulation not supported");
201 /* Lazily allocate the gamma table */
202 if ( ! video->gamma ) {
203 video->gamma = SDL_malloc(3*256*sizeof(*video->gamma));
204 if ( ! video->gamma ) {
209 /* Get the real hardware gamma */
210 video->GetGammaRamp(this, video->gamma);
212 /* Assume an identity gamma */
215 video->gamma[0*256+i] = (i << 8) | i;
216 video->gamma[1*256+i] = (i << 8) | i;
217 video->gamma[2*256+i] = (i << 8) | i;
224 SDL_memcpy(red, &video->gamma[0*256], 256*sizeof(*red));
227 SDL_memcpy(green, &video->gamma[1*256], 256*sizeof(*green));
230 SDL_memcpy(blue, &video->gamma[2*256], 256*sizeof(*blue));