.TH "ttypt/noise.h" 3 "chaff" \" -*- nroff -*- .ad l .nh .SH NAME ttypt/noise.h \- Standalone generic N-dimensional wrapping procedural noise engine, dense matrix stepper, point sampler, and multi-octave cascade API\&. .SH SYNOPSIS .br .PP \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br .SS "Data Structures" .in +1c .ti -1c .RI "struct \fBoctave_t\fP" .br .RI "Single octave descriptor for dense matrix stepping (edge shift and value shift)\&. " .ti -1c .RI "struct \fBnoise_wcache_t\fP" .br .ti -1c .RI "struct \fBchaff_coord_t\fP" .br .ti -1c .RI "struct \fBchaff_layer_t\fP" .br .ti -1c .RI "struct \fBchaff_field_t\fP" .br .ti -1c .RI "struct \fBnoise_octave_t\fP" .br .ti -1c .RI "struct \fBnoise_cascade_t\fP" .br .ti -1c .RI "struct \fBnoise_scanline_t\fP" .br .RI "Reusable scanline evaluation context holding per-octave corner caches\&. " .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBNOISE_FAST_XXH32_4B\fP 0" .br .RI "Set to 1 when the inlined 4-byte XXH32 fast path is active\&. " .ti -1c .RI "#define \fBNOISE_MAX\fP ((uint32_t) \-1)" .br .RI "Maximum unsigned 32-bit raw noise value (UINT32_MAX)\&. " .ti -1c .RI "#define \fBNOISE_MAX_DIM\fP 4u" .br .RI "Maximum supported spatial dimensionality for noise queries (4)\&. " .ti -1c .RI "#define \fBNOISE_DEFAULT_VSHIFT\fP 8u" .br .RI "Default value right-shift applied to raw 32-bit hash samples (8)\&. " .ti -1c .RI "#define \fBCOORDMASK_LSHIFT\fP(x)" .br .RI "Bitmask aligning an int16 coordinate to a 2^x feature quad boundary\&. " .ti -1c .RI "#define \fBNOISE_FADE\fP 1u" .br .ti -1c .RI "#define \fBNOISE_FADE5\fP 2u" .br .RI "Interpolation flag selecting C2 quintic smoothstep fade (6t^5 - 15t^4 + 10t^3)\&. " .ti -1c .RI "#define \fBCHAFF_MAX\fP \fBNOISE_MAX\fP" .br .ti -1c .RI "#define \fBCHAFF_FADE\fP \fBNOISE_FADE\fP" .br .RI "Alias for NOISE_FADE (cubic smoothstep interpolation flag)\&. " .ti -1c .RI "#define \fBCHAFF_MODE_SET\fP 0u" .br .RI "Layer combine mode: overwrite accumulator\&. " .ti -1c .RI "#define \fBCHAFF_MODE_ADD\fP 1u" .br .RI "Layer combine mode: add to accumulator\&. " .ti -1c .RI "#define \fBCHAFF_SEED_SHARED\fP 0u /***< One seed for all layers */" .br .RI "Seed mode: share one base seed across all layers\&. " .ti -1c .RI "#define \fBCHAFF_FLAG_FADE5\fP 2u" .br .RI "Interpolation flag selecting C2 quintic fade\&. " .ti -1c .RI "#define \fBCHAFF_FLAG_LINEAR\fP 0x80u" .br .RI "Interpolation flag selecting pure linear interpolation\&. " .ti -1c .RI "#define \fBNOISE_CONTRAST_IDENTITY\fP 256u" .br .ti -1c .RI "#define \fBCHAFF_SEED_PRIME\fP 0x85EBCA77u" .br .ti -1c .RI "#define \fBNOISE_MAX_OCTAVES\fP 16" .br .ti -1c .RI "#define \fBNOISE_CASCADE_LINEAR\fP 0x80u" .br .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef \fBoctave_t\fP \fBchaff_oct_t\fP" .br .RI "Alias for \fBoctave_t\fP\&. " .ti -1c .RI "typedef \fBnoise_wcache_t\fP \fBchaff_wcache_t\fP" .br .RI "Alias for \fBnoise_wcache_t\fP\&. " .ti -1c .RI "typedef \fBnoise_wcache_t\fP \fBnoise_cache_t\fP" .br .ti -1c .RI "typedef \fBnoise_octave_t\fP \fBchaff_octave_t\fP" .br .ti -1c .RI "typedef \fBnoise_cascade_t\fP \fBchaff_cascade_t\fP" .br .RI "Alias for \fBnoise_cascade_t\fP\&. " .ti -1c .RI "typedef \fBnoise_cache_t\fP \fBchaff_cache_t\fP" .br .RI "Alias for \fBnoise_cache_t\fP\&. " .ti -1c .RI "typedef \fBnoise_scanline_t\fP \fBchaff_scanline_t\fP" .br .RI "Alias for \fBnoise_scanline_t\fP\&. " .in -1c .SS "Functions" .in +1c .ti -1c .RI "static uint32_t \fBttypt_noise_mix32\fP (const void *key, size_t len, uint32_t seed)" .br .RI "Portable 32-bit fallback hash mixer used when xxhash\&.h is unavailable\&. " .ti -1c .RI "static int \fBnoise_fdiv\fP (int a, int b)" .br .ti -1c .RI "static uint32_t \fBnoise_pack2\fP (int16_t p0, int16_t p1)" .br .ti -1c .RI "static uint32_t \fBnoise_hash2_1\fP (int16_t p0, int16_t p1, uint32_t seed)" .br .ti -1c .RI "static void \fBnoise_hash2_4x\fP (const uint32_t packed[4], uint32_t seed, unsigned w, uint32_t out[4])" .br .ti -1c .RI "static uint32_t \fBnoise_r\fP (int16_t *p, unsigned seed, unsigned w, uint8_t dim)" .br .ti -1c .RI "static void \fBnoise_get_v\fP (uint32_t *v, int16_t *s, uint16_t x, unsigned w, unsigned seed, uint8_t dim)" .br .ti -1c .RI "static void \fBnoise_get_v_periodic\fP (uint32_t *v, const int16_t *s, uint16_t x, unsigned w, unsigned seed, uint8_t dim, uint8_t period_shift)" .br .ti -1c .RI "static void \fBnoise_calc_steps\fP (int32_t *st, uint32_t *v, uint16_t z, uint16_t vl, unsigned y)" .br .RI "Compute linear interpolation step increments along one dimension of a feature quad\&. " .ti -1c .RI "static void \fBnoise_step\fP (uint32_t *v, int32_t *st, uint16_t vl, uint16_t mul)" .br .RI "Advance hypercube interpolation values by \fRmul\fP steps\&. " .ti -1c .RI "static void \fBnoise_quad\fP (uint32_t *c, uint32_t *vc, unsigned z, unsigned cy, uint8_t dim)" .br .ti -1c .RI "static void \fBnoise_fix_v\fP (uint32_t *v, int16_t *qs, int16_t *ms, unsigned x, unsigned cy, uint8_t dim)" .br .RI "Clip and rebase feature-quad corner values onto the target matrix origin\&. " .ti -1c .RI "static void \fBnoise_get_s\fP (int16_t *s, int16_t *p, uint16_t mask, uint8_t dim)" .br .RI "Compute aligned feature-quad origin coordinates from input point \fRp\fP and \fRmask\fP\&. " .ti -1c .RI "static void \fBnoise_m\fP (uint32_t *mat, int16_t *ms, unsigned x, unsigned w, unsigned seed, unsigned cy, uint8_t dim)" .br .ti -1c .RI "static void \fBnoise_oct\fP (uint32_t *m, int16_t *s, size_t oct_n, \fBoctave_t\fP *oct, unsigned seed, unsigned cy, uint8_t dim)" .br .ti -1c .RI "static int \fBnoise_point_n_ex\fP (const int16_t *p, uint32_t seed, uint8_t shift, uint8_t dim, uint8_t vshift)" .br .ti -1c .RI "static int \fBnoise_point_n\fP (const int16_t *p, uint32_t seed, uint8_t shift, uint8_t dim)" .br .ti -1c .RI "static uint32_t \fBnoise_wfade\fP (uint32_t f, unsigned x)" .br .ti -1c .RI "static uint32_t \fBnoise_wfade5\fP (uint32_t f, unsigned x)" .br .ti -1c .RI "static uint32_t \fBnoise_wstep\fP (uint32_t v0, uint32_t v1, uint32_t f, unsigned x)" .br .ti -1c .RI "static int32_t \fBnoise_wstep_slope\fP (uint32_t v0, uint32_t v1, unsigned x)" .br .ti -1c .RI "static void \fBnoise_wreduce\fP (uint32_t *v, const uint32_t *f, unsigned x, unsigned levels, uint8_t dim, unsigned flags)" .br .ti -1c .RI "static void \fBnoise_wcell\fP (int16_t *s, uint32_t *f, const int16_t *p, unsigned x, unsigned flags, uint8_t dim)" .br .ti -1c .RI "static uint32_t \fBnoise_wpoint_n\fP (const int16_t *p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags)" .br .ti -1c .RI "static uint32_t \fBnoise_wpoint_n_periodic\fP (const int16_t *p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, uint8_t period_shift)" .br .ti -1c .RI "static uint32_t \fBnoise_wpoint_2d\fP (int16_t x0, int16_t x1, unsigned x, unsigned w, unsigned seed, unsigned flags)" .br .RI "Convenience 2D wrapper around \fBnoise_wpoint_n()\fP\&. " .ti -1c .RI "static uint32_t \fBnoise_wpoint_3d\fP (int16_t x0, int16_t x1, int16_t x2, unsigned x, unsigned w, unsigned seed, unsigned flags)" .br .RI "Convenience 3D wrapper around \fBnoise_wpoint_n()\fP\&. " .ti -1c .RI "static void \fBnoise_wcache_init\fP (\fBnoise_wcache_t\fP *c)" .br .RI "Initialize a wrapping noise corner cache to the empty state\&. " .ti -1c .RI "static const uint32_t * \fBnoise_wcorners\fP (\fBnoise_wcache_t\fP *c, int16_t *s, unsigned x, unsigned w, unsigned seed, uint8_t dim)" .br .ti -1c .RI "static const uint32_t * \fBnoise_wcorners_periodic\fP (\fBnoise_wcache_t\fP *c, const int16_t *s, unsigned x, unsigned w, unsigned seed, uint8_t dim, uint8_t period_shift)" .br .ti -1c .RI "static uint32_t \fBnoise_wpoint_c\fP (\fBnoise_wcache_t\fP *c, const int16_t *p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags)" .br .ti -1c .RI "static uint32_t \fBnoise_wpoint_c_periodic\fP (\fBnoise_wcache_t\fP *c, const int16_t *p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, uint8_t period_shift)" .br .ti -1c .RI "static void \fBnoise_wfade5_4x\fP (const uint32_t f[4], unsigned x, uint32_t out[4])" .br .ti -1c .RI "static void \fBnoise_wstep_4x\fP (const uint32_t v0[4], const uint32_t v1[4], const uint32_t f[4], unsigned x, uint32_t out[4])" .br .ti -1c .RI "static void \fBnoise_wpoint_2d_4x\fP (\fBnoise_wcache_t\fP *c, const int16_t py[4], const int16_t px[4], unsigned x, unsigned w, unsigned seed, unsigned flags, uint32_t out[4])" .br .ti -1c .RI "static void \fBnoise_wrow\fP (uint32_t *out, unsigned n, const int16_t *p0, int16_t dstep, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, \fBnoise_wcache_t\fP *c)" .br .ti -1c .RI "static void \fBnoise_wplane\fP (uint32_t *out, unsigned n, unsigned rows, size_t stride, const int16_t *p0, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, \fBnoise_wcache_t\fP *c)" .br .ti -1c .RI "static int \fBnoise_point_1d\fP (int16_t x, uint32_t seed, uint8_t shift)" .br .ti -1c .RI "static int \fBnoise_point_2d\fP (int16_t x, int16_t y, uint32_t seed, uint8_t shift)" .br .RI "O(1) zero-allocation 2D point noise query\&. " .ti -1c .RI "static int \fBnoise_point_3d\fP (int16_t x, int16_t y, int16_t z, uint32_t seed, uint8_t shift)" .br .RI "O(1) zero-allocation 3D point noise query\&. " .ti -1c .RI "static int \fBnoise_point_4d\fP (int16_t x, int16_t y, int16_t z, int16_t w, uint32_t seed, uint8_t shift)" .br .RI "O(1) zero-allocation 4D point noise query\&. " .ti -1c .RI "static int \fBchaff_point_1d\fP (int16_t x, uint32_t seed, uint8_t shift)" .br .RI "1D point noise query (chaff namespace alias)\&. " .ti -1c .RI "static int \fBchaff_point_2d\fP (int16_t x, int16_t y, uint32_t seed, uint8_t shift)" .br .RI "2D point noise query (chaff namespace alias)\&. " .ti -1c .RI "static int \fBchaff_point_3d\fP (int16_t x, int16_t y, int16_t z, uint32_t seed, uint8_t shift)" .br .RI "3D point noise query (chaff namespace alias)\&. " .ti -1c .RI "static int \fBchaff_point_4d\fP (int16_t x, int16_t y, int16_t z, int16_t w, uint32_t seed, uint8_t shift)" .br .RI "4D point noise query (chaff namespace alias)\&. " .ti -1c .RI "static int \fBchaff_point_n\fP (const int16_t *p, uint32_t seed, uint8_t shift, uint8_t dim)" .br .RI "N-dimensional point noise query (chaff namespace alias)\&. " .ti -1c .RI "static int \fBchaff_point_n_ex\fP (const int16_t *p, uint32_t seed, uint8_t shift, uint8_t dim, uint8_t vshift)" .br .RI "Extended N-dimensional point noise query with explicit value shift\&. " .ti -1c .RI "static void \fBchaff_oct\fP (uint32_t *m, int16_t *s, size_t oct_n, \fBoctave_t\fP *oct, unsigned seed, unsigned cy, uint8_t dim)" .br .RI "Multi-octave dense matrix stepper (chaff namespace alias)\&. " .ti -1c .RI "static uint32_t \fBchaff_wpoint_n\fP (const int16_t *p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags)" .br .RI "Wrapping N-dimensional point query (chaff namespace alias)\&. " .ti -1c .RI "static uint32_t \fBchaff_wpoint_c\fP (\fBnoise_wcache_t\fP *c, const int16_t *p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags)" .br .RI "Cached wrapping N-dimensional point query (chaff namespace alias)\&. " .ti -1c .RI "static void \fBchaff_wrow\fP (uint32_t *out, unsigned n, const int16_t *p0, int16_t dstep, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, \fBnoise_wcache_t\fP *c)" .br .RI "Wrapping scanline row evaluator (chaff namespace alias)\&. " .ti -1c .RI "static void \fBchaff_wplane\fP (uint32_t *out, unsigned n, unsigned rows, size_t stride, const int16_t *p0, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, \fBnoise_wcache_t\fP *c)" .br .RI "Wrapping 2D plane evaluator (chaff namespace alias)\&. " .ti -1c .RI "static uint32_t \fBchaff_layer_seed\fP (const \fBchaff_field_t\fP *field, const \fBchaff_layer_t\fP *lay, uint8_t l)" .br .RI "Derive the effective 32-bit seed for layer index \fRl\fP\&. " .ti -1c .RI "static uint32_t \fBchaff_fade_frac_ex\fP (uint32_t fi, uint16_t frac, unsigned x, uint8_t flags)" .br .ti -1c .RI "static uint32_t \fBchaff_fade_frac\fP (uint32_t fi, uint16_t frac, unsigned x)" .br .RI "Evaluate fractional smoothstep weight for sub-cell offset \fRfrac\fP\&. " .ti -1c .RI "static void \fBchaff_fill\fP (const \fBchaff_field_t\fP *field, uint8_t layer_lo, uint8_t layer_hi, const \fBchaff_coord_t\fP origin[], const int32_t step_q16[], const uint16_t n[], int32_t *out, size_t stride, unsigned mode)" .br .ti -1c .RI "static unsigned \fBnoise_cascade_vshift\fP (const \fBnoise_cascade_t\fP *cfg)" .br .RI "Return effective value shift for cascade \fRcfg\fP\&. " .ti -1c .RI "static unsigned \fBnoise_cascade_flags\fP (const \fBnoise_cascade_t\fP *cfg)" .br .RI "Return effective interpolation flags for cascade \fRcfg\fP\&. " .ti -1c .RI "static uint32_t \fBnoise_cascade_octave_seed\fP (const \fBnoise_cascade_t\fP *cfg, const \fBnoise_octave_t\fP *oct, uint8_t idx)" .br .RI "Derive deterministic seed for octave index \fRo\fP in cascade \fRcfg\fP\&. " .ti -1c .RI "static void \fBnoise_scanline_init\fP (\fBnoise_scanline_t\fP *scan, const \fBnoise_cascade_t\fP *cfg, uint8_t dim)" .br .RI "Initialize scanline evaluator \fRscan\fP for cascade \fRcfg\fP and dimension \fRdim\fP\&. " .ti -1c .RI "static void \fBnoise_scanline_eval_row\fP (\fBnoise_scanline_t\fP *scan, int16_t start_x, int16_t y, int16_t z, size_t count, int32_t *out_row)" .br .ti -1c .RI "static void \fBnoise_matrix_fill_2d\fP (const \fBnoise_cascade_t\fP *cfg, int16_t origin_x, int16_t origin_y, uint8_t size_shift, int32_t *out_matrix)" .br .ti -1c .RI "static int32_t \fBnoise_sample_2d\fP (const \fBnoise_cascade_t\fP *cfg, int16_t x, int16_t y)" .br .ti -1c .RI "static int32_t \fBnoise_sample_3d\fP (const \fBnoise_cascade_t\fP *cfg, int16_t x, int16_t y, int16_t z)" .br .RI "Evaluate multi-octave cascade \fRcfg\fP at 3D coordinates (\fRx\fP, \fRy\fP, \fRz\fP)\&. " .ti -1c .RI "static int32_t \fBnoise_sample_4d\fP (const \fBnoise_cascade_t\fP *cfg, int16_t x, int16_t y, int16_t z, int16_t w)" .br .RI "Evaluate multi-octave cascade \fRcfg\fP at 4D coordinates (\fRx\fP, \fRy\fP, \fRz\fP, \fRw\fP)\&. " .ti -1c .RI "static void \fBchaff_matrix_fill_2d\fP (const \fBchaff_cascade_t\fP *cfg, int16_t origin_x, int16_t origin_y, uint8_t size_shift, int32_t *out_matrix)" .br .RI "Fill a 2D dense matrix from cascade \fRcfg\fP (chaff namespace alias)\&. " .ti -1c .RI "static void \fBchaff_scanline_init\fP (\fBchaff_scanline_t\fP *scan, const \fBchaff_cascade_t\fP *cfg, uint8_t dim)" .br .RI "Initialize a scanline evaluator (chaff namespace alias)\&. " .ti -1c .RI "static void \fBchaff_scanline_eval_row\fP (\fBchaff_scanline_t\fP *scan, int16_t start_x, int16_t y, int16_t z, size_t count, int32_t *out_row)" .br .RI "Evaluate a scanline row (chaff namespace alias)\&. " .ti -1c .RI "static int32_t \fBchaff_sample_2d\fP (const \fBchaff_cascade_t\fP *cfg, int16_t x, int16_t y)" .br .RI "Sample 2D cascade \fRcfg\fP (chaff namespace alias)\&. " .ti -1c .RI "static int32_t \fBchaff_sample_3d\fP (const \fBchaff_cascade_t\fP *cfg, int16_t x, int16_t y, int16_t z)" .br .RI "Sample 3D cascade \fRcfg\fP (chaff namespace alias)\&. " .ti -1c .RI "static int32_t \fBchaff_sample_4d\fP (const \fBchaff_cascade_t\fP *cfg, int16_t x, int16_t y, int16_t z, int16_t w)" .br .RI "Sample 4D cascade \fRcfg\fP (chaff namespace alias)\&. " .in -1c .SH "Detailed Description" .PP Standalone generic N-dimensional wrapping procedural noise engine, dense matrix stepper, point sampler, and multi-octave cascade API\&. \fBttypt/noise\&.h\fP — Standalone Generic N-Dimensional Procedural Noise Library\&. .PP A noise algorithm that wraps well around data type limits\&. .PP LICENSE: BSD-2-Clause Copyright (c) 2026, tty-pt .PP DEFINITIONS: .PP A point has DIM coordinates (int16_t)\&. A matrix has 2^y (cy) edge length and (2^cy)^dim total elements\&. A noise feature quad has 2^x edge length and 2^dim vertices with random values\&. Other values are the result of a fade (multilinear smoothstep) between those\&. .PP Provides: .IP "1." 4 Dense Matrix Stepper (noise_oct, noise_m, noise_quad): bulk hypercube generation\&. .IP "2." 4 Generic Point Sampler (noise_point_n, noise_point_2d, noise_point_3d): O(1) zero-allocation point queries\&. .IP "3." 4 Wrapping Original-Algorithm Sampler (noise_wpoint_n, noise_wpoint_c, noise_wrow): point / cached / row-stepped queries that reproduce the matrix stepper exactly, so coordinates (e\&.g\&. an ever-increasing time counter cast to int16_t) may keep incrementing across the data-type boundary without a seam\&. .PP .SH "Macro Definition Documentation" .PP .SS "#define CHAFF_MAX \fBNOISE_MAX\fP" --- Canonical libchaff aliases (chaff_ prefix) --------------------------- .SS "#define CHAFF_SEED_PRIME 0x85EBCA77u" Per-layer seed decorrelation multiplier (Murmur3 finalizer constant)\&. .SS "#define NOISE_CASCADE_LINEAR 0x80u" Flag for \fBnoise_cascade_t::flags\fP to explicitly request raw linear interpolation (disabling NOISE_FADE)\&. .SS "#define NOISE_CONTRAST_IDENTITY 256u" Identity contrast multiplier in Q8\&.8 fixed-point (256 = 1\&.0x)\&. .SS "#define NOISE_FADE 1u" Point queries that follow the ORIGINAL lattice algorithm of noise_m: .IP "\(bu" 2 lattice keys are the masked int16 coordinates themselves (s = p & \fBCOORDMASK_LSHIFT(x)\fP), hashed with noise_r; .IP "\(bu" 2 the far vertex of a quad is s + 2^x computed in int16_t, so it wraps exactly like the coordinate does (32767 + 1 == -32768): no seam at the data-type boundary on any axis; .IP "\(bu" 2 interpolation is the matrix stepper's: axis 0 first, step = (v1 - v0) >> x, value = v0 + f * step (see calc_steps / step / noise_quad)\&. Results are therefore value-equal to noise_m over lattice-aligned matrices\&. Values are on noise_m's scale: (hash >> w), interpolated\&. With NOISE_FADE, f is remapped by a Hermite smoothstep onto [0, 2^x) (lattice values are unchanged, derivatives vanish at cell borders)\&. Requires 1 <= dim <= 4 and 1 <= x <= 15\&. .PP .SS "#define NOISE_MAX_OCTAVES 16" Maximum number of octaves supported by \fBnoise_scanline_t\fP and cascade evaluators\&. .SH "Typedef Documentation" .PP .SS "typedef \fBnoise_octave_t\fP \fBchaff_octave_t\fP" Canonical declarative libchaff aliases .SS "typedef \fBnoise_wcache_t\fP \fBnoise_cache_t\fP" Corner cache: aliased to \fBnoise_wcache_t\fP to eliminate layout drift and type punning .SH "Function Documentation" .PP .SS "uint32_t chaff_fade_frac_ex (uint32_t fi, uint16_t frac, unsigned x, uint8_t flags)\fR [inline]\fP, \fR [static]\fP" Fractional fade helper with selectable C1 cubic Hermite or C2 quintic Hermite in 16\&.16 .SS "void chaff_fill (const \fBchaff_field_t\fP * field, uint8_t layer_lo, uint8_t layer_hi, const \fBchaff_coord_t\fP origin[], const int32_t step_q16[], const uint16_t n[], int32_t * out, size_t stride, unsigned mode)\fR [inline]\fP, \fR [static]\fP" Primary multi-layer region generator (point, row, plane, volume)\&. Evaluates field layers [layer_lo, layer_hi) over a grid of size n[dim] starting at origin[dim] with step_q16[dim] (rational 16\&.16 fixed-point steps)\&. Zero heap allocations; callers supply \fRout\fP\&. .SS "int noise_fdiv (int a, int b)\fR [inline]\fP, \fR [static]\fP" Euclidean integer floor division .SS "void noise_get_v (uint32_t * v, int16_t * s, uint16_t x, unsigned w, unsigned seed, uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Generate values at N-dimensional quad vertices .SS "void noise_get_v_periodic (uint32_t * v, const int16_t * s, uint16_t x, unsigned w, unsigned seed, uint8_t dim, uint8_t period_shift)\fR [inline]\fP, \fR [static]\fP" Generate values at N-dimensional quad vertices with optional periodic domain wrapping .SS "uint32_t noise_hash2_1 (int16_t p0, int16_t p1, uint32_t seed)\fR [inline]\fP, \fR [static]\fP" Branchless 4-byte XXH32 matching XXH32(int16_t[2]{p0,p1}, 4, seed) bit-for-bit .SS "void noise_hash2_4x (const uint32_t packed[4], uint32_t seed, unsigned w, uint32_t out[4])\fR [inline]\fP, \fR [static]\fP" 4-wide 4-byte XXH32 hash + right-shift by w\&. Bit-exact with noise_r(p, seed, w, 2)\&. .SS "void noise_m (uint32_t * mat, int16_t * ms, unsigned x, unsigned w, unsigned seed, unsigned cy, uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Fills matrix "mat" with deterministic N-dimensional noise .SS "void noise_matrix_fill_2d (const \fBnoise_cascade_t\fP * cfg, int16_t origin_x, int16_t origin_y, uint8_t size_shift, int32_t * out_matrix)\fR [inline]\fP, \fR [static]\fP" .IP "2." 4 Universal Bulk Matrix Stepper Fills 2^size_shift x 2^size_shift chunk by scanline rows\&. Guarantees out_matrix[r * side + c] == noise_sample_2d(origin_x + c, origin_y + r)\&. Zero heap allocations\&. .PP .SS "void noise_oct (uint32_t * m, int16_t * s, size_t oct_n, \fBoctave_t\fP * oct, unsigned seed, unsigned cy, uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Multi-octave N-dimensional matrix noise evaluation .SS "uint32_t noise_pack2 (int16_t p0, int16_t p1)\fR [inline]\fP, \fR [static]\fP" Pack 2D lattice coordinate (p0, p1) into little-endian 4-byte key .SS "int noise_point_1d (int16_t x, uint32_t seed, uint8_t shift)\fR [inline]\fP, \fR [static]\fP" Point-evaluation ergonomic helpers .SS "int noise_point_n (const int16_t * p, uint32_t seed, uint8_t shift, uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Evaluates continuous N-dimensional smoothstep value noise at point p[dim]\&. Returns fixed-point value in range 0\&.\&.255\&. Zero heap allocations\&. .SS "int noise_point_n_ex (const int16_t * p, uint32_t seed, uint8_t shift, uint8_t dim, uint8_t vshift)\fR [inline]\fP, \fR [static]\fP" Evaluates continuous N-dimensional smoothstep value noise at point p[dim] with configurable bit-shift divider \fRvshift\fP (1\&.\&.15; 0 defaults to NOISE_DEFAULT_VSHIFT = 8)\&. Returns fixed-point value in range 0 \&.\&. (1 << (16 - vshift)) - 1\&. Zero heap allocations\&. .SS "void noise_quad (uint32_t * c, uint32_t * vc, unsigned z, unsigned cy, uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Fade between vertices and step target values across matrix .SS "uint32_t noise_r (int16_t * p, unsigned seed, unsigned w, uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Deterministic random value for an N-dimensional point p .SS "int32_t noise_sample_2d (const \fBnoise_cascade_t\fP * cfg, int16_t x, int16_t y)\fR [inline]\fP, \fR [static]\fP" .IP "3." 4 Sparse Point Sampler (Collision, Entrances, Caverns) .PP .SS "void noise_scanline_eval_row (\fBnoise_scanline_t\fP * scan, int16_t start_x, int16_t y, int16_t z, size_t count, int32_t * out_row)\fR [inline]\fP, \fR [static]\fP" .IP "1." 4 Universal Scanline Stepper with Corner Cache Evaluates rows in-register, applying skew per sample so values match the point sampler\&. Zero heap allocations\&. .PP .SS "void noise_wcell (int16_t * s, uint32_t * f, const int16_t * p, unsigned x, unsigned flags, uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Lattice cell origin and in-quad offsets of p .SS "const uint32_t * noise_wcorners (\fBnoise_wcache_t\fP * c, int16_t * s, unsigned x, unsigned w, unsigned seed, uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Vertex values of the cell at s, from the cache when it matches .SS "const uint32_t * noise_wcorners_periodic (\fBnoise_wcache_t\fP * c, const int16_t * s, unsigned x, unsigned w, unsigned seed, uint8_t dim, uint8_t period_shift)\fR [inline]\fP, \fR [static]\fP" Vertex values of the cell at s with optional periodic domain wrapping .SS "uint32_t noise_wfade (uint32_t f, unsigned x)\fR [inline]\fP, \fR [static]\fP" Hermite smoothstep of f in [0, 2^x), mapped onto [0, 2^x) .SS "uint32_t noise_wfade5 (uint32_t f, unsigned x)\fR [inline]\fP, \fR [static]\fP" Ken Perlin's quintic polynomial: 6t^5 - 15t^4 + 10t^3\&. First and second derivatives are zero at 0 and 1, ensuring C^2 continuity\&. Input f in [0, 2^x), returns value in [0, 2^x)\&. .SS "void noise_wfade5_4x (const uint32_t f[4], unsigned x, uint32_t out[4])\fR [inline]\fP, \fR [static]\fP" 4-wide bit-exact Perlin quintic fade matching noise_wfade5(f[i], x) .SS "void noise_wplane (uint32_t * out, unsigned n, unsigned rows, size_t stride, const int16_t * p0, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, \fBnoise_wcache_t\fP * c)\fR [inline]\fP, \fR [static]\fP" Plane stepper: out[r * stride + k] = noise_wpoint_n(p0 with the last two axes advanced by r (rows, axis dim-2) and k (columns, axis dim-1)), for r < rows, k < n; both coordinates wrap in int16_t\&. In noise_quad order it fetches the 2^dim corners ONCE per 2D lattice cell (rows x cols / 4^x fetches), collapses the fixed outer axes once per cell, the row axis once per row, and spends one multiply-add per sample\&. Requires dim >= 2\&. \fRc\fP may be NULL\&. .SS "void noise_wpoint_2d_4x (\fBnoise_wcache_t\fP * c, const int16_t py[4], const int16_t px[4], unsigned x, unsigned w, unsigned seed, unsigned flags, uint32_t out[4])\fR [inline]\fP, \fR [static]\fP" 4-wide 2D wrapped point query: bit-exact with 4 calls to noise_wpoint_c(c, {py[i], px[i]}, x, w, seed, 2, flags)\&. .SS "uint32_t noise_wpoint_c (\fBnoise_wcache_t\fP * c, const int16_t * p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags)\fR [inline]\fP, \fR [static]\fP" Cached point query: value-equal to noise_wpoint_n .SS "uint32_t noise_wpoint_c_periodic (\fBnoise_wcache_t\fP * c, const int16_t * p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, uint8_t period_shift)\fR [inline]\fP, \fR [static]\fP" Cached point query with optional periodic domain wrapping .SS "uint32_t noise_wpoint_n (const int16_t * p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags)\fR [inline]\fP, \fR [static]\fP" Uncached point query (2^dim hashes) .SS "uint32_t noise_wpoint_n_periodic (const int16_t * p, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, uint8_t period_shift)\fR [inline]\fP, \fR [static]\fP" Uncached point query with optional periodic domain wrapping .SS "void noise_wreduce (uint32_t * v, const uint32_t * f, unsigned x, unsigned levels, uint8_t dim, unsigned flags)\fR [inline]\fP, \fR [static]\fP" Collapse the first \fRlevels\fP axes of the 2^dim vertex values in v, axis 0 first, at in-quad offsets f[] (already faded if requested)\&. With NOISE_FADE/NOISE_FADE5, multiplies before shifting to eliminate slope truncation across cells\&. Without NOISE_FADE, preserves exact bit-level noise_m calc_steps arithmetic\&. .SS "void noise_wrow (uint32_t * out, unsigned n, const int16_t * p0, int16_t dstep, unsigned x, unsigned w, unsigned seed, uint8_t dim, unsigned flags, \fBnoise_wcache_t\fP * c)\fR [inline]\fP, \fR [static]\fP" Row stepper: out[k] = noise_wpoint_n(p0 + k * dstep along the LAST axis), k < n, the coordinate wrapping in int16_t\&. Like noise_get_v + noise_quad, it fetches the 2^dim corners once per lattice cell and collapses the other axes once per cell; each sample is then one multiply-add on the innermost axis\&. \fRc\fP may be NULL\&. .SS "uint32_t noise_wstep (uint32_t v0, uint32_t v1, uint32_t f, unsigned x)\fR [inline]\fP, \fR [static]\fP" Multiply-then-shift fixed-point linear interpolation step: Evaluates v0 + (((v1 - v0) * f) >> x) without premature division\&. .SS "void noise_wstep_4x (const uint32_t v0[4], const uint32_t v1[4], const uint32_t f[4], unsigned x, uint32_t out[4])\fR [inline]\fP, \fR [static]\fP" 4-wide bit-exact fixed-point linear interpolation matching noise_wstep(v0[i], v1[i], f[i], x) .SS "int32_t noise_wstep_slope (uint32_t v0, uint32_t v1, unsigned x)\fR [inline]\fP, \fR [static]\fP" Legacy slope helper for un-faded matrix steppers .SH "Author" .PP Generated automatically by Doxygen for chaff from the source code\&.