diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2013-02-19 21:58:24 +0100 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2013-02-19 21:58:24 +0100 |
commit | 0c982dabb70cb5c777a546c7d6abfd6d164413b8 (patch) | |
tree | 1bdd60fed465cb28e06b78c13c5a2c0b1cfe0382 /include | |
parent | f352adfde5c12949d1be3beaa178456dc87f2091 (diff) |
iqbal: Import new module to deal with IQ balance correction/optimization
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/dsp/Makefile.am | 2 | ||||
-rw-r--r-- | include/osmocom/dsp/iqbal.h | 77 |
2 files changed, 78 insertions, 1 deletions
diff --git a/include/osmocom/dsp/Makefile.am b/include/osmocom/dsp/Makefile.am index 5a6534f..24c4c4a 100644 --- a/include/osmocom/dsp/Makefile.am +++ b/include/osmocom/dsp/Makefile.am @@ -1,3 +1,3 @@ -osmodsp_HEADERS = cfile.h cxvec.h cxvec_math.h +osmodsp_HEADERS = cfile.h cxvec.h cxvec_math.h iqbal.h osmodspdir = $(includedir)/osmocom/dsp diff --git a/include/osmocom/dsp/iqbal.h b/include/osmocom/dsp/iqbal.h new file mode 100644 index 0000000..c7f7e60 --- /dev/null +++ b/include/osmocom/dsp/iqbal.h @@ -0,0 +1,77 @@ +/* + * iqbal.h + * + * IQ balance correction / estimation utilities + * + * Copyright (C) 2013 Sylvain Munaut <tnt@246tNt.com> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __OSMO_DSP_IQBAL_H__ +#define __OSMO_DSP_IQBAL_H__ + +/*! \defgroup iqbal IQ balance utilities + * @{ + */ + +/*! \file iqbal.h + * \brief Osmocom IQ balance utils header + */ + +#include <complex.h> + +#include <osmocom/dsp/cxvec.h> + + +/* IQ balance correction and estimation */ + +void osmo_iqbal_fix(float complex *out, float complex *in, unsigned int len, + float mag, float phase); + +struct osmo_cxvec * +osmo_iqbal_cxvec_fix(const struct osmo_cxvec *in, float mag, float phase, + struct osmo_cxvec *out); + +float +osmo_iqbal_estimate(const float complex *data, + int fft_size, int fft_count); + +float +osmo_iqbal_cxvec_estimate(const struct osmo_cxvec *sig, + int fft_size, int fft_count); + + +/* IQ balance optimization */ + +/*! \brief Processing options for the IQ balance optimization algorithm */ +struct osmo_iqbal_opts { + int fft_size; /*!< \brief FFT size to use */ + int fft_count; /*!< \brief Number of FFT to use */ + int max_iter; /*!< \brief Max # iterations per pass */ + int start_at_prev; /*!< \brief Use prev values as starting point */ +}; + +extern const struct osmo_iqbal_opts osmo_iqbal_default_opts; + +int +osmo_iqbal_cxvec_optimize(const struct osmo_cxvec *sig, float *mag, float *phase, + const struct osmo_iqbal_opts *opts); + +/*! @} */ + +#endif /* __OSMO_DSP_IQBAL_H__ */ |