spiv: Fix image list counter
[gfxprim.git] / libs / core / GP_GammaCorrection.gen.c.t
blob18713dc673af684d462d65498b8d495a3be6623f
1 @ include source.t
2 /*
3  * Gamma correction tables for Gamma = 2.2
4  *
5  * Copyright (C) 2012-2014 Cyril Hrubis <metan@ucw.cz>
6  */
8 #include <stdint.h>
11  * Converts 8 bit gamma to 10 bit linear.
12  */
13 static uint16_t gamma8_linear10[] = {
14 @ for i in range(0, 256):
15         {{ int(((float(i)/255) ** 2.2) * 1024 + 0.5) }}, /* {{i}} */
16 @ end
20  * Converts 10 bit linear to 8 bit gamma.
21  */
22 static uint8_t linear10_gamma8[] = {
23 @ for i in range(0, 1025):
24         {{ int(((float(i)/1024) ** (1/2.2)) * 255 + 0.5) }}, /* {{i}} */
25 @ end
29  * Pointers to tables
30  */
31 uint16_t *GP_Gamma8_Linear10 = gamma8_linear10;
32 uint8_t *GP_Linear10_Gamma8 = linear10_gamma8;