File hbdecim_r2c_core.h¶
FileList > hbdecim > hbdecim_r2c_core.h
Go to the source code of this file
Real-to-complex halfband 2:1 decimator (Architecture D2). More...
#include "clib_common.h"#include "dp_state.h"
Public Types¶
| Type | Name |
|---|---|
| typedef struct hbdecim_r2c_state | hbdecim_r2c_state_t |
Public Functions¶
| Type | Name |
|---|---|
| hbdecim_r2c_state_t * | hbdecim_r2c_create (size_t num_taps, const float * h) Allocate a real-to-complex halfband decimator. |
| void | hbdecim_r2c_destroy (hbdecim_r2c_state_t * r) |
| size_t | hbdecim_r2c_execute (hbdecim_r2c_state_t * r, const float * in, size_t num_in, float _Complex * out, size_t max_out) Decimate real float32 input by 2, producing CF32. |
| size_t | hbdecim_r2c_get_num_taps (const hbdecim_r2c_state_t * r) |
| double | hbdecim_r2c_get_rate (const hbdecim_r2c_state_t * r) |
| void | hbdecim_r2c_get_state (const hbdecim_r2c_state_t * r, void * blob) Serialize r's mutable state intoblob . |
| void | hbdecim_r2c_reset (hbdecim_r2c_state_t * r) |
| int | hbdecim_r2c_set_state (hbdecim_r2c_state_t * r, const void * blob) Restore mutable state from blob (same num_taps). |
| size_t | hbdecim_r2c_state_bytes (const hbdecim_r2c_state_t * r) Bytes hbdecim_r2c_get_state() writes for r (envelope+payload). |
Macros¶
| Type | Name |
|---|---|
| define | HBDECIM_R2C_STATE_MAGIC [**DP\_FOURCC**](dp__state_8h.md#define-dp_fourcc) ('H', 'B', 'R', '2') |
| define | HBDECIM_R2C_STATE_VERSION 1u |
Detailed Description¶
Lifted from dp_hbdecim_r2cf32_t (c/src/hbdecim.c). Accepts real float32 input and produces CF32 IQ at half the input rate, with an embedded fs/4 frequency shift (same effect as mixing with e^{jπn/2} before decimating, at zero extra multiplications).
The output at sample m is: y(m) = (FIR(even) + j·delay(odd)) · (-1)^m
where the sign pattern (-1)^m provides the fs/4 shift correction.
Lifecycle:
hbdecim_r2c_state_t *r = hbdecim_r2c_create(num_taps, h);
size_t n = hbdecim_r2c_execute(r, in, num_in, out, max_out);
hbdecim_r2c_destroy(r);
Public Types Documentation¶
typedef hbdecim_r2c_state_t¶
Public Functions Documentation¶
function hbdecim_r2c_create¶
Allocate a real-to-complex halfband decimator.
Parameters:
num_tapsFIR branch length.hFIR coefficients, float32, length num_taps.
Returns:
Non-NULL on success, NULL on invalid args or OOM.
function hbdecim_r2c_destroy¶
Free all resources. NULL is a no-op.
function hbdecim_r2c_execute¶
Decimate real float32 input by 2, producing CF32.
size_t hbdecim_r2c_execute (
hbdecim_r2c_state_t * r,
const float * in,
size_t num_in,
float _Complex * out,
size_t max_out
)
Parameters:
rMust be non-NULL.inReal input samples.num_inNumber of input samples.outCF32 output buffer.max_outCapacity in samples.
Returns:
Number of output samples written.
function hbdecim_r2c_get_num_taps¶
Returns the FIR branch length passed to hbdecim_r2c_create.
function hbdecim_r2c_get_rate¶
Always returns 0.5.
function hbdecim_r2c_get_state¶
Serialize r's mutable state intoblob .
function hbdecim_r2c_reset¶
Zero history and output parity without freeing.
function hbdecim_r2c_set_state¶
Restore mutable state from blob (same num_taps).
Returns:
DP_OK, or DP_ERR_INVALID if the blob's envelope rejects.
function hbdecim_r2c_state_bytes¶
Bytes hbdecim_r2c_get_state() writes forr (envelope+payload).
Macro Definition Documentation¶
define HBDECIM_R2C_STATE_MAGIC¶
define HBDECIM_R2C_STATE_VERSION¶
The documentation for this class was generated from the following file native/inc/hbdecim/hbdecim_r2c_core.h