xtos_ signal_ fft_ power
Computes one-sided squared-magnitude power for an unnormalized DFT, bins 0 through n/2.
On this page
Declaration
#include <xtos/signal.h>
int xtos_signal_fft_power(const double *input,
size_t n,
double *power,
size_t power_count);Parameters
| Parameter | Type | Description |
|---|---|---|
| input | const double * | Non-NULL input with at least n doubles; the implementation does not check NaN/Inf. |
| n | size_t | A nonzero power of two determining the FFT length. |
| power | double * | Non-NULL caller-allocated output with at least n/2+1 entries. |
| power_count | size_t | Output capacity in double elements, at least n/2+1. |
Return value
Returns 0 on success and -1 on failure. power[0..n/2] is written; extra capacity is untouched.
Errors
| errno | Condition |
|---|---|
| EINVAL | A pointer is NULL, n is not a nonzero power of two, or output capacity is too small. |
| ENOMEM | Allocation of either internal n-element temporary array failed. |
Notes
- The implementation calloc-allocates two n-element arrays and frees them before return; the caller still owns power.
- Power is Re(X)^2+Im(X)^2 with no n or n^2 normalization, window, mean removal, or automatic factor of 2; NaN/Inf are not checked.
Example
Source
This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.