libosmodsp 0.4.0.8-9128
Osmocom DSP library
iqbal.c File Reference

IQ balance utils implementation. More...

Data Structures

struct  _iqbal_estimate_state
 Cache for _osmo_iqbal_estimate when doing lots of calls. More...
 
struct  _iqbal_state
 Internal state structure for the IQ balance optimization algorithm. More...
 

Functions

void osmo_iqbal_fix (float complex *out, float complex *in, unsigned int len, float mag, float phase)
 Apply IQ balance correction to a given complex buffer. More...
 
struct osmo_cxvecosmo_iqbal_cxvec_fix (const struct osmo_cxvec *in, float mag, float phase, struct osmo_cxvec *out)
 Apply IQ balance correction to a given complex vector. More...
 
static void _osmo_iqbal_estimate_release (struct _iqbal_estimate_state *state)
 Release a cache object created by _osmo_iqbal_estimate.
 
static float _osmo_iqbal_estimate (const float complex *data, int fft_size, int fft_count, struct _iqbal_estimate_state **state_p)
 Objectively estimate IQ balance in a given complex buffer. More...
 
float osmo_iqbal_estimate (const float complex *data, int fft_size, int fft_count)
 Objectively estimate IQ balance in a given complex buffer. More...
 
float osmo_iqbal_cxvec_estimate (const struct osmo_cxvec *sig, int fft_size, int fft_count)
 Objectively estimate IQ balance in a given complex vector. More...
 
static float _iqbal_objfn_value (struct _iqbal_state *state, float x[2])
 Optimization objective function - Value. More...
 
static void _iqbal_objfn_gradient (struct _iqbal_state *state, float x[2], float v, float grad[2])
 Optimization objective function - Gradient estimation. More...
 
static float _iqbal_objfn_val_gradient (struct _iqbal_state *state, float x[2], float grad[2])
 Optimization objective function - Value & Gradient estimation. More...
 
int osmo_iqbal_cxvec_optimize (const struct osmo_cxvec *sig, float *mag, float *phase, const struct osmo_iqbal_opts *opts)
 Finds the best IQ balance correction parameters for a given signal. More...
 

Variables

const struct osmo_iqbal_opts osmo_iqbal_default_opts
 Default values for the optimization algorithm. More...
 

Detailed Description

IQ balance utils implementation.

The actual algorithm used for estimation of the imbalance and its optimization is inspired by the IQ balancer of SDR# by Youssef Touil and described here :

http://sdrsharp.com/index.php/automatic-iq-correction-algorithm

The main differences are:

  • Objective function uses complex correlation of left/right side of FFT
  • Optimization based on steepest gradient with dynamic step size