Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gamma correction tables for LEDs on Arduino
import (
"fmt"
"math"
"strings"
)
func printGammaTable(start, end int, gamma float64) {
g_s := strings.ReplaceAll(fmt.Sprintf("%1.1f", gamma), ".", "_")
fmt.Printf("\nconst uint8_t PROGMEM gamma_%s_%dto%d_table[] = {\n", g_s, start, end)
for x := 0; x < 256; x++ {
if (x)%16 == 0 {
fmt.Print(" ")
}
fmt.Printf("%3d", int(math.Round(math.Pow(float64(x)/255, gamma)*float64(end-start)))+start)
if x < 255 {
fmt.Print(",")
}
if (x+1)%16 == 0 {
fmt.Print("\n")
}
}
fmt.Println("};")
}
func main() {
for gamma := 2.2; gamma < 4; gamma += 0.2 {
printGammaTable(0, 255, gamma)
printGammaTable(1, 255, gamma)
}
}
const uint8_t PROGMEM gamma_2_2_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12,
12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19,
20, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,
30, 30, 31, 32, 33, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41,
42, 43, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 87, 88, 89, 90,
91, 93, 94, 95, 97, 98, 99,100,102,103,105,106,107,109,110,111,
113,114,116,117,119,120,121,123,124,126,127,129,130,132,133,135,
137,138,140,141,143,145,146,148,149,151,153,154,156,158,159,161,
163,165,166,168,170,172,173,175,177,179,181,182,184,186,188,190,
192,194,196,197,199,201,203,205,207,209,211,213,215,217,219,221,
223,225,227,229,231,234,236,238,240,242,244,246,248,251,253,255
};
const uint8_t PROGMEM gamma_2_2_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7,
7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13,
13, 14, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20,
21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30,
31, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 42,
43, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91,
92, 93, 95, 96, 97, 98,100,101,102,104,105,106,108,109,111,112,
113,115,116,118,119,120,122,123,125,126,128,129,131,132,134,135,
137,139,140,142,143,145,147,148,150,151,153,155,156,158,160,162,
163,165,167,168,170,172,174,176,177,179,181,183,185,186,188,190,
192,194,196,198,200,201,203,205,207,209,211,213,215,217,219,221,
223,225,227,229,232,234,236,238,240,242,244,246,248,251,253,255
};
const uint8_t PROGMEM gamma_2_4_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9,
9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 14, 15, 15,
16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 22, 22, 23, 23, 24,
24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 35,
35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 80, 81, 82,
83, 85, 86, 87, 88, 90, 91, 92, 94, 95, 96, 98, 99,100,102,103,
105,106,108,109,111,112,114,115,117,118,120,121,123,124,126,127,
129,131,132,134,136,137,139,141,142,144,146,148,149,151,153,155,
156,158,160,162,164,166,167,169,171,173,175,177,179,181,183,185,
187,189,191,193,195,197,199,201,203,205,207,210,212,214,216,218,
220,223,225,227,229,232,234,236,239,241,243,246,248,250,253,255
};
const uint8_t PROGMEM gamma_2_4_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5,
6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10,
10, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16,
17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 35, 36,
36, 37, 38, 39, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 48, 49,
50, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 67, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78, 79, 80, 82, 83,
84, 85, 87, 88, 89, 90, 92, 93, 94, 96, 97, 98,100,101,102,104,
105,107,108,110,111,113,114,116,117,119,120,122,123,125,126,128,
130,131,133,134,136,138,139,141,143,144,146,148,150,151,153,155,
157,159,160,162,164,166,168,170,172,173,175,177,179,181,183,185,
187,189,191,193,195,197,199,201,203,206,208,210,212,214,216,218,
221,223,225,227,229,232,234,236,239,241,243,246,248,250,253,255
};
const uint8_t PROGMEM gamma_2_6_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7,
7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12,
13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20,
20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29,
30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 75,
76, 77, 78, 80, 81, 82, 84, 85, 86, 88, 89, 90, 92, 93, 94, 96,
97, 99,100,102,103,105,106,108,109,111,112,114,115,117,119,120,
122,124,125,127,129,130,132,134,136,137,139,141,143,145,146,148,
150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,
182,184,186,188,191,193,195,197,199,202,204,206,209,211,213,215,
218,220,223,225,227,230,232,235,237,240,242,245,247,250,252,255
};
const uint8_t PROGMEM gamma_2_6_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8,
8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13,
13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 20, 20,
21, 22, 22, 23, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30,
31, 32, 32, 33, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57,
58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75,
77, 78, 79, 80, 82, 83, 84, 86, 87, 88, 90, 91, 92, 94, 95, 96,
98, 99,101,102,104,105,107,108,110,111,113,114,116,118,119,121,
122,124,126,127,129,131,133,134,136,138,140,141,143,145,147,149,
151,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,
182,184,187,189,191,193,195,197,200,202,204,206,209,211,213,216,
218,220,223,225,227,230,232,235,237,240,242,245,247,250,252,255
};
const uint8_t PROGMEM gamma_2_8_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
90, 92, 93, 95, 96, 98, 99,101,102,104,105,107,109,110,112,114,
115,117,119,120,122,124,126,127,129,131,133,135,137,138,140,142,
144,146,148,150,152,154,156,158,160,162,164,167,169,171,173,175,
177,180,182,184,186,189,191,193,196,198,200,203,205,208,210,213,
215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255
};
const uint8_t PROGMEM gamma_2_8_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6,
6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11,
11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 17, 17,
17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26,
26, 27, 28, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37,
38, 39, 40, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 67, 69,
70, 71, 72, 74, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 88, 90,
91, 92, 94, 95, 97, 98,100,101,103,104,106,108,109,111,112,114,
116,117,119,121,123,124,126,128,130,131,133,135,137,139,141,143,
145,147,148,150,152,154,156,159,161,163,165,167,169,171,173,175,
178,180,182,184,187,189,191,194,196,198,201,203,205,208,210,213,
215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255
};
const uint8_t PROGMEM gamma_3_0_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4,
4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 8,
8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13,
14, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21,
22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 32,
32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62,
63, 64, 65, 67, 68, 69, 70, 72, 73, 74, 76, 77, 78, 80, 81, 82,
84, 85, 87, 88, 90, 91, 93, 94, 96, 97, 99,101,102,104,105,107,
109,111,112,114,116,118,119,121,123,125,127,129,131,132,134,136,
138,140,142,144,147,149,151,153,155,157,159,162,164,166,168,171,
173,175,178,180,182,185,187,190,192,195,197,200,202,205,207,210,
213,215,218,221,223,226,229,232,235,237,240,243,246,249,252,255
};
const uint8_t PROGMEM gamma_3_0_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5,
5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9,
9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14,
15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 30, 30, 31, 32, 32,
33, 34, 35, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 63,
64, 65, 66, 67, 69, 70, 71, 72, 74, 75, 76, 78, 79, 80, 82, 83,
85, 86, 87, 89, 90, 92, 93, 95, 96, 98,100,101,103,104,106,108,
109,111,113,115,116,118,120,122,124,125,127,129,131,133,135,137,
139,141,143,145,147,149,151,153,155,158,160,162,164,166,169,171,
173,175,178,180,183,185,187,190,192,195,197,200,202,205,208,210,
213,215,218,221,224,226,229,232,235,237,240,243,246,249,252,255
};
const uint8_t PROGMEM gamma_3_2_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3,
3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11,
11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 17, 17, 18,
18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27,
28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 37, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 59, 60, 61, 62, 63, 65, 66, 67, 68, 70, 71, 72, 74, 75, 76,
78, 79, 81, 82, 84, 85, 87, 88, 90, 91, 93, 95, 96, 98, 99,101,
103,105,106,108,110,112,113,115,117,119,121,123,125,127,129,131,
133,135,137,139,141,143,146,148,150,152,154,157,159,161,164,166,
168,171,173,176,178,181,183,186,188,191,194,196,199,202,204,207,
210,213,216,219,221,224,227,230,233,236,239,242,246,249,252,255
};
const uint8_t PROGMEM gamma_3_2_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7,
7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12,
12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19,
19, 20, 20, 21, 21, 22, 23, 23, 24, 24, 25, 26, 26, 27, 28, 28,
29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 47, 48, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 62, 63, 64, 65, 67, 68, 69, 70, 72, 73, 74, 76, 77,
79, 80, 81, 83, 84, 86, 87, 89, 90, 92, 94, 95, 97, 98,100,102,
103,105,107,109,110,112,114,116,118,120,122,123,125,127,129,131,
133,135,137,140,142,144,146,148,150,153,155,157,159,162,164,166,
169,171,174,176,179,181,184,186,189,191,194,197,199,202,205,207,
210,213,216,219,222,224,227,230,233,236,239,242,246,249,252,255
};
const uint8_t PROGMEM gamma_3_4_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5,
5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9,
9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15,
16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 23, 23, 24,
24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 36,
37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 55, 56, 57, 58, 59, 60, 62, 63, 64, 66, 67, 68, 70, 71,
72, 74, 75, 77, 78, 80, 81, 83, 84, 86, 87, 89, 90, 92, 94, 95,
97, 99,101,102,104,106,108,110,112,114,115,117,119,121,123,125,
128,130,132,134,136,138,141,143,145,147,150,152,154,157,159,162,
164,167,169,172,174,177,180,182,185,188,190,193,196,199,202,205,
208,210,213,216,219,223,226,229,232,235,238,242,245,248,252,255
};
const uint8_t PROGMEM gamma_3_4_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6,
6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10,
10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
16, 17, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25,
25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 58, 59, 60, 61, 62, 64, 65, 66, 68, 69, 70, 72,
73, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 91, 93, 94, 96,
98,100,101,103,105,107,108,110,112,114,116,118,120,122,124,126,
128,130,132,134,137,139,141,143,145,148,150,152,155,157,160,162,
164,167,169,172,175,177,180,183,185,188,191,193,196,199,202,205,
208,211,214,217,220,223,226,229,232,235,238,242,245,248,252,255
};
const uint8_t PROGMEM gamma_3_6_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4,
4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13,
13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 20, 20, 21,
21, 22, 23, 23, 24, 24, 25, 26, 27, 27, 28, 29, 29, 30, 31, 32,
33, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42, 43, 44, 46, 47,
48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 61, 62, 63, 64, 66,
67, 69, 70, 71, 73, 74, 76, 77, 79, 80, 82, 83, 85, 87, 88, 90,
92, 94, 95, 97, 99,101,103,104,106,108,110,112,114,116,118,120,
122,125,127,129,131,133,136,138,140,143,145,147,150,152,155,157,
160,162,165,168,170,173,176,179,181,184,187,190,193,196,199,202,
205,208,211,214,218,221,224,227,231,234,237,241,244,248,251,255
};
const uint8_t PROGMEM gamma_3_6_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5,
5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8,
9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14,
14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 21, 21, 22,
22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 33,
33, 34, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 46, 47,
48, 50, 51, 52, 53, 54, 55, 56, 58, 59, 60, 61, 63, 64, 65, 66,
68, 69, 71, 72, 73, 75, 76, 78, 79, 81, 83, 84, 86, 87, 89, 91,
92, 94, 96, 98, 99,101,103,105,107,109,111,113,115,117,119,121,
123,125,127,129,132,134,136,138,141,143,145,148,150,153,155,158,
160,163,165,168,171,173,176,179,182,185,187,190,193,196,199,202,
205,208,211,215,218,221,224,227,231,234,238,241,244,248,251,255
};
const uint8_t PROGMEM gamma_3_8_0to255_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11,
11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 18, 18,
19, 19, 20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 28, 28,
29, 30, 31, 31, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42,
43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 60, 61,
62, 64, 65, 66, 68, 69, 71, 72, 74, 75, 77, 78, 80, 82, 83, 85,
87, 88, 90, 92, 94, 96, 98, 99,101,103,105,107,109,111,113,115,
118,120,122,124,126,129,131,133,136,138,141,143,146,148,151,153,
156,158,161,164,167,169,172,175,178,181,184,187,190,193,196,199,
203,206,209,212,216,219,222,226,229,233,237,240,244,247,251,255
};
const uint8_t PROGMEM gamma_3_8_1to255_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7,
7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12,
12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19,
20, 20, 21, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29,
30, 31, 32, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 62,
63, 64, 66, 67, 69, 70, 72, 73, 75, 76, 78, 79, 81, 82, 84, 86,
87, 89, 91, 93, 94, 96, 98,100,102,104,106,108,110,112,114,116,
118,120,122,125,127,129,131,134,136,139,141,143,146,148,151,154,
156,159,162,164,167,170,173,175,178,181,184,187,190,193,196,200,
203,206,209,212,216,219,223,226,230,233,237,240,244,248,251,255
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment