23 #ifndef GR_COLOUR_SPACE_TABLES__H
24 #define GR_COLOUR_SPACE_TABLES__H
31 static g__constexpr
int table_r_from_y[256] = {
32 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
33 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17,
34 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36,
35 37, 38, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 54, 55,
36 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73,
37 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92,
38 93, 94, 95, 97, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 111,
39 112, 113, 114, 115, 116, 118, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129,
40 130, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 146, 147, 148,
41 149, 150, 151, 153, 154, 155, 156, 157, 158, 160, 161, 162, 163, 164, 165, 167,
42 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185,
43 186, 187, 189, 190, 191, 192, 193, 194, 196, 197, 198, 199, 200, 201, 203, 204,
44 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222,
45 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235, 236, 238, 239, 240, 241,
46 242, 243, 245, 246, 247, 248, 249, 250, 252, 253, 254, 255, 255, 255, 255, 255,
47 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
50 static g__constexpr
int table_r_from_u[256] = {
51 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
52 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
54 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
55 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
58 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
59 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
66 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
69 static g__constexpr
int table_r_from_v[256] = {
70 -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,
71 -179, -177, -176, -174, -172, -171, -169, -168, -166, -164, -163, -161, -160, -158, -156, -155,
72 -153, -152, -150, -148, -147, -145, -144, -142, -140, -139, -137, -136, -134, -132, -131, -129,
73 -128, -126, -124, -123, -121, -120, -118, -117, -115, -113, -112, -110, -109, -107, -105, -104,
74 -102, -101, -99, -97, -96, -94, -93, -91, -89, -88, -86, -85, -83, -81, -80, -78,
75 -77, -75, -73, -72, -70, -69, -67, -65, -64, -62, -61, -59, -57, -56, -54, -53,
76 -51, -49, -48, -46, -45, -43, -41, -40, -38, -37, -35, -34, -32, -30, -29, -27,
77 -26, -24, -22, -21, -19, -18, -16, -14, -13, -11, -10, -8, -6, -5, -3, -2,
78 0, 2, 3, 5, 6, 8, 10, 11, 13, 14, 16, 18, 19, 21, 22, 24,
79 26, 27, 29, 30, 32, 34, 35, 37, 38, 40, 41, 43, 45, 46, 48, 49,
80 51, 53, 54, 56, 57, 59, 61, 62, 64, 65, 67, 69, 70, 72, 73, 75,
81 77, 78, 80, 81, 83, 85, 86, 88, 89, 91, 93, 94, 96, 97, 99, 101,
82 102, 104, 105, 107, 109, 110, 112, 113, 115, 117, 118, 120, 121, 123, 124, 126,
83 128, 129, 131, 132, 134, 136, 137, 139, 140, 142, 144, 145, 147, 148, 150, 152,
84 153, 155, 156, 158, 160, 161, 163, 164, 166, 168, 169, 171, 172, 174, 176, 177,
85 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179
88 static g__constexpr
int table_g_from_y[256] = {
89 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
90 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17,
91 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36,
92 37, 38, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 54, 55,
93 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73,
94 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92,
95 93, 94, 95, 97, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 111,
96 112, 113, 114, 115, 116, 118, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129,
97 130, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 146, 147, 148,
98 149, 150, 151, 153, 154, 155, 156, 157, 158, 160, 161, 162, 163, 164, 165, 167,
99 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185,
100 186, 187, 189, 190, 191, 192, 193, 194, 196, 197, 198, 199, 200, 201, 203, 204,
101 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222,
102 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235, 236, 238, 239, 240, 241,
103 242, 243, 245, 246, 247, 248, 249, 250, 252, 253, 254, 255, 255, 255, 255, 255,
104 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
107 static g__constexpr
int table_g_from_u[256] = {
108 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
109 44, 43, 43, 43, 42, 42, 42, 41, 41, 40, 40, 40, 39, 39, 38, 38,
110 38, 37, 37, 36, 36, 36, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32,
111 31, 31, 31, 30, 30, 29, 29, 29, 28, 28, 27, 27, 27, 26, 26, 25,
112 25, 25, 24, 24, 23, 23, 23, 22, 22, 22, 21, 21, 20, 20, 20, 19,
113 19, 18, 18, 18, 17, 17, 16, 16, 16, 15, 15, 14, 14, 14, 13, 13,
114 13, 12, 12, 11, 11, 11, 10, 10, 9, 9, 9, 8, 8, 7, 7, 7,
115 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 2, 2, 2, 1, 1, 0,
116 0, 0, -1, -1, -2, -2, -2, -3, -3, -4, -4, -4, -5, -5, -5, -6,
117 -6, -7, -7, -7, -8, -8, -9, -9, -9, -10, -10, -11, -11, -11, -12, -12,
118 -13, -13, -13, -14, -14, -14, -15, -15, -16, -16, -16, -17, -17, -18, -18, -18,
119 -19, -19, -20, -20, -20, -21, -21, -22, -22, -22, -23, -23, -23, -24, -24, -25,
120 -25, -25, -26, -26, -27, -27, -27, -28, -28, -29, -29, -29, -30, -30, -31, -31,
121 -31, -32, -32, -33, -33, -33, -34, -34, -34, -35, -35, -36, -36, -36, -37, -37,
122 -38, -38, -38, -39, -39, -40, -40, -40, -41, -41, -42, -42, -42, -43, -43, -43,
123 -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44
126 static g__constexpr
int table_g_from_v[256] = {
127 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
128 91, 90, 89, 89, 88, 87, 86, 85, 85, 84, 83, 82, 81, 80, 80, 79,
129 78, 77, 76, 76, 75, 74, 73, 72, 72, 71, 70, 69, 68, 67, 67, 66,
130 65, 64, 63, 63, 62, 61, 60, 59, 59, 58, 57, 56, 55, 54, 54, 53,
131 52, 51, 50, 50, 49, 48, 47, 46, 46, 45, 44, 43, 42, 41, 41, 40,
132 39, 38, 37, 37, 36, 35, 34, 33, 33, 32, 31, 30, 29, 28, 28, 27,
133 26, 25, 24, 24, 23, 22, 21, 20, 20, 19, 18, 17, 16, 15, 15, 14,
134 13, 12, 11, 11, 10, 9, 8, 7, 7, 6, 5, 4, 3, 2, 2, 1,
135 0, -1, -2, -2, -3, -4, -5, -6, -7, -7, -8, -9, -10, -11, -11, -12,
136 -13, -14, -15, -15, -16, -17, -18, -19, -20, -20, -21, -22, -23, -24, -24, -25,
137 -26, -27, -28, -28, -29, -30, -31, -32, -33, -33, -34, -35, -36, -37, -37, -38,
138 -39, -40, -41, -41, -42, -43, -44, -45, -46, -46, -47, -48, -49, -50, -50, -51,
139 -52, -53, -54, -54, -55, -56, -57, -58, -59, -59, -60, -61, -62, -63, -63, -64,
140 -65, -66, -67, -67, -68, -69, -70, -71, -72, -72, -73, -74, -75, -76, -76, -77,
141 -78, -79, -80, -80, -81, -82, -83, -84, -85, -85, -86, -87, -88, -89, -89, -90,
142 -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91
145 static g__constexpr
int table_b_from_y[256] = {
146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
147 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17,
148 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36,
149 37, 38, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 54, 55,
150 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73,
151 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92,
152 93, 94, 95, 97, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 111,
153 112, 113, 114, 115, 116, 118, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129,
154 130, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 146, 147, 148,
155 149, 150, 151, 153, 154, 155, 156, 157, 158, 160, 161, 162, 163, 164, 165, 167,
156 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185,
157 186, 187, 189, 190, 191, 192, 193, 194, 196, 197, 198, 199, 200, 201, 203, 204,
158 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222,
159 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235, 236, 238, 239, 240, 241,
160 242, 243, 245, 246, 247, 248, 249, 250, 252, 253, 254, 255, 255, 255, 255, 255,
161 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
164 static g__constexpr
int table_b_from_u[256] = {
165 -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,
166 -226, -224, -222, -220, -218, -216, -214, -212, -210, -208, -206, -204, -202, -200, -198, -196,
167 -194, -192, -190, -188, -186, -184, -182, -180, -178, -175, -173, -171, -169, -167, -165, -163,
168 -161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131,
169 -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99,
170 -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67,
171 -65, -63, -61, -58, -56, -54, -52, -50, -48, -46, -44, -42, -40, -38, -36, -34,
172 -32, -30, -28, -26, -24, -22, -20, -18, -16, -14, -12, -10, -8, -6, -4, -2,
173 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
174 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 61, 63,
175 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
176 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127,
177 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
178 161, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 184, 186, 188, 190, 192,
179 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224,
180 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226
183 static g__constexpr
int table_b_from_v[256] = {
184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
187 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
188 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
189 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
190 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
192 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
193 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
194 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
195 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
196 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
198 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
202 static g__constexpr
int table_y_from_r[256] = {
203 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4,
204 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8,
205 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12,
206 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16,
207 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20,
208 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24,
209 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 29,
210 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33,
211 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37,
212 37, 37, 37, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41,
213 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45,
214 45, 45, 46, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49,
215 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53,
216 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57,
217 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61,
218 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65
221 static g__constexpr
int table_y_from_g[256] = {
222 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
223 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16,
224 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24,
225 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32,
226 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40,
227 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48,
228 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56,
229 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 64,
230 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72,
231 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80,
232 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88,
233 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96,
234 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104,
235 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112,
236 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120,
237 121, 121, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129
240 static g__constexpr
int table_y_from_b[256] = {
241 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
242 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
243 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5,
244 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6,
245 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8,
246 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,
247 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
248 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
249 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
250 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16,
251 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17,
252 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19,
253 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20,
254 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
255 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
256 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25
259 static g__constexpr
int table_u_from_r[256] = {
260 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2,
261 -2, -3, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, -5,
262 -5, -5, -5, -5, -5, -5, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7,
263 -7, -7, -7, -8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9,
264 -10, -10, -10, -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -12, -12,
265 -12, -12, -12, -12, -12, -13, -13, -13, -13, -13, -13, -14, -14, -14, -14, -14,
266 -14, -14, -15, -15, -15, -15, -15, -15, -15, -16, -16, -16, -16, -16, -16, -16,
267 -17, -17, -17, -17, -17, -17, -18, -18, -18, -18, -18, -18, -18, -19, -19, -19,
268 -19, -19, -19, -19, -20, -20, -20, -20, -20, -20, -20, -21, -21, -21, -21, -21,
269 -21, -22, -22, -22, -22, -22, -22, -22, -23, -23, -23, -23, -23, -23, -23, -24,
270 -24, -24, -24, -24, -24, -24, -25, -25, -25, -25, -25, -25, -26, -26, -26, -26,
271 -26, -26, -26, -27, -27, -27, -27, -27, -27, -27, -28, -28, -28, -28, -28, -28,
272 -29, -29, -29, -29, -29, -29, -29, -30, -30, -30, -30, -30, -30, -30, -31, -31,
273 -31, -31, -31, -31, -31, -32, -32, -32, -32, -32, -32, -33, -33, -33, -33, -33,
274 -33, -33, -34, -34, -34, -34, -34, -34, -34, -35, -35, -35, -35, -35, -35, -35,
275 -36, -36, -36, -36, -36, -36, -37, -37, -37, -37, -37, -37, -37, -38, -38, -38
278 static g__constexpr
int table_u_from_g[256] = {
279 0, 0, -1, -1, -1, -1, -2, -2, -2, -3, -3, -3, -3, -4, -4, -4,
280 -5, -5, -5, -6, -6, -6, -6, -7, -7, -7, -8, -8, -8, -8, -9, -9,
281 -9, -10, -10, -10, -10, -11, -11, -11, -12, -12, -12, -13, -13, -13, -13, -14,
282 -14, -14, -15, -15, -15, -15, -16, -16, -16, -17, -17, -17, -17, -18, -18, -18,
283 -19, -19, -19, -19, -20, -20, -20, -21, -21, -21, -22, -22, -22, -22, -23, -23,
284 -23, -24, -24, -24, -24, -25, -25, -25, -26, -26, -26, -26, -27, -27, -27, -28,
285 -28, -28, -28, -29, -29, -29, -30, -30, -30, -31, -31, -31, -31, -32, -32, -32,
286 -33, -33, -33, -33, -34, -34, -34, -35, -35, -35, -35, -36, -36, -36, -37, -37,
287 -37, -38, -38, -38, -38, -39, -39, -39, -40, -40, -40, -40, -41, -41, -41, -42,
288 -42, -42, -42, -43, -43, -43, -44, -44, -44, -44, -45, -45, -45, -46, -46, -46,
289 -47, -47, -47, -47, -48, -48, -48, -49, -49, -49, -49, -50, -50, -50, -51, -51,
290 -51, -51, -52, -52, -52, -53, -53, -53, -53, -54, -54, -54, -55, -55, -55, -56,
291 -56, -56, -56, -57, -57, -57, -58, -58, -58, -58, -59, -59, -59, -60, -60, -60,
292 -60, -61, -61, -61, -62, -62, -62, -63, -63, -63, -63, -64, -64, -64, -65, -65,
293 -65, -65, -66, -66, -66, -67, -67, -67, -67, -68, -68, -68, -69, -69, -69, -69,
294 -70, -70, -70, -71, -71, -71, -72, -72, -72, -72, -73, -73, -73, -74, -74, -74
297 static g__constexpr
int table_u_from_b[256] = {
298 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7,
299 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14,
300 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21,
301 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28,
302 28, 29, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35,
303 35, 36, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 42,
304 42, 43, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49,
305 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56,
306 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63,
307 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70,
308 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 76, 77,
309 77, 78, 78, 79, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84,
310 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 90, 90, 90, 91,
311 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98,
312 98, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105,
313 105, 106, 106, 107, 107, 108, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112
316 static g__constexpr
int table_v_from_r[256] = {
317 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7,
318 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14,
319 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21,
320 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28,
321 28, 29, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35,
322 35, 36, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 42,
323 42, 43, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49,
324 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56,
325 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63,
326 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70,
327 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 76, 77,
328 77, 78, 78, 79, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84,
329 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 90, 90, 90, 91,
330 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98,
331 98, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105,
332 105, 106, 106, 107, 107, 108, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112
335 static g__constexpr
int table_v_from_g[256] = {
336 0, 0, -1, -1, -1, -2, -2, -3, -3, -3, -4, -4, -4, -5, -5, -6,
337 -6, -6, -7, -7, -7, -8, -8, -8, -9, -9, -10, -10, -10, -11, -11, -11,
338 -12, -12, -13, -13, -13, -14, -14, -14, -15, -15, -15, -16, -16, -17, -17, -17,
339 -18, -18, -18, -19, -19, -20, -20, -20, -21, -21, -21, -22, -22, -22, -23, -23,
340 -24, -24, -24, -25, -25, -25, -26, -26, -27, -27, -27, -28, -28, -28, -29, -29,
341 -29, -30, -30, -31, -31, -31, -32, -32, -32, -33, -33, -33, -34, -34, -35, -35,
342 -35, -36, -36, -36, -37, -37, -38, -38, -38, -39, -39, -39, -40, -40, -40, -41,
343 -41, -42, -42, -42, -43, -43, -43, -44, -44, -45, -45, -45, -46, -46, -46, -47,
344 -47, -47, -48, -48, -49, -49, -49, -50, -50, -50, -51, -51, -52, -52, -52, -53,
345 -53, -53, -54, -54, -54, -55, -55, -56, -56, -56, -57, -57, -57, -58, -58, -59,
346 -59, -59, -60, -60, -60, -61, -61, -61, -62, -62, -63, -63, -63, -64, -64, -64,
347 -65, -65, -66, -66, -66, -67, -67, -67, -68, -68, -68, -69, -69, -70, -70, -70,
348 -71, -71, -71, -72, -72, -73, -73, -73, -74, -74, -74, -75, -75, -75, -76, -76,
349 -77, -77, -77, -78, -78, -78, -79, -79, -80, -80, -80, -81, -81, -81, -82, -82,
350 -82, -83, -83, -84, -84, -84, -85, -85, -85, -86, -86, -86, -87, -87, -88, -88,
351 -88, -89, -89, -89, -90, -90, -91, -91, -91, -92, -92, -92, -93, -93, -93, -94
354 static g__constexpr
int table_v_from_b[256] = {
355 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1,
356 -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
357 -2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
358 -3, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
359 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -6, -6,
360 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7,
361 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -8, -8, -8, -8, -8, -8,
362 -8, -8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9,
363 -9, -9, -9, -9, -9, -9, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
364 -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
365 -11, -11, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
366 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -14, -14,
367 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -15, -15, -15, -15,
368 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -16, -16, -16, -16, -16, -16,
369 -16, -16, -16, -16, -16, -16, -16, -16, -17, -17, -17, -17, -17, -17, -17, -17,
370 -17, -17, -17, -17, -17, -17, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18