libosmodsp  0.4.0
Osmocom DSP library
cfile.h File Reference

Osmocom .cfile helpers header. More...

Go to the source code of this file.

Data Structures

struct  cfile
 Structure representing a currently mapped .cfile. More...
 

Functions

struct cfilecfile_load (const char *filename)
 .cfile loader: mmap() the data into memory (read-only) More...
 
void cfile_release (struct cfile *cf)
 Release all resources associated with a mapped .cfile. More...
 

Detailed Description

Osmocom .cfile helpers header.

PEAK_EARLY_LATE
@ PEAK_EARLY_LATE
Early-Late balancing around peak.
Definition: cxvec_math.h:116
osmo_iqbal_opts
Processing options for the IQ balance optimization algorithm.
Definition: iqbal.h:62
PEAK_WEIGH_WIN_CENTER
@ PEAK_WEIGH_WIN_CENTER
Weighted position of the peak centered window.
Definition: cxvec_math.h:114
osmo_cxvec
Complex vector.
Definition: cxvec.h:41
_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.
Definition: iqbal.c:144
osmo_cxvec::max_len
int max_len
Maximum length in data field.
Definition: cxvec.h:43
osmo_cxvec_correlate
struct osmo_cxvec * osmo_cxvec_correlate(const struct osmo_cxvec *f, const struct osmo_cxvec *g, int g_corr_step, struct osmo_cxvec *out)
Cross-correlate two complex vectors.
Definition: cxvec_math.c:335
_iqbal_estimate_state::fft_plan
fftwf_plan fft_plan
FFTW plan.
Definition: iqbal.c:115
osmo_iqbal_cxvec_optimize
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.
Definition: iqbal.c:301
osmo_cxvec_scale
struct osmo_cxvec * osmo_cxvec_scale(const struct osmo_cxvec *in, float complex scale, struct osmo_cxvec *out)
Scale a complex vector (multiply by a constant)
Definition: cxvec_math.c:55
_iqbal_objfn_gradient
static void _iqbal_objfn_gradient(struct _iqbal_state *state, float x[2], float v, float grad[2])
Optimization objective function - Gradient estimation.
Definition: iqbal.c:260
osmo_cxvec_peak_energy_find
float osmo_cxvec_peak_energy_find(const struct osmo_cxvec *cv, int win_size, enum osmo_cxvec_peak_alg alg, float complex *peak_val_p)
Find the maximum energy ( ) peak in a sequence.
Definition: cxvec_math.c:484
osmo_cxvec_sig_normalize
struct osmo_cxvec * osmo_cxvec_sig_normalize(const struct osmo_cxvec *sig, int decim, float freq_shift, struct osmo_cxvec *out)
'Normalize' an IQ signal and apply decimation/frequency shift
Definition: cxvec_math.c:613
osmo_iqbal_cxvec_estimate
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.
Definition: iqbal.c:206
CONV_FULL_SPAN
@ CONV_FULL_SPAN
Full span (every possible overlap of f onto g)
Definition: cxvec_math.h:88
osmo_cxvec_dbg_dump
void osmo_cxvec_dbg_dump(struct osmo_cxvec *cv, const char *fname)
Save the data contained of a vector into a .cfile for debug.
Definition: cxvec.c:119
cxvec.h
Osmocom Complex vectors header.
osmo_cxvec_init_from_data
void osmo_cxvec_init_from_data(struct osmo_cxvec *cv, float complex *data, int len)
Initialize a vector structure with a given data array.
Definition: cxvec.c:48
cfile::len
unsigned int len
Length (in samples) of the data.
Definition: cfile.h:41
_iqbal_state::feval
int feval
# of function evaluation
Definition: iqbal.c:234
osmo_normsqf
static float osmo_normsqf(float complex c)
Squared norm of a given complex.
Definition: cxvec_math.h:65
osmo_cxvec_conv_type
osmo_cxvec_conv_type
Various possible types of convolution span.
Definition: cxvec_math.h:86
_iqbal_state::org
const struct osmo_cxvec * org
Original vector.
Definition: iqbal.c:232
_iqbal_estimate_state::fft
float complex * fft
Temporary memory for FFT.
Definition: iqbal.c:114
osmo_iqbal_default_opts
const struct osmo_iqbal_opts osmo_iqbal_default_opts
Default values for the optimization algorithm.
Definition: iqbal.c:221
osmo_cxvec::len
int len
Valid length.
Definition: cxvec.h:42
osmo_cxvec_rotate
struct osmo_cxvec * osmo_cxvec_rotate(const struct osmo_cxvec *in, float freq_shift, struct osmo_cxvec *out)
Rotate a complex vector (frequency shift)
Definition: cxvec_math.c:112
iqbal.h
Osmocom IQ balance utils header.
osmo_iqbal_opts::start_at_prev
int start_at_prev
Use prev values as starting point.
Definition: iqbal.h:66
_iqbal_state::opts
const struct osmo_iqbal_opts * opts
Options.
Definition: iqbal.c:231
osmo_cxvec_delay
struct osmo_cxvec * osmo_cxvec_delay(const struct osmo_cxvec *v, float delay, struct osmo_cxvec *out)
Fractionally delay a vector while maintaining its length.
Definition: cxvec_math.c:146
cfile_load
struct cfile * cfile_load(const char *filename)
.cfile loader: mmap() the data into memory (read-only)
Definition: cfile.c:50
osmo_cxvec::data
float complex * data
Data field.
Definition: cxvec.h:45
PEAK_WEIGH_WIN
@ PEAK_WEIGH_WIN
Weigthed position for the max pwr window.
Definition: cxvec_math.h:112
_iqbal_objfn_val_gradient
static float _iqbal_objfn_val_gradient(struct _iqbal_state *state, float x[2], float grad[2])
Optimization objective function - Value & Gradient estimation.
Definition: iqbal.c:282
osmo_iqbal_cxvec_fix
struct osmo_cxvec * osmo_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.
Definition: iqbal.c:94
cfile
Structure representing a currently mapped .cfile.
Definition: cfile.h:39
_iqbal_state
Internal state structure for the IQ balance optimization algorithm.
Definition: iqbal.c:230
osmo_cxvec_alloc
struct osmo_cxvec * osmo_cxvec_alloc(int max_len)
Allocate a complex vector of a given maximum length.
Definition: cxvec.c:83
osmo_cxvec_peaks_scan
int osmo_cxvec_peaks_scan(const struct osmo_cxvec *cv, int *peaks_idx, int N)
Find the index of the N highest energy ( ) peaks.
Definition: cxvec_math.c:438
_iqbal_objfn_value
static float _iqbal_objfn_value(struct _iqbal_state *state, float x[2])
Optimization objective function - Value.
Definition: iqbal.c:244
cfile_release
void cfile_release(struct cfile *cf)
Release all resources associated with a mapped .cfile.
Definition: cfile.c:102
_iqbal_estimate_state
Cache for _osmo_iqbal_estimate when doing lots of calls.
Definition: iqbal.c:113
osmo_cxvec::_data
float complex _data[0]
Optional inline data array.
Definition: cxvec.h:46
osmo_iqbal_opts::max_iter
int max_iter
Max # iterations per pass.
Definition: iqbal.h:65
osmo_cxvec::flags
int flags
Flags, see CXVEC_FLG_xxx.
Definition: cxvec.h:44
CONV_NO_DELAY
@ CONV_NO_DELAY
Center f sequence on every g sample.
Definition: cxvec_math.h:92
osmo_iqbal_opts::fft_count
int fft_count
Number of FFT to use.
Definition: iqbal.h:64
osmo_cxvec_peak_alg
osmo_cxvec_peak_alg
Various possible peak finding algorithms.
Definition: cxvec_math.h:110
osmo_cxvec_interpolate_point
float complex osmo_cxvec_interpolate_point(const struct osmo_cxvec *cv, float pos)
Interpolate any fractional position in a vector using sinc filtering.
Definition: cxvec_math.c:399
osmo_iqbal_estimate
float osmo_iqbal_estimate(const float complex *data, int fft_size, int fft_count)
Objectively estimate IQ balance in a given complex buffer.
Definition: iqbal.c:194
osmo_iqbal_opts::fft_size
int fft_size
FFT size to use.
Definition: iqbal.h:63
cfile::_blen
size_t _blen
Length (in bytes) of the data.
Definition: cfile.h:42
CONV_OVERLAP_ONLY
@ CONV_OVERLAP_ONLY
Every possible full overlap of f onto g.
Definition: cxvec_math.h:90
cxvec_math.h
Osmocom Complex vectors math header.
osmo_cxvec_convolve
struct osmo_cxvec * osmo_cxvec_convolve(const struct osmo_cxvec *f, const struct osmo_cxvec *g, enum osmo_cxvec_conv_type type, struct osmo_cxvec *out)
Convolve two complex vectors.
Definition: cxvec_math.c:228
_osmo_iqbal_estimate_release
static void _osmo_iqbal_estimate_release(struct _iqbal_estimate_state *state)
Release a cache object created by _osmo_iqbal_estimate.
Definition: iqbal.c:120
osmo_iqbal_fix
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.
Definition: iqbal.c:71
_iqbal_state::cache
struct _iqbal_estimate_state * cache
Cache for estimate func.
Definition: iqbal.c:235
cfile::data
float complex * data
Data array (read only !)
Definition: cfile.h:40
cfile.h
Osmocom .cfile helpers header.
osmo_sinc
static float osmo_sinc(float x)
Unnormalized sinc function.
Definition: cxvec_math.h:54
osmo_cxvec_alloc_from_data
struct osmo_cxvec * osmo_cxvec_alloc_from_data(float complex *data, int len)
Allocate a complex vector referencing a given data array.
Definition: cxvec.c:63
_iqbal_state::tmp
struct osmo_cxvec * tmp
Temporary vector.
Definition: iqbal.c:233
osmo_cxvec_free
void osmo_cxvec_free(struct osmo_cxvec *cv)
Free a complex vector (and possibly associated data)
Definition: cxvec.c:109