15 for (
int i = 0; i <= 256; i++) {
18 fl::i32 t3 =
static_cast<fl::i32
>((
static_cast<fl::i64>(t2) *
t) >>
HP_BITS);
21 inner =
static_cast<fl::i32
>((
static_cast<fl::i64>(
t) * inner) >>
HP_BITS);
23 table[i] =
static_cast<fl::i32
>((
static_cast<fl::i64>(t3) * inner) >>
HP_BITS);
28 const fl::i32 *fade_lut,
35 const fl::i32 *fade_lut,
46 fl::i32 u =
fade(x16, fade_lut);
47 fl::i32 v =
fade(y16, fade_lut);
49 int A = perm[X & 255] + Y;
50 int AA = perm[A & 255];
51 int AB = perm[(A + 1) & 255];
52 int B = perm[(X + 1) & 255] + Y;
53 int BA = perm[
B & 255];
54 int BB = perm[(
B + 1) & 255];
57 fl::i32 g00 =
grad_i16(perm[AA & 255], x16, y16);
63 fl::i32 lerp0 =
lerp(u, g00, g10);
64 fl::i32 lerp1 =
lerp(u, g01, g11);
72 frac16 =
static_cast<fl::i16
>(fp16 & (
FP_ONE - 1));
76 fl::u32 idx =
static_cast<fl::u32
>(
t) >> 8;
77 fl::i32 frac =
t & 0xFF;
78 fl::i32 a = table[idx];
79 fl::i32 b = table[idx + 1];
80 return a + ((
static_cast<fl::i32
>(frac << 8) * (b - a)) >> 16);
84 return a +
static_cast<fl::i32
>(
90 constexpr GradCoeff lut[16] = {
91 { 1, 1}, {-1, 1}, { 1, -1}, {-1, -1},
92 { 1, 0}, {-1, 0}, { 1, 0}, {-1, 0},
93 { 0, 1}, { 0, -1}, { 0, 1}, { 0, -1},
94 { 1, 1}, { 0, -1}, {-1, 1}, { 0, -1},
96 const GradCoeff &g = lut[hash & 15];
98 return static_cast<fl::i32
>(g.cx *
x) +
static_cast<fl::i32
>(g.cy *
y);
static constexpr FASTLED_FORCE_INLINE s16x16 from_raw(i32 raw) FL_NOEXCEPT
constexpr i32 raw() const FL_NOEXCEPT
FL_DISABLE_WARNING_PUSH unsigned char * B
expected< T, E > result
Alias for expected (Rust-style naming)
Base definition for an LED controller.
#define FL_OPTIMIZATION_LEVEL_O3_BEGIN
#define FASTLED_FORCE_INLINE
#define FL_OPTIMIZATION_LEVEL_O3_END
static FASTLED_FORCE_INLINE void floor_frac_i16(fl::i32 fp16, int &ifloor, fl::i16 &frac16)
static constexpr fl::i32 HP_ONE
static constexpr int HP_BITS
static constexpr fl::i32 FP_ONE
static constexpr fl::i32 HP_ONE_I16
static void init_fade_lut(fl::i32 *table)
static FASTLED_FORCE_INLINE fl::i32 grad_i16(int hash, fl::i16 x, fl::i16 y)
static fl::i32 pnoise2d_raw(fl::i32 fx_raw, fl::i32 fy_raw, const fl::i32 *fade_lut, const fl::u8 *perm)
static constexpr int FP_BITS
static fl::s16x16 pnoise2d(fl::s16x16 fx, fl::s16x16 fy, const fl::i32 *fade_lut, const fl::u8 *perm)
static FASTLED_FORCE_INLINE fl::i32 lerp(fl::i32 t, fl::i32 a, fl::i32 b)
static FASTLED_FORCE_INLINE fl::i32 fade(fl::i16 t, const fl::i32 *table)