File wfm_private.h¶
FileList > doppler > wfm > wfm_private.h
Go to the source code of this file
Shared internals of the wfm composer, the Plan and the synth. More...
#include <stddef.h>
Public Static Functions¶
| Type | Name |
|---|---|
| WFM_NOINLINE void | wfm_add_scaled (float _Complex *restrict out, const float _Complex *restrict in, size_t n, float gain) out[i] += gain * in[i] __ the ONE real-gain accumulate every wfm path uses to add a scaled stream (a noise stream, a source) into a sum. (A phase-rotated source, whose gain is complex, is the Plan's own override and has no compose twin to agree with.) |
| WFM_NOINLINE void | wfm_mix_block (float _Complex *restrict out, const float _Complex *restrict c) One block of the carrier mix: out[i] *= c[i] for exactly WFM_MIX_BLOCK complex samples. |
| void | wfm_mix_carrier (float _Complex *restrict out, const float _Complex *restrict carrier, size_t n) out[i] *= carrier[i] (complex) the carrier mix, in whole blocks. |
Macros¶
| Type | Name |
|---|---|
| define | WFM_MIX_BLOCK 32Samples a mix block holds; every carrier mix runs in blocks of this many, the last one padded with zeros. |
| define | WFM_NOINLINE Keep a function out of line: a loop of its own no caller can fuse. |
Detailed Description¶
Not part of the public API: nothing here is exported, and nothing here is promised to a caller (the correlator_private.h / correlator_private.h pattern).
Public Static Functions Documentation¶
function wfm_add_scaled¶
out[i] += gain * in[i] __ the ONE real-gain accumulate every wfm path uses to add a scaled stream (a noise stream, a source) into a sum. (A phase-rotated source, whose gain is complex, is the Plan's own override and has no compose twin to agree with.)
static WFM_NOINLINE void wfm_add_scaled (
float _Complex *restrict out,
const float _Complex *restrict in,
size_t n,
float gain
)
A compose and a Plan must produce the same bits for the same scene. Each adds the same streams, but written inline as sig * carrier + noise in one place and cache + noise in another they are the same number only where the compiler never fuses a multiply-add; under this tree's -ffast-math an FMA target (AArch64, or x86 with -mfma) rounds the first once and the second twice (doppler#2789). So the signal is STORED (rounded) first and every path adds through this function.
noinline keeps it a loop of its own that no caller can fuse with the pass before it. It is a static in each translation unit that includes this header (nothing is exported), compiled from this one source under the one set of flags, so every copy runs the same instructions.
Parameters:
outSum, updated in place; lengthn.inThe stream to add, lengthn; must not overlapout.nSamples.gainMultiplier onin(1.0f for a stream already at its amplitude).
function wfm_mix_block¶
One block of the carrier mix: out[i] *= c[i] for exactly WFM_MIX_BLOCK complex samples.
static WFM_NOINLINE void wfm_mix_block (
float _Complex *restrict out,
const float _Complex *restrict c
)
The one place a complex multiply of the synth's block path is compiled. A vectorised loop has a body and a scalar tail, and a compiler is free to round them differently: a fused product-sum (-ffp-contract), or, on clang for ARMv8.3+ (Apple silicon), FCMLA in the body, which -ffp-contract=off does not stop because -ffast-math marks every operation fusable. So a sample's last bit depended on where the caller's block ended (a Plan builds in one run; a composer pulls 257 at a time), doppler#2805.
Every sample now goes through THIS function, and it is out of line with a fixed trip count, so its machine code is one body: a sample is multiplied the same way at any position in any pull, on every compiler.
noinline stops inlining; it is not noipa. A compiler may still analyse the call across the translation unit (constant arguments, cloning), so the guarantee rests on the fixed trip count, which every call site shares.
function wfm_mix_carrier¶
out[i] *= carrier[i] (complex) the carrier mix, in whole blocks.
static inline void wfm_mix_carrier (
float _Complex *restrict out,
const float _Complex *restrict carrier,
size_t n
)
The final partial block is run through the same wfm_mix_block() on a zero-padded copy and only the samples that exist are kept, as the FIR does (fir_core.c, #1893).
Parameters:
outSignal, mixed in place; lengthn.carrierThe carrier, lengthn; must not overlapout.nSamples.
Macro Definition Documentation¶
define WFM_MIX_BLOCK¶
Samples a mix block holds; every carrier mix runs in blocks of this many, the last one padded with zeros.
define WFM_NOINLINE¶
Keep a function out of line: a loop of its own no caller can fuse.
The documentation for this class was generated from the following file native/inc/doppler/wfm/wfm_private.h