Increased sin LUT precision: 16-bit x 2048 entries

This massively improves glitches in functions like sin(t + sin(t)), as
used in the RgbwPsychedelicAnimation. That animation is now almost
flicker-free.
This commit is contained in:
Thomas Kolb 2021-08-23 23:57:19 +02:00
parent 10892e1a29
commit 25abc446b0
9 changed files with 207 additions and 96 deletions

View File

@ -16,7 +16,7 @@ class RgbwPsychedelicAnimation : public Animation
int32_t tilt_maxperiods = 3,
uint32_t move_speed_divider = 1024,
uint32_t tilt_speed_divider = 8192,
uint16_t brightness_scale = 64); // max: 255
uint16_t brightness_scale = fasttrigon::SCALE/4); // max: fasttrigon::SCALE
void loop(uint64_t frame) override;

View File

@ -13,7 +13,7 @@ class RgbwSinusAnimation : public Animation
RgbwSinusAnimation(Fader *fader,
const rgbw_val_array &speeds = {2273, 2281, 2287, 2293},
uint32_t speed_divider = 1024,
uint16_t brightness_scale = 64); // max: 255
uint16_t brightness_scale = fasttrigon::SCALE/4); // max: 255
void loop(uint64_t frame) override;

View File

@ -14,8 +14,13 @@
#include <cstdint>
#define FASTTRIGON_8BIT(x) ((x) >> (fasttrigon::PRECISION_BITS - 8))
namespace fasttrigon {
static const uint32_t LUT_SIZE = 1024;
static const uint32_t LUT_SIZE = 2048;
static const uint32_t PRECISION_BITS = 11;
static const int32_t SCALE = 1023;
static const uint32_t UNIT_SHIFT = PRECISION_BITS-1;
/*!
* \returns 127 * sin(2π * arg / LUT_SIZE)

View File

@ -8,7 +8,6 @@ ConnectingAnimation::ConnectingAnimation(Fader *fader)
void ConnectingAnimation::loop(uint64_t frame)
{
std::size_t nled = m_fader->modules_per_strip();
std::size_t nstrip = m_fader->strips();
uint8_t intensity = 0;
@ -17,7 +16,7 @@ void ConnectingAnimation::loop(uint64_t frame)
}
for(std::size_t strip = 0; strip < nstrip; strip++) {
intensity = (fasttrigon::fastsin(1 * frame * fasttrigon::LUT_SIZE / 60 + fasttrigon::LUT_SIZE*3/4) + 127) / 4;
intensity = (FASTTRIGON_8BIT(fasttrigon::fastsin(1 * frame * fasttrigon::LUT_SIZE / 60 + fasttrigon::LUT_SIZE*3/4)) + 127) / 4;
Fader::Color c;
c.b = intensity;

View File

@ -28,8 +28,8 @@ void FireworkRocket::move(uint64_t frame)
case PHASE_SPREADING:
for(size_t i = 0; i < m_flareXPos.size(); i++) {
int speedX = fasttrigon::fastcos(fasttrigon::LUT_SIZE / 12 + i * fasttrigon::LUT_SIZE / m_flareXPos.size()) / 2;
int speedY = fasttrigon::fastsin(fasttrigon::LUT_SIZE / 12 + i * fasttrigon::LUT_SIZE / m_flareXPos.size()) / 2;
int speedX = FASTTRIGON_8BIT(fasttrigon::fastcos(fasttrigon::LUT_SIZE / 12 + i * fasttrigon::LUT_SIZE / m_flareXPos.size())) / 2;
int speedY = FASTTRIGON_8BIT(fasttrigon::fastsin(fasttrigon::LUT_SIZE / 12 + i * fasttrigon::LUT_SIZE / m_flareXPos.size())) / 2;
m_flareXPos[i] += speedX;
m_flareYPos[i] += speedY;

View File

@ -1,5 +1,7 @@
#include <algorithm>
//#include <iostream>
#include "Animation/RgbwPsychedelicAnimation.h"
RgbwPsychedelicAnimation::RgbwPsychedelicAnimation(Fader *fader,
@ -16,8 +18,8 @@ RgbwPsychedelicAnimation::RgbwPsychedelicAnimation(Fader *fader,
m_tiltSpeedDivider(tilt_speed_divider),
m_brightnessScale(brightness_scale),
m_tilt_maxperiods(tilt_maxperiods),
m_move_phi{0,0,0,0},
m_tilt_phi{100,200,300,400},
m_move_phi{800,600,400,200},
m_tilt_phi{200,400,600,800},
m_moveOverflowInterval(fasttrigon::LUT_SIZE * move_speed_divider),
m_tiltOverflowInterval(fasttrigon::LUT_SIZE * tilt_speed_divider)
{
@ -57,17 +59,20 @@ void RgbwPsychedelicAnimation::loop(uint64_t frame)
int32_t y = fasttrigon::LUT_SIZE * strip / nstrip;
rgbw_val_array rgbw {
(127 + fasttrigon::fastsin(m_move_phi[0] / m_moveSpeedDivider + ((x * tilt_nperiods[0]) >> 7) + y)),
(127 + fasttrigon::fastsin(m_move_phi[1] / m_moveSpeedDivider + ((x * tilt_nperiods[1]) >> 7) + y)),
(127 + fasttrigon::fastsin(m_move_phi[2] / m_moveSpeedDivider + ((x * tilt_nperiods[2]) >> 7) + y)),
(127 + fasttrigon::fastsin(m_move_phi[3] / m_moveSpeedDivider + ((x * tilt_nperiods[3]) >> 7) + y))
(fasttrigon::SCALE + fasttrigon::fastsin(m_move_phi[0] / m_moveSpeedDivider + ((x * tilt_nperiods[0]) >> fasttrigon::UNIT_SHIFT) + y)),
(fasttrigon::SCALE + fasttrigon::fastsin(m_move_phi[1] / m_moveSpeedDivider + ((x * tilt_nperiods[1]) >> fasttrigon::UNIT_SHIFT) + y)),
(fasttrigon::SCALE + fasttrigon::fastsin(m_move_phi[2] / m_moveSpeedDivider + ((x * tilt_nperiods[2]) >> fasttrigon::UNIT_SHIFT) + y)),
(fasttrigon::SCALE + fasttrigon::fastsin(m_move_phi[3] / m_moveSpeedDivider + ((x * tilt_nperiods[3]) >> fasttrigon::UNIT_SHIFT) + y))
};
Fader::Color color{
static_cast<int16_t>(((rgbw[0] * rgbw[0] >> 7) * m_brightnessScale) >> 8),
static_cast<int16_t>(((rgbw[1] * rgbw[1] >> 7) * m_brightnessScale) >> 8),
static_cast<int16_t>(((rgbw[2] * rgbw[2] >> 7) * m_brightnessScale) >> 8),
static_cast<int16_t>(((rgbw[3] * rgbw[3] >> 7) * m_brightnessScale) >> 10)}; // white is too bright otherwise
static_cast<int16_t>((FASTTRIGON_8BIT(rgbw[0] * rgbw[0] >> fasttrigon::UNIT_SHIFT) * m_brightnessScale) >> fasttrigon::PRECISION_BITS),
static_cast<int16_t>((FASTTRIGON_8BIT(rgbw[1] * rgbw[1] >> fasttrigon::UNIT_SHIFT) * m_brightnessScale) >> fasttrigon::PRECISION_BITS),
static_cast<int16_t>((FASTTRIGON_8BIT(rgbw[2] * rgbw[2] >> fasttrigon::UNIT_SHIFT) * m_brightnessScale) >> fasttrigon::PRECISION_BITS),
static_cast<int16_t>((FASTTRIGON_8BIT(rgbw[3] * rgbw[3] >> fasttrigon::UNIT_SHIFT) * m_brightnessScale) >> (fasttrigon::PRECISION_BITS + 2))}; // white is too bright otherwise
//std::cerr << rgbw[0] << " " << rgbw[1] << " " << rgbw[2] << " " << rgbw[3] << std::endl;
//std::cerr << color.r << " " << color.g << " " << color.b << " " << color.w << std::endl;
m_fader->set_color(strip, led, color);
}

View File

@ -35,10 +35,10 @@ void RgbwSinusAnimation::loop(uint64_t frame)
uint32_t pixelphase = led * fasttrigon::LUT_SIZE / nled + strip * fasttrigon::LUT_SIZE / nstrip;
Fader::Color color{
static_cast<int16_t>(((127 + fasttrigon::fastsin(m_phi[0] / m_speedDivider + pixelphase)) * m_brightnessScale) >> 8),
static_cast<int16_t>(((127 + fasttrigon::fastsin(m_phi[1] / m_speedDivider + pixelphase)) * m_brightnessScale) >> 8),
static_cast<int16_t>(((127 + fasttrigon::fastsin(m_phi[2] / m_speedDivider + pixelphase)) * m_brightnessScale) >> 8),
static_cast<int16_t>(((127 + fasttrigon::fastsin(m_phi[3] / m_speedDivider + pixelphase)) * m_brightnessScale) >> 9)}; // white is too bright otherwise
static_cast<int16_t>(((fasttrigon::SCALE + fasttrigon::fastsin(m_phi[0] / m_speedDivider + pixelphase)) * m_brightnessScale) >> fasttrigon::PRECISION_BITS),
static_cast<int16_t>(((fasttrigon::SCALE + fasttrigon::fastsin(m_phi[1] / m_speedDivider + pixelphase)) * m_brightnessScale) >> fasttrigon::PRECISION_BITS),
static_cast<int16_t>(((fasttrigon::SCALE + fasttrigon::fastsin(m_phi[2] / m_speedDivider + pixelphase)) * m_brightnessScale) >> fasttrigon::PRECISION_BITS),
static_cast<int16_t>(((fasttrigon::SCALE + fasttrigon::fastsin(m_phi[3] / m_speedDivider + pixelphase)) * m_brightnessScale) >> (fasttrigon::PRECISION_BITS + 2))}; // white is too bright otherwise
m_fader->set_color(strip, led, color);
}

View File

@ -23,7 +23,7 @@ void SnowfallAnimation::SnowFlake::move(void)
m_phase -= fasttrigon::LUT_SIZE;
}
m_posStrip = m_basePosStrip + 2*fasttrigon::fastsin(m_phase);
m_posStrip = m_basePosStrip + FASTTRIGON_8BIT(2*fasttrigon::fastsin(m_phase));
m_posLED -= m_vertSpeed;
}

View File

@ -3,80 +3,182 @@
#include "fasttrigon.h"
namespace fasttrigon {
static const std::array<int8_t, LUT_SIZE> LUT {
0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 16,
16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26, 26, 27, 28, 29,
29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 41,
42, 43, 44, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 51, 52, 53, 54,
54, 55, 56, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65,
66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 72, 73, 74, 74, 75, 76, 76,
77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 86,
87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 95, 96,
96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 102, 103,
103, 104, 104, 105, 105, 106, 106, 106, 107, 107, 108, 108, 109, 109,
109, 110, 110, 111, 111, 111, 112, 112, 112, 113, 113, 113, 114, 114,
114, 115, 115, 115, 116, 116, 116, 117, 117, 117, 118, 118, 118, 118,
119, 119, 119, 120, 120, 120, 120, 121, 121, 121, 121, 122, 122, 122,
122, 122, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 125,
125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124,
123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 121, 121, 121, 121,
120, 120, 120, 120, 119, 119, 119, 118, 118, 118, 118, 117, 117, 117,
116, 116, 116, 115, 115, 115, 114, 114, 114, 113, 113, 113, 112, 112,
112, 111, 111, 111, 110, 110, 109, 109, 109, 108, 108, 107, 107, 106,
106, 106, 105, 105, 104, 104, 103, 103, 102, 102, 102, 101, 101, 100,
100, 99, 99, 98, 98, 97, 97, 96, 96, 95, 95, 94, 94, 93, 93, 92, 91,
91, 90, 90, 89, 89, 88, 88, 87, 86, 86, 85, 85, 84, 84, 83, 82, 82,
81, 81, 80, 79, 79, 78, 78, 77, 76, 76, 75, 74, 74, 73, 72, 72, 71,
71, 70, 69, 69, 68, 67, 67, 66, 65, 65, 64, 63, 63, 62, 61, 61, 60,
59, 58, 58, 57, 56, 56, 55, 54, 54, 53, 52, 51, 51, 50, 49, 49, 48,
47, 46, 46, 45, 44, 44, 43, 42, 41, 41, 40, 39, 38, 38, 37, 36, 35,
35, 34, 33, 32, 32, 31, 30, 29, 29, 28, 27, 26, 26, 25, 24, 23, 22,
22, 21, 20, 19, 19, 18, 17, 16, 16, 15, 14, 13, 12, 12, 11, 10, 9, 9,
8, 7, 6, 5, 5, 4, 3, 2, 2, 1, 0, -1, -2, -2, -3, -4, -5, -5, -6, -7,
-8, -9, -9, -10, -11, -12, -12, -13, -14, -15, -16, -16, -17, -18,
-19, -19, -20, -21, -22, -22, -23, -24, -25, -26, -26, -27, -28, -29,
-29, -30, -31, -32, -32, -33, -34, -35, -35, -36, -37, -38, -38, -39,
-40, -41, -41, -42, -43, -44, -44, -45, -46, -46, -47, -48, -49, -49,
-50, -51, -51, -52, -53, -54, -54, -55, -56, -56, -57, -58, -58, -59,
-60, -61, -61, -62, -63, -63, -64, -65, -65, -66, -67, -67, -68, -69,
-69, -70, -71, -71, -72, -72, -73, -74, -74, -75, -76, -76, -77, -78,
-78, -79, -79, -80, -81, -81, -82, -82, -83, -84, -84, -85, -85, -86,
-86, -87, -88, -88, -89, -89, -90, -90, -91, -91, -92, -93, -93, -94,
-94, -95, -95, -96, -96, -97, -97, -98, -98, -99, -99, -100, -100,
-101, -101, -102, -102, -102, -103, -103, -104, -104, -105, -105,
-106, -106, -106, -107, -107, -108, -108, -109, -109, -109, -110,
-110, -111, -111, -111, -112, -112, -112, -113, -113, -113, -114,
-114, -114, -115, -115, -115, -116, -116, -116, -117, -117, -117,
-118, -118, -118, -118, -119, -119, -119, -120, -120, -120, -120,
-121, -121, -121, -121, -122, -122, -122, -122, -122, -123, -123,
-123, -123, -123, -124, -124, -124, -124, -124, -124, -125, -125,
-125, -125, -125, -125, -125, -126, -126, -126, -126, -126, -126,
-126, -126, -126, -126, -126, -127, -127, -127, -127, -127, -127,
-127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
-127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
-127, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
-126, -125, -125, -125, -125, -125, -125, -125, -124, -124, -124,
-124, -124, -124, -123, -123, -123, -123, -123, -122, -122, -122,
-122, -122, -121, -121, -121, -121, -120, -120, -120, -120, -119,
-119, -119, -118, -118, -118, -118, -117, -117, -117, -116, -116,
-116, -115, -115, -115, -114, -114, -114, -113, -113, -113, -112,
-112, -112, -111, -111, -111, -110, -110, -109, -109, -109, -108,
-108, -107, -107, -106, -106, -106, -105, -105, -104, -104, -103,
-103, -102, -102, -102, -101, -101, -100, -100, -99, -99, -98, -98,
-97, -97, -96, -96, -95, -95, -94, -94, -93, -93, -92, -91, -91, -90,
-90, -89, -89, -88, -88, -87, -86, -86, -85, -85, -84, -84, -83, -82,
-82, -81, -81, -80, -79, -79, -78, -78, -77, -76, -76, -75, -74, -74,
-73, -72, -72, -71, -71, -70, -69, -69, -68, -67, -67, -66, -65, -65,
-64, -63, -63, -62, -61, -61, -60, -59, -58, -58, -57, -56, -56, -55,
-54, -54, -53, -52, -51, -51, -50, -49, -49, -48, -47, -46, -46, -45,
-44, -44, -43, -42, -41, -41, -40, -39, -38, -38, -37, -36, -35, -35,
-34, -33, -32, -32, -31, -30, -29, -29, -28, -27, -26, -26, -25, -24,
-23, -22, -22, -21, -20, -19, -19, -18, -17, -16, -16, -15, -14, -13,
-12, -12, -11, -10, -9, -9, -8, -7, -6, -5, -5, -4, -3, -2, -2, -1
static const std::array<int16_t, LUT_SIZE> LUT {
0, 3, 6, 9, 12, 15, 18, 21, 25, 28, 31, 34, 37, 40, 43, 47, 50, 53, 56,
59, 62, 65, 68, 72, 75, 78, 81, 84, 87, 90, 94, 97, 100, 103, 106,
109, 112, 115, 118, 122, 125, 128, 131, 134, 137, 140, 143, 147,
150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 181, 184, 187,
190, 193, 196, 199, 202, 205, 208, 211, 214, 218, 221, 224, 227,
230, 233, 236, 239, 242, 245, 248, 251, 254, 257, 260, 263, 266,
269, 272, 275, 278, 281, 284, 287, 290, 293, 296, 299, 302, 305,
308, 311, 314, 317, 320, 323, 326, 329, 332, 335, 338, 341, 344,
347, 350, 353, 356, 359, 362, 365, 368, 371, 374, 376, 379, 382,
385, 388, 391, 394, 397, 400, 403, 405, 408, 411, 414, 417, 420,
423, 426, 428, 431, 434, 437, 440, 443, 445, 448, 451, 454, 457,
459, 462, 465, 468, 471, 473, 476, 479, 482, 485, 487, 490, 493,
496, 498, 501, 504, 506, 509, 512, 515, 517, 520, 523, 525, 528,
531, 533, 536, 539, 541, 544, 547, 549, 552, 555, 557, 560, 563,
565, 568, 570, 573, 576, 578, 581, 583, 586, 589, 591, 594, 596,
599, 601, 604, 606, 609, 611, 614, 616, 619, 621, 624, 626, 629,
631, 634, 636, 639, 641, 644, 646, 648, 651, 653, 656, 658, 661,
663, 665, 668, 670, 672, 675, 677, 679, 682, 684, 687, 689, 691,
693, 696, 698, 700, 703, 705, 707, 709, 712, 714, 716, 718, 721,
723, 725, 727, 729, 732, 734, 736, 738, 740, 743, 745, 747, 749,
751, 753, 755, 757, 760, 762, 764, 766, 768, 770, 772, 774, 776,
778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802,
804, 806, 808, 810, 812, 814, 816, 817, 819, 821, 823, 825, 827,
829, 830, 832, 834, 836, 838, 839, 841, 843, 845, 847, 848, 850,
852, 854, 855, 857, 859, 860, 862, 864, 865, 867, 869, 870, 872,
874, 875, 877, 879, 880, 882, 883, 885, 886, 888, 890, 891, 893,
894, 896, 897, 899, 900, 902, 903, 905, 906, 908, 909, 910, 912,
913, 915, 916, 917, 919, 920, 922, 923, 924, 926, 927, 928, 930,
931, 932, 933, 935, 936, 937, 939, 940, 941, 942, 943, 945, 946,
947, 948, 949, 951, 952, 953, 954, 955, 956, 957, 958, 959, 961,
962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974,
975, 976, 977, 978, 978, 979, 980, 981, 982, 983, 984, 985, 985,
986, 987, 988, 989, 990, 990, 991, 992, 993, 993, 994, 995, 996,
996, 997, 998, 998, 999, 1000, 1000, 1001, 1002, 1002, 1003, 1003,
1004, 1005, 1005, 1006, 1006, 1007, 1007, 1008, 1008, 1009, 1010,
1010, 1010, 1011, 1011, 1012, 1012, 1013, 1013, 1014, 1014, 1014,
1015, 1015, 1016, 1016, 1016, 1017, 1017, 1017, 1018, 1018, 1018,
1018, 1019, 1019, 1019, 1019, 1020, 1020, 1020, 1020, 1021, 1021,
1021, 1021, 1021, 1021, 1022, 1022, 1022, 1022, 1022, 1022, 1022,
1022, 1022, 1022, 1022, 1022, 1022, 1022, 1023, 1022, 1022, 1022,
1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022,
1021, 1021, 1021, 1021, 1021, 1021, 1020, 1020, 1020, 1020, 1019,
1019, 1019, 1019, 1018, 1018, 1018, 1018, 1017, 1017, 1017, 1016,
1016, 1016, 1015, 1015, 1014, 1014, 1014, 1013, 1013, 1012, 1012,
1011, 1011, 1010, 1010, 1010, 1009, 1008, 1008, 1007, 1007, 1006,
1006, 1005, 1005, 1004, 1003, 1003, 1002, 1002, 1001, 1000, 1000,
999, 998, 998, 997, 996, 996, 995, 994, 993, 993, 992, 991, 990,
990, 989, 988, 987, 986, 985, 985, 984, 983, 982, 981, 980, 979,
978, 978, 977, 976, 975, 974, 973, 972, 971, 970, 969, 968, 967,
966, 965, 964, 963, 962, 961, 959, 958, 957, 956, 955, 954, 953,
952, 951, 949, 948, 947, 946, 945, 943, 942, 941, 940, 939, 937,
936, 935, 933, 932, 931, 930, 928, 927, 926, 924, 923, 922, 920,
919, 917, 916, 915, 913, 912, 910, 909, 908, 906, 905, 903, 902,
900, 899, 897, 896, 894, 893, 891, 890, 888, 886, 885, 883, 882,
880, 879, 877, 875, 874, 872, 870, 869, 867, 865, 864, 862, 860,
859, 857, 855, 854, 852, 850, 848, 847, 845, 843, 841, 839, 838,
836, 834, 832, 830, 829, 827, 825, 823, 821, 819, 817, 816, 814,
812, 810, 808, 806, 804, 802, 800, 798, 796, 794, 792, 790, 788,
786, 784, 782, 780, 778, 776, 774, 772, 770, 768, 766, 764, 762,
760, 757, 755, 753, 751, 749, 747, 745, 743, 740, 738, 736, 734,
732, 729, 727, 725, 723, 721, 718, 716, 714, 712, 709, 707, 705,
703, 700, 698, 696, 693, 691, 689, 687, 684, 682, 679, 677, 675,
672, 670, 668, 665, 663, 661, 658, 656, 653, 651, 648, 646, 644,
641, 639, 636, 634, 631, 629, 626, 624, 621, 619, 616, 614, 611,
609, 606, 604, 601, 599, 596, 594, 591, 589, 586, 583, 581, 578,
576, 573, 570, 568, 565, 563, 560, 557, 555, 552, 549, 547, 544,
541, 539, 536, 533, 531, 528, 525, 523, 520, 517, 515, 512, 509,
506, 504, 501, 498, 496, 493, 490, 487, 485, 482, 479, 476, 473,
471, 468, 465, 462, 459, 457, 454, 451, 448, 445, 443, 440, 437,
434, 431, 428, 426, 423, 420, 417, 414, 411, 408, 405, 403, 400,
397, 394, 391, 388, 385, 382, 379, 376, 374, 371, 368, 365, 362,
359, 356, 353, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323,
320, 317, 314, 311, 308, 305, 302, 299, 296, 293, 290, 287, 284,
281, 278, 275, 272, 269, 266, 263, 260, 257, 254, 251, 248, 245,
242, 239, 236, 233, 230, 227, 224, 221, 218, 214, 211, 208, 205,
202, 199, 196, 193, 190, 187, 184, 181, 177, 174, 171, 168, 165,
162, 159, 156, 153, 150, 147, 143, 140, 137, 134, 131, 128, 125,
122, 118, 115, 112, 109, 106, 103, 100, 97, 94, 90, 87, 84, 81, 78,
75, 72, 68, 65, 62, 59, 56, 53, 50, 47, 43, 40, 37, 34, 31, 28, 25,
21, 18, 15, 12, 9, 6, 3, 0, -3, -6, -9, -12, -15, -18, -21, -25,
-28, -31, -34, -37, -40, -43, -47, -50, -53, -56, -59, -62, -65,
-68, -72, -75, -78, -81, -84, -87, -90, -94, -97, -100, -103, -106,
-109, -112, -115, -118, -122, -125, -128, -131, -134, -137, -140,
-143, -147, -150, -153, -156, -159, -162, -165, -168, -171, -174,
-177, -181, -184, -187, -190, -193, -196, -199, -202, -205, -208,
-211, -214, -218, -221, -224, -227, -230, -233, -236, -239, -242,
-245, -248, -251, -254, -257, -260, -263, -266, -269, -272, -275,
-278, -281, -284, -287, -290, -293, -296, -299, -302, -305, -308,
-311, -314, -317, -320, -323, -326, -329, -332, -335, -338, -341,
-344, -347, -350, -353, -356, -359, -362, -365, -368, -371, -374,
-376, -379, -382, -385, -388, -391, -394, -397, -400, -403, -405,
-408, -411, -414, -417, -420, -423, -426, -428, -431, -434, -437,
-440, -443, -445, -448, -451, -454, -457, -459, -462, -465, -468,
-471, -473, -476, -479, -482, -485, -487, -490, -493, -496, -498,
-501, -504, -506, -509, -512, -515, -517, -520, -523, -525, -528,
-531, -533, -536, -539, -541, -544, -547, -549, -552, -555, -557,
-560, -563, -565, -568, -570, -573, -576, -578, -581, -583, -586,
-589, -591, -594, -596, -599, -601, -604, -606, -609, -611, -614,
-616, -619, -621, -624, -626, -629, -631, -634, -636, -639, -641,
-644, -646, -648, -651, -653, -656, -658, -661, -663, -665, -668,
-670, -672, -675, -677, -679, -682, -684, -687, -689, -691, -693,
-696, -698, -700, -703, -705, -707, -709, -712, -714, -716, -718,
-721, -723, -725, -727, -729, -732, -734, -736, -738, -740, -743,
-745, -747, -749, -751, -753, -755, -757, -760, -762, -764, -766,
-768, -770, -772, -774, -776, -778, -780, -782, -784, -786, -788,
-790, -792, -794, -796, -798, -800, -802, -804, -806, -808, -810,
-812, -814, -816, -817, -819, -821, -823, -825, -827, -829, -830,
-832, -834, -836, -838, -839, -841, -843, -845, -847, -848, -850,
-852, -854, -855, -857, -859, -860, -862, -864, -865, -867, -869,
-870, -872, -874, -875, -877, -879, -880, -882, -883, -885, -886,
-888, -890, -891, -893, -894, -896, -897, -899, -900, -902, -903,
-905, -906, -908, -909, -910, -912, -913, -915, -916, -917, -919,
-920, -922, -923, -924, -926, -927, -928, -930, -931, -932, -933,
-935, -936, -937, -939, -940, -941, -942, -943, -945, -946, -947,
-948, -949, -951, -952, -953, -954, -955, -956, -957, -958, -959,
-961, -962, -963, -964, -965, -966, -967, -968, -969, -970, -971,
-972, -973, -974, -975, -976, -977, -978, -978, -979, -980, -981,
-982, -983, -984, -985, -985, -986, -987, -988, -989, -990, -990,
-991, -992, -993, -993, -994, -995, -996, -996, -997, -998, -998,
-999, -1000, -1000, -1001, -1002, -1002, -1003, -1003, -1004,
-1005, -1005, -1006, -1006, -1007, -1007, -1008, -1008, -1009,
-1010, -1010, -1010, -1011, -1011, -1012, -1012, -1013, -1013,
-1014, -1014, -1014, -1015, -1015, -1016, -1016, -1016, -1017,
-1017, -1017, -1018, -1018, -1018, -1018, -1019, -1019, -1019,
-1019, -1020, -1020, -1020, -1020, -1021, -1021, -1021, -1021,
-1021, -1021, -1022, -1022, -1022, -1022, -1022, -1022, -1022,
-1022, -1022, -1022, -1022, -1022, -1022, -1022, -1023, -1022,
-1022, -1022, -1022, -1022, -1022, -1022, -1022, -1022, -1022,
-1022, -1022, -1022, -1022, -1021, -1021, -1021, -1021, -1021,
-1021, -1020, -1020, -1020, -1020, -1019, -1019, -1019, -1019,
-1018, -1018, -1018, -1018, -1017, -1017, -1017, -1016, -1016,
-1016, -1015, -1015, -1014, -1014, -1014, -1013, -1013, -1012,
-1012, -1011, -1011, -1010, -1010, -1010, -1009, -1008, -1008,
-1007, -1007, -1006, -1006, -1005, -1005, -1004, -1003, -1003,
-1002, -1002, -1001, -1000, -1000, -999, -998, -998, -997, -996,
-996, -995, -994, -993, -993, -992, -991, -990, -990, -989, -988,
-987, -986, -985, -985, -984, -983, -982, -981, -980, -979, -978,
-978, -977, -976, -975, -974, -973, -972, -971, -970, -969, -968,
-967, -966, -965, -964, -963, -962, -961, -959, -958, -957, -956,
-955, -954, -953, -952, -951, -949, -948, -947, -946, -945, -943,
-942, -941, -940, -939, -937, -936, -935, -933, -932, -931, -930,
-928, -927, -926, -924, -923, -922, -920, -919, -917, -916, -915,
-913, -912, -910, -909, -908, -906, -905, -903, -902, -900, -899,
-897, -896, -894, -893, -891, -890, -888, -886, -885, -883, -882,
-880, -879, -877, -875, -874, -872, -870, -869, -867, -865, -864,
-862, -860, -859, -857, -855, -854, -852, -850, -848, -847, -845,
-843, -841, -839, -838, -836, -834, -832, -830, -829, -827, -825,
-823, -821, -819, -817, -816, -814, -812, -810, -808, -806, -804,
-802, -800, -798, -796, -794, -792, -790, -788, -786, -784, -782,
-780, -778, -776, -774, -772, -770, -768, -766, -764, -762, -760,
-757, -755, -753, -751, -749, -747, -745, -743, -740, -738, -736,
-734, -732, -729, -727, -725, -723, -721, -718, -716, -714, -712,
-709, -707, -705, -703, -700, -698, -696, -693, -691, -689, -687,
-684, -682, -679, -677, -675, -672, -670, -668, -665, -663, -661,
-658, -656, -653, -651, -648, -646, -644, -641, -639, -636, -634,
-631, -629, -626, -624, -621, -619, -616, -614, -611, -609, -606,
-604, -601, -599, -596, -594, -591, -589, -586, -583, -581, -578,
-576, -573, -570, -568, -565, -563, -560, -557, -555, -552, -549,
-547, -544, -541, -539, -536, -533, -531, -528, -525, -523, -520,
-517, -515, -512, -509, -506, -504, -501, -498, -496, -493, -490,
-487, -485, -482, -479, -476, -473, -471, -468, -465, -462, -459,
-457, -454, -451, -448, -445, -443, -440, -437, -434, -431, -428,
-426, -423, -420, -417, -414, -411, -408, -405, -403, -400, -397,
-394, -391, -388, -385, -382, -379, -376, -374, -371, -368, -365,
-362, -359, -356, -353, -350, -347, -344, -341, -338, -335, -332,
-329, -326, -323, -320, -317, -314, -311, -308, -305, -302, -299,
-296, -293, -290, -287, -284, -281, -278, -275, -272, -269, -266,
-263, -260, -257, -254, -251, -248, -245, -242, -239, -236, -233,
-230, -227, -224, -221, -218, -214, -211, -208, -205, -202, -199,
-196, -193, -190, -187, -184, -181, -177, -174, -171, -168, -165,
-162, -159, -156, -153, -150, -147, -143, -140, -137, -134, -131,
-128, -125, -122, -118, -115, -112, -109, -106, -103, -100, -97,
-94, -90, -87, -84, -81, -78, -75, -72, -68, -65, -62, -59, -56,
-53, -50, -47, -43, -40, -37, -34, -31, -28, -25, -21, -18, -15,
-12, -9, -6, -3
};
int32_t fastsin(int32_t arg)