libosmodsp 0.4.0.12-f6f4 Osmocom DSP library

iqbal.h
Go to the documentation of this file.
1/*
2 * iqbal.h
3 *
4 * IQ balance correction / estimation utilities
5 *
6 * Copyright (C) 2013 Sylvain Munaut <tnt@246tNt.com>
7 *
8 * All Rights Reserved
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 */
24
25#ifndef __OSMO_DSP_IQBAL_H__
26#define __OSMO_DSP_IQBAL_H__
27
36#include <complex.h>
37
38#include <osmocom/dsp/cxvec.h>
39
40
41/* IQ balance correction and estimation */
42
43 void osmo_iqbal_fix(float complex *out, float complex *in, unsigned int len,
44 float mag, float phase);
45
46 struct osmo_cxvec *
47 osmo_iqbal_cxvec_fix(const struct osmo_cxvec *in, float mag, float phase,
48 struct osmo_cxvec *out);
49
50 float
51 osmo_iqbal_estimate(const float complex *data,
52 int fft_size, int fft_count);
53
54 float
55 osmo_iqbal_cxvec_estimate(const struct osmo_cxvec *sig,
56 int fft_size, int fft_count);
57
58
59/* IQ balance optimization */
60
62 struct osmo_iqbal_opts {
63 int fft_size;
64 int fft_count;
65 int max_iter;
66 int start_at_prev;
67};
68
69 extern const struct osmo_iqbal_opts osmo_iqbal_default_opts;
70
71 int
72 osmo_iqbal_cxvec_optimize(const struct osmo_cxvec *sig, float *mag, float *phase,
73 const struct osmo_iqbal_opts *opts);
74
77#endif /* __OSMO_DSP_IQBAL_H__ */
cxvec.h
Osmocom Complex vectors header.
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
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_default_opts
const struct osmo_iqbal_opts osmo_iqbal_default_opts
Default values for the optimization algorithm.
Definition: iqbal.c:221
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
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
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
Complex vector.
Definition: cxvec.h:41
osmo_cxvec::data
float complex * data
Data field.
Definition: cxvec.h:45
osmo_iqbal_opts
Processing options for the IQ balance optimization algorithm.
Definition: iqbal.h:62
osmo_iqbal_opts::fft_size
int fft_size
FFT size to use.
Definition: iqbal.h:63
osmo_iqbal_opts::fft_count
int fft_count
Number of FFT to use.
Definition: iqbal.h:64
osmo_iqbal_opts::max_iter
int max_iter
Max # iterations per pass.
Definition: iqbal.h:65
osmo_iqbal_opts::start_at_prev
int start_at_prev
Use prev values as starting point.
Definition: iqbal.h:66