Skip to content
heliaDSP
API reference
HELIA HUB

helia_window_stats.h

Window statistics in one traversal, f32.

One call reads a window of N f32 samples once and returns its count, the sum and the sum of squares of the deviations from a shift, its minimum and its maximum. Inline helpers derive the sum, sum of squares, mean, population variance, sample variance and root mean square (RMS) from that result, so that one call serves every one of them.

Three entry points share one contract:

Entry point Implementation
helia_window_stats_f32() Helium (MVE) when the library is compiled for a target with floating-point MVE (__ARM_FEATURE_MVE & 2) and ARM_MATH_AUTOVECTORIZE is not defined, optimized scalar otherwise
helia_window_stats_scalar_f32() optimized scalar, on every target
helia_window_stats_reference_f32() reference: sequential, accumulates in double precision (the test oracle)

The preprocessor fixes the implementation behind helia_window_stats_f32() when the library is compiled; no entry point chooses among implementations at run time, so an application that calls one entry point links one implementation.

The sections below state the contract fields listed in helia/CONTRACTS.md.

Machine-readable model

struct

Statistics of one window, as accumulated in one traversal.

helia/include/helia/helia_window_stats.h:278

struct helia_window_stats_result_f32

Statistics of one window, as accumulated in one traversal.

The layout is the same in every build configuration.

function

Window statistics: Helium implementation on targets with floating-point MVE, unless the library is built with ARMMATHAUTOVECTORIZE (CMake AUTOVECTORIZE=ON), op…

helia/include/helia/helia_window_stats.h:303

arm_status helia_window_stats_f32(const float32_t *pSrc, uint32_t blockSize, helia_window_stats_result_f32 *pResult)

Window statistics: Helium implementation on targets with floating-point MVE, unless the library is built with ARM_MATH_AUTOVECTORIZE (CMake AUTOVECTORIZE=ON), optimized scalar implementation otherwise.

Stack: static frame 72 bytes (ATfE 22.1.0), 44 bytes (GCC 14.2.1); measured 120 and 100 bytes.

Parameters of helia_window_stats_f32
NameTypeDirectionDescription
pSrcconst float32_t *inN samples; not modified.
blockSizeuint32_tinN, at most 2^24.
pResulthelia_window_stats_result_f32 *outThe statistics.
Returns of helia_window_stats_f32
Description
ARM_MATH_SUCCESS, or ARM_MATH_ARGUMENT_ERROR without writing `pResult` when `pSrc` or `pResult` is NULL.
function

Window statistics, optimized scalar implementation on every target.

helia/include/helia/helia_window_stats.h:316

arm_status helia_window_stats_scalar_f32(
const float32_t *pSrc,
uint32_t blockSize,
helia_window_stats_result_f32 *pResult
)

Window statistics, optimized scalar implementation on every target.

Same contract as helia_window_stats_f32(), and the same operations in the same order as its Helium implementation.

Stack: static frame 64 bytes (ATfE 22.1.0), 40 bytes (GCC 14.2.1); measured 112 and 96 bytes.

Parameters of helia_window_stats_scalar_f32
NameTypeDescription
pSrcconst float32_t *
blockSizeuint32_t
pResulthelia_window_stats_result_f32 *
function

Window statistics, reference implementation.

helia/include/helia/helia_window_stats.h:332

arm_status helia_window_stats_reference_f32(
const float32_t *pSrc,
uint32_t blockSize,
helia_window_stats_result_f32 *pResult
)

Window statistics, reference implementation.

Same contract as helia_window_stats_f32(), with the reference’s accumulation order and error bounds. Sequential, in double precision, and written for review rather than speed; the other entry points are tested against it.

Stack: static frame 88 bytes (ATfE 22.1.0), 0 bytes (GCC 14.2.1), plus the double-precision arithmetic routines it calls; measured 136 and 64 bytes.

Parameters of helia_window_stats_reference_f32
NameTypeDescription
pSrcconst float32_t *
blockSizeuint32_t
pResulthelia_window_stats_result_f32 *
function

Sum of the samples, Nc + sumdev; +0.0f when N = 0.

helia/include/helia/helia_window_stats.h:339

static float32_t helia_window_stats_sum_f32(const helia_window_stats_result_f32 *s)

Sum of the samples, N*c + sum_dev; +0.0f when N = 0.

Parameters of helia_window_stats_sum_f32
NameTypeDescription
sconst helia_window_stats_result_f32 *
function

Root mean square of the samples; NaN when N = 0.

helia/include/helia/helia_window_stats.h:389

static float32_t helia_window_stats_rms_f32(const helia_window_stats_result_f32 *s)

Root mean square of the samples; NaN when N = 0.

Parameters of helia_window_stats_rms_f32
NameTypeDescription
sconst helia_window_stats_result_f32 *
function

Sum of the squared samples, N times the mean square; +0.0f when N = 0.

helia/include/helia/helia_window_stats.h:398

static float32_t helia_window_stats_sum_squares_f32(const helia_window_stats_result_f32 *s)

Sum of the squared samples, N times the mean square; +0.0f when N = 0.

Parameters of helia_window_stats_sum_squares_f32
NameTypeDescription
sconst helia_window_stats_result_f32 *