-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathhumanization_lut.c
More file actions
319 lines (292 loc) · 20.9 KB
/
Copy pathhumanization_lut.c
File metadata and controls
319 lines (292 loc) · 20.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/*
* Precomputed Lookup Tables for Humanization
*
* AUTO-GENERATED by tools/generate_lut.py
* Do not edit manually - regenerate with: python3 tools/generate_lut.py
*
* These tables are stored in flash (.rodata) and consume no RAM.
*/
#include "humanization_lut.h"
#include "smooth_injection.h"
//--------------------------------------------------------------------+
// Ease-In-Out Cubic Table
//
// Formula: if t < 0.5: 4*t³
// else: 1 - (-2t + 2)³ / 2
//
// Provides natural acceleration/deceleration like human movement
// 256 entries, input t = index/255, output in 16.16 fixed-point
//--------------------------------------------------------------------+
const int32_t g_ease_in_out_cubic_lut[EASING_LUT_SIZE] = {
0, 0, 0, 0, 1, 2, 3, 5,
8, 12, 16, 21, 27, 35, 43, 53,
65, 78, 92, 108, 126, 146, 168, 192,
219, 247, 278, 311, 347, 386, 427, 471,
518, 568, 621, 678, 738, 801, 868, 938,
1012, 1090, 1171, 1257, 1347, 1441, 1539, 1641,
1748, 1860, 1976, 2097, 2223, 2354, 2489, 2630,
2776, 2928, 3085, 3247, 3415, 3588, 3768, 3953,
4144, 4342, 4545, 4755, 4971, 5194, 5423, 5658,
5901, 6150, 6406, 6670, 6940, 7218, 7502, 7795,
8094, 8402, 8717, 9040, 9370, 9709, 10056, 10411,
10774, 11145, 11525, 11914, 12311, 12717, 13131, 13555,
13987, 14429, 14880, 15340, 15810, 16289, 16777, 17276,
17784, 18302, 18829, 19367, 19915, 20474, 21043, 21622,
22211, 22812, 23423, 24044, 24677, 25321, 25976, 26642,
27319, 28008, 28708, 29419, 30143, 30878, 31625, 32384,
33152, 33911, 34658, 35393, 36117, 36828, 37528, 38217,
38894, 39560, 40215, 40859, 41492, 42113, 42724, 43325,
43914, 44493, 45062, 45621, 46169, 46707, 47234, 47752,
48260, 48759, 49247, 49726, 50196, 50656, 51107, 51549,
51981, 52405, 52819, 53225, 53622, 54011, 54391, 54762,
55125, 55480, 55827, 56166, 56496, 56819, 57134, 57442,
57741, 58034, 58318, 58596, 58866, 59130, 59386, 59635,
59878, 60113, 60342, 60565, 60781, 60991, 61194, 61392,
61583, 61768, 61948, 62121, 62289, 62451, 62608, 62760,
62906, 63047, 63182, 63313, 63439, 63560, 63676, 63788,
63895, 63997, 64095, 64189, 64279, 64365, 64446, 64524,
64598, 64668, 64735, 64798, 64858, 64915, 64968, 65018,
65065, 65109, 65150, 65189, 65225, 65258, 65289, 65317,
65344, 65368, 65390, 65410, 65428, 65444, 65458, 65471,
65483, 65493, 65501, 65509, 65515, 65520, 65524, 65528,
65531, 65533, 65534, 65535, 65536, 65536, 65536, 65536
};
//--------------------------------------------------------------------+
// Ease-Out Quadratic Table
//
// Formula: 1 - (1-t)²
//
// Quick start, gradual slowdown - good for corrections
//--------------------------------------------------------------------+
const int32_t g_ease_out_quad_lut[EASING_LUT_SIZE] = {
0, 513, 1024, 1533, 2040, 2545, 3048, 3549,
4048, 4544, 5039, 5532, 6023, 6512, 6999, 7483,
7966, 8447, 8926, 9402, 9877, 10350, 10820, 11289,
11756, 12220, 12683, 13143, 13602, 14059, 14513, 14966,
15416, 15865, 16311, 16756, 17198, 17639, 18077, 18513,
18948, 19380, 19810, 20239, 20665, 21089, 21512, 21932,
22350, 22767, 23181, 23593, 24003, 24411, 24818, 25222,
25624, 26024, 26422, 26818, 27212, 27604, 27994, 28382,
28768, 29152, 29534, 29914, 30292, 30668, 31042, 31414,
31784, 32152, 32518, 32881, 33243, 33603, 33961, 34317,
34670, 35022, 35372, 35720, 36065, 36409, 36751, 37090,
37428, 37763, 38097, 38429, 38758, 39086, 39411, 39735,
40056, 40376, 40693, 41009, 41322, 41634, 41943, 42250,
42556, 42859, 43161, 43460, 43757, 44052, 44346, 44637,
44926, 45214, 45499, 45782, 46063, 46342, 46620, 46895,
47168, 47439, 47708, 47975, 48240, 48503, 48764, 49023,
49280, 49535, 49788, 50039, 50288, 50535, 50780, 51023,
51264, 51503, 51739, 51974, 52207, 52438, 52667, 52893,
53118, 53341, 53562, 53780, 53997, 54212, 54424, 54635,
54844, 55050, 55255, 55457, 55658, 55857, 56053, 56248,
56440, 56631, 56819, 57005, 57190, 57372, 57553, 57731,
57908, 58082, 58254, 58425, 58593, 58759, 58923, 59086,
59246, 59404, 59560, 59715, 59867, 60017, 60165, 60311,
60455, 60597, 60738, 60876, 61012, 61146, 61278, 61408,
61536, 61662, 61786, 61908, 62028, 62146, 62261, 62375,
62487, 62597, 62705, 62811, 62915, 63016, 63116, 63214,
63310, 63403, 63495, 63585, 63672, 63758, 63842, 63923,
64003, 64081, 64156, 64230, 64301, 64371, 64438, 64504,
64567, 64629, 64688, 64746, 64801, 64855, 64906, 64955,
65003, 65048, 65092, 65133, 65172, 65209, 65245, 65278,
65309, 65338, 65366, 65391, 65414, 65435, 65454, 65471,
65487, 65500, 65511, 65520, 65527, 65532, 65535, 65536
};
//--------------------------------------------------------------------+
// Linear Easing Table (identity function)
//--------------------------------------------------------------------+
const int32_t g_ease_linear_lut[EASING_LUT_SIZE] = {
0, 257, 514, 771, 1028, 1285, 1542, 1799,
2056, 2313, 2570, 2827, 3084, 3341, 3598, 3855,
4112, 4369, 4626, 4883, 5140, 5397, 5654, 5911,
6168, 6425, 6682, 6939, 7196, 7453, 7710, 7967,
8224, 8481, 8738, 8995, 9252, 9509, 9766, 10023,
10280, 10537, 10794, 11051, 11308, 11565, 11822, 12079,
12336, 12593, 12850, 13107, 13364, 13621, 13878, 14135,
14392, 14649, 14906, 15163, 15420, 15677, 15934, 16191,
16448, 16705, 16962, 17219, 17476, 17733, 17990, 18247,
18504, 18761, 19018, 19275, 19532, 19789, 20046, 20303,
20560, 20817, 21074, 21331, 21588, 21845, 22102, 22359,
22616, 22873, 23130, 23387, 23644, 23901, 24158, 24415,
24672, 24929, 25186, 25443, 25700, 25957, 26214, 26471,
26728, 26985, 27242, 27499, 27756, 28013, 28270, 28527,
28784, 29041, 29298, 29555, 29812, 30069, 30326, 30583,
30840, 31097, 31354, 31611, 31868, 32125, 32382, 32639,
32897, 33154, 33411, 33668, 33925, 34182, 34439, 34696,
34953, 35210, 35467, 35724, 35981, 36238, 36495, 36752,
37009, 37266, 37523, 37780, 38037, 38294, 38551, 38808,
39065, 39322, 39579, 39836, 40093, 40350, 40607, 40864,
41121, 41378, 41635, 41892, 42149, 42406, 42663, 42920,
43177, 43434, 43691, 43948, 44205, 44462, 44719, 44976,
45233, 45490, 45747, 46004, 46261, 46518, 46775, 47032,
47289, 47546, 47803, 48060, 48317, 48574, 48831, 49088,
49345, 49602, 49859, 50116, 50373, 50630, 50887, 51144,
51401, 51658, 51915, 52172, 52429, 52686, 52943, 53200,
53457, 53714, 53971, 54228, 54485, 54742, 54999, 55256,
55513, 55770, 56027, 56284, 56541, 56798, 57055, 57312,
57569, 57826, 58083, 58340, 58597, 58854, 59111, 59368,
59625, 59882, 60139, 60396, 60653, 60910, 61167, 61424,
61681, 61938, 62195, 62452, 62709, 62966, 63223, 63480,
63737, 63994, 64251, 64508, 64765, 65022, 65279, 65536
};
//--------------------------------------------------------------------+
// Progress Lookup Table
//
// g_progress_lut[total_frames][current_frame] = current_frame / total_frames
// in 16.16 fixed-point format
//
// Eliminates division in the hot path for frame spreading
//--------------------------------------------------------------------+
const int32_t g_progress_lut[MAX_PRECOMPUTED_FRAMES + 1][MAX_PRECOMPUTED_FRAMES + 1] = {
{65536, 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}, // total_frames = 0
{0, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 1
{0, 32768, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 2
{0, 21845, 43691, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 3
{0, 16384, 32768, 49152, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 4
{0, 13107, 26214, 39322, 52429, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 5
{0, 10923, 21845, 32768, 43691, 54613, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 6
{0, 9362, 18725, 28087, 37449, 46811, 56174, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 7
{0, 8192, 16384, 24576, 32768, 40960, 49152, 57344, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 8
{0, 7282, 14564, 21845, 29127, 36409, 43691, 50972, 58254, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 9
{0, 6554, 13107, 19661, 26214, 32768, 39322, 45875, 52429, 58982, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 10
{0, 5958, 11916, 17873, 23831, 29789, 35747, 41705, 47663, 53620, 59578, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 11
{0, 5461, 10923, 16384, 21845, 27307, 32768, 38229, 43691, 49152, 54613, 60075, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 12
{0, 5041, 10082, 15124, 20165, 25206, 30247, 35289, 40330, 45371, 50412, 55454, 60495, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 13
{0, 4681, 9362, 14043, 18725, 23406, 28087, 32768, 37449, 42130, 46811, 51493, 56174, 60855, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 14
{0, 4369, 8738, 13107, 17476, 21845, 26214, 30583, 34953, 39322, 43691, 48060, 52429, 56798, 61167, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 15
{0, 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 45056, 49152, 53248, 57344, 61440, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 16
{0, 3855, 7710, 11565, 15420, 19275, 23130, 26985, 30840, 34696, 38551, 42406, 46261, 50116, 53971, 57826, 61681, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 17
{0, 3641, 7282, 10923, 14564, 18204, 21845, 25486, 29127, 32768, 36409, 40050, 43691, 47332, 50972, 54613, 58254, 61895, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 18
{0, 3449, 6899, 10348, 13797, 17246, 20696, 24145, 27594, 31043, 34493, 37942, 41391, 44840, 48290, 51739, 55188, 58637, 62087, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 19
{0, 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 36045, 39322, 42598, 45875, 49152, 52429, 55706, 58982, 62259, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 20
{0, 3121, 6242, 9362, 12483, 15604, 18725, 21845, 24966, 28087, 31208, 34328, 37449, 40570, 43691, 46811, 49932, 53053, 56174, 59294, 62415, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 21
{0, 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 35747, 38726, 41705, 44684, 47663, 50641, 53620, 56599, 59578, 62557, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 22
{0, 2849, 5699, 8548, 11398, 14247, 17096, 19946, 22795, 25645, 28494, 31343, 34193, 37042, 39891, 42741, 45590, 48440, 51289, 54138, 56988, 59837, 62687, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 23
{0, 2731, 5461, 8192, 10923, 13653, 16384, 19115, 21845, 24576, 27307, 30037, 32768, 35499, 38229, 40960, 43691, 46421, 49152, 51883, 54613, 57344, 60075, 62805, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 24
{0, 2621, 5243, 7864, 10486, 13107, 15729, 18350, 20972, 23593, 26214, 28836, 31457, 34079, 36700, 39322, 41943, 44564, 47186, 49807, 52429, 55050, 57672, 60293, 62915, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 25
{0, 2521, 5041, 7562, 10082, 12603, 15124, 17644, 20165, 22686, 25206, 27727, 30247, 32768, 35289, 37809, 40330, 42850, 45371, 47892, 50412, 52933, 55454, 57974, 60495, 63015, 65536, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 26
{0, 2427, 4855, 7282, 9709, 12136, 14564, 16991, 19418, 21845, 24273, 26700, 29127, 31554, 33982, 36409, 38836, 41263, 43691, 46118, 48545, 50972, 53400, 55827, 58254, 60681, 63109, 65536, 65536, 65536, 65536, 65536, 65536}, // total_frames = 27
{0, 2341, 4681, 7022, 9362, 11703, 14043, 16384, 18725, 21065, 23406, 25746, 28087, 30427, 32768, 35109, 37449, 39790, 42130, 44471, 46811, 49152, 51493, 53833, 56174, 58514, 60855, 63195, 65536, 65536, 65536, 65536, 65536}, // total_frames = 28
{0, 2260, 4520, 6780, 9039, 11299, 13559, 15819, 18079, 20339, 22599, 24858, 27118, 29378, 31638, 33898, 36158, 38418, 40678, 42937, 45197, 47457, 49717, 51977, 54237, 56497, 58756, 61016, 63276, 65536, 65536, 65536, 65536}, // total_frames = 29
{0, 2185, 4369, 6554, 8738, 10923, 13107, 15292, 17476, 19661, 21845, 24030, 26214, 28399, 30583, 32768, 34953, 37137, 39322, 41506, 43691, 45875, 48060, 50244, 52429, 54613, 56798, 58982, 61167, 63351, 65536, 65536, 65536}, // total_frames = 30
{0, 2114, 4228, 6342, 8456, 10570, 12684, 14798, 16913, 19027, 21141, 23255, 25369, 27483, 29597, 31711, 33825, 35939, 38053, 40167, 42281, 44395, 46509, 48623, 50738, 52852, 54966, 57080, 59194, 61308, 63422, 65536, 65536}, // total_frames = 31
{0, 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624, 28672, 30720, 32768, 34816, 36864, 38912, 40960, 43008, 45056, 47104, 49152, 51200, 53248, 55296, 57344, 59392, 61440, 63488, 65536} // total_frames = 32
};
//--------------------------------------------------------------------+
// Jitter Pattern Tables
//
// Pre-generated pseudo-random jitter values for hand tremor simulation
// Values in 16.16 fixed-point, designed to sum to ~0 over cycles
//--------------------------------------------------------------------+
// X-axis jitter
const int32_t g_jitter_x_lut[JITTER_LUT_SIZE] = {
19024, 54491, 65220, 46341, 6424, -36410, -62714, -60547,
-30893, 12785, 50660, 65536, 50660, 12785, -30893, -60547,
-62714, -36410, 6424, 46341, 65220, 54491, 19024, -25080,
-57798, -64277, -41576, 0, 41576, 64277, 57798, 25080,
-19024, -54491, -65220, -46341, -6424, 36410, 62714, 60547,
30893, -12785, -50660, -65536, -50660, -12785, 30893, 60547,
62714, 36410, -6424, -46341, -65220, -54491, -19024, 25080,
57798, 64277, 41576, 0, -41576, -64277, -57798, -25080
};
// Y-axis jitter (different pattern for 2D realism)
const int32_t g_jitter_y_lut[JITTER_LUT_SIZE] = {
41576, 64277, 19024, -46341, -62714, -12785, 50660, 60547,
6424, -54491, -57798, 0, 57798, 54491, -6424, -60547,
-50660, 12785, 62714, 46341, -19024, -64277, -41576, 25080,
65220, 36410, -30893, -65536, -30893, 36410, 65220, 25080,
-41576, -64277, -19024, 46341, 62714, 12785, -50660, -60547,
-6424, 54491, 57798, 0, -57798, -54491, 6424, 60547,
50660, -12785, -62714, -46341, 19024, 64277, 41576, -25080,
-65220, -36410, 30893, 65536, 30893, -36410, -65220, -25080
};
// Jitter application masks - split into lo/hi 32-bit halves for RP2040 efficiency
// ~40% density with varying patterns to avoid repetition detection
// Low 32 bits (frames 0-31)
const uint32_t g_jitter_mask_lo_lut[4] = {
0x24924924, 0x92492492, 0x49249249, 0x12481248
};
// High 32 bits (frames 32-63)
const uint32_t g_jitter_mask_hi_lut[4] = {
0x09249249, 0x04924924, 0x02492492, 0x12481248
};
//--------------------------------------------------------------------+
// Quarter-Wave Sine Table
//
// sin(θ) for θ = 0 to π/2 in 64 steps
// Output in 16.16 fixed-point [0, 65536]
// Full sine reconstructed by mirroring
//--------------------------------------------------------------------+
const int32_t g_sine_quarter_lut[SINE_LUT_SIZE] = {
0, 1634, 3267, 4898, 6525, 8149, 9768, 11380,
12986, 14583, 16171, 17750, 19317, 20872, 22415, 23943,
25456, 26954, 28435, 29898, 31343, 32768, 34173, 35556,
36918, 38256, 39571, 40861, 42126, 43364, 44576, 45760,
46915, 48041, 49138, 50203, 51238, 52241, 53211, 54148,
55052, 55921, 56756, 57555, 58319, 59046, 59736, 60390,
61006, 61584, 62123, 62624, 63087, 63509, 63893, 64237,
64540, 64804, 65027, 65210, 65353, 65455, 65516, 65536
};
//--------------------------------------------------------------------+
// Overshoot Magnitude Table
//
// Pre-calculated overshoot amounts indexed by movement magnitude
// Larger movements have proportionally larger overshoots (realistic)
// Values in 16.16 fixed-point (0.25 to 2.0 pixels)
//--------------------------------------------------------------------+
const int32_t g_overshoot_lut[OVERSHOOT_LUT_SIZE] = {
16384, 24030, 31676, 39322, 46967, 54613, 62259, 69905,
77551, 85197, 92843, 100489, 108134, 115780, 123426, 131072
};
//--------------------------------------------------------------------+
// Acceleration/Deceleration Curve Table
//
// Natural movement velocity profile: slow start, fast middle, slow end
// Based on minimum-jerk trajectory: v(t) = 30*t²*(1-t)²
// Normalized with peak multiplier ~1.5
//--------------------------------------------------------------------+
const int32_t g_accel_curve_lut[ACCEL_LUT_SIZE] = {
0, 1533, 5729, 12017, 19865, 28783, 38320, 48069,
57661, 66769, 75107, 82431, 88535, 93256, 96471, 98100,
98100, 96471, 93256, 88535, 82431, 75107, 66769, 57661,
48069, 38320, 28783, 19865, 12017, 5729, 1533, 0
};
//--------------------------------------------------------------------+
// Sub-Pixel Dither Pattern
//
// Breaks up systematic patterns in fractional pixel accumulation
// Values sum to 0 over the full cycle to avoid drift
// Range: approximately ±0.25 pixels
//--------------------------------------------------------------------+
const int32_t g_subpixel_dither_lut[SUBPIXEL_DITHER_SIZE] = {
8192, -12288, 16384, -4096, -8192, 12288, -16384, 4096,
-4096, 16384, -8192, -12288, 8192, -16384, 12288, 4096
};
//--------------------------------------------------------------------+
// Movement-Type Jitter Scale LUT
//
// Tremor characteristics by movement type:
// Index 0-1 (0-20px): 0.8x-0.7x jitter (small, precise adjustments)
// Index 2-5 (20-60px): 0.7x-0.3x jitter (medium, controlled)
// Index 6-10 (60-110px): 0.3x-0.1x jitter (large, intentional)
// Index 11+ (110+px): 0.1x-0.05x jitter (fast flicks, tremor suppressed)
//--------------------------------------------------------------------+
const int32_t g_jitter_scale_by_movement_lut[JITTER_SCALE_LUT_SIZE] = {
98304, 88474, 78643, 68813, 58982, 49152, 39322, 34406,
29491, 24576, 19661, 17203, 14746, 12288, 9830, 9830,
9830, 9830, 9830, 9830, 9830, 9830, 9830, 9830,
9830, 9830, 9830, 9830, 9830, 9830, 9830, 9830
};
//--------------------------------------------------------------------+
// Movement-Type Frame Spread LUT
//
// Frame timing by movement type:
// Small movements: Spread over MORE frames (careful, precise)
// Large movements: Spread over FEWER frames (fast, ballistic)
//--------------------------------------------------------------------+
const int32_t g_frame_spread_by_movement_lut[FRAME_SPREAD_LUT_SIZE] = {
85197, 81920, 78643, 75366, 72090, 68813, 65536, 62259,
58982, 55706, 52429, 50790, 49152, 47514, 45875, 45875,
45875, 45875, 45875, 45875, 45875, 45875, 45875, 45875,
45875, 45875, 45875, 45875, 45875, 45875, 45875, 45875
};