44 {
47
48
49
50
51
52
53 struct FadeLut {
54 int32_t table[257];
56 };
57 static const FadeLut fade_lut_holder;
58 const int32_t* fade_lut = fade_lut_holder.table;
59
60 constexpr int GRID = 16;
61 constexpr float STEP_F = 0.05f;
62
63 constexpr int32_t STEP_I = static_cast<int32_t>(0.05f * 65536.0f);
64
65
66 {
67 float ax = 0.0f, ay = 0.0f;
68 int32_t sink = 0;
69 uint32_t t0 = micros();
70 for (int it = 0; it < iters; it++) {
71
72
73
74 ax += 0.011f;
75 ay += 0.013f;
76 for (int row = 0; row < GRID; row++) {
77 float y = ay + row * STEP_F;
78 for (int col = 0; col < GRID; col++) {
79 float x = ax + col * STEP_F;
81
82
83 sink += static_cast<int32_t>(n * 127.0f);
84 }
85 }
86 }
90 }
91
92
93 {
95
96 constexpr int32_t DRIFT_X =
static_cast<int32_t>(0.011f * 65536.0f);
97 constexpr int32_t DRIFT_Y =
static_cast<int32_t>(0.013f * 65536.0f);
100 for (int it = 0; it < iters; it++) {
101 ax_i += DRIFT_X;
102 ay_i += DRIFT_Y;
103 for (int row = 0; row < GRID; row++) {
104 int32_t y_i = ay_i + row * STEP_I;
105 for (int col = 0; col < GRID; col++) {
106 int32_t x_i = ax_i + col * STEP_I;
107
108
109
111 x_i, y_i, fade_lut, fl::PERLIN_NOISE);
112 sink += n >> 9;
113
114 }
115 }
116 }
120 }
121
122 return r;
123}
static volatile int32_t g_animartrix_bench_sink
fl::u32 micros()
Universal microsecond timer - returns microseconds since system startup.
FASTLED_FORCE_INLINE float pnoise(float x, float y, float z)
static void init_fade_lut(fl::i32 *table)
static fl::i32 pnoise2d_raw(fl::i32 fx_raw, fl::i32 fy_raw, const fl::i32 *fade_lut, const fl::u8 *perm)