\doxysection{src/iqbal.c File Reference} \label{iqbal_8c}\index{src/iqbal.c@{src/iqbal.c}} IQ balance utils implementation. \doxysubsection*{Data Structures} \begin{DoxyCompactItemize} \item struct \textbf{ \+\_\+iqbal\+\_\+estimate\+\_\+state} \begin{DoxyCompactList}\small\item\em Cache for \doxyref{\+\_\+osmo\+\_\+iqbal\+\_\+estimate}{p.}{group__iqbal_ga129881cae54362d61dd2b4460f8af248} when doing lots of calls. \end{DoxyCompactList}\item struct \textbf{ \+\_\+iqbal\+\_\+state} \begin{DoxyCompactList}\small\item\em Internal state structure for the IQ balance optimization algorithm. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection*{Functions} \begin{DoxyCompactItemize} \item void \textbf{ osmo\+\_\+iqbal\+\_\+fix} (float complex $\ast$out, float complex $\ast$in, unsigned int len, float mag, float phase) \begin{DoxyCompactList}\small\item\em Apply IQ balance correction to a given complex buffer. \end{DoxyCompactList}\item struct \textbf{ osmo\+\_\+cxvec} $\ast$ \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$in, float mag, float phase, struct \textbf{ osmo\+\_\+cxvec} $\ast$out) \begin{DoxyCompactList}\small\item\em Apply IQ balance correction to a given complex vector. \end{DoxyCompactList}\item static void {\bfseries \+\_\+osmo\+\_\+iqbal\+\_\+estimate\+\_\+release} (struct \textbf{ \+\_\+iqbal\+\_\+estimate\+\_\+state} $\ast$state) \begin{DoxyCompactList}\small\item\em Release a cache object created by \doxyref{\+\_\+osmo\+\_\+iqbal\+\_\+estimate}{p.}{group__iqbal_ga129881cae54362d61dd2b4460f8af248}. \end{DoxyCompactList}\item static float \textbf{ \+\_\+osmo\+\_\+iqbal\+\_\+estimate} (const float complex $\ast$data, int fft\+\_\+size, int fft\+\_\+count, struct \textbf{ \+\_\+iqbal\+\_\+estimate\+\_\+state} $\ast$$\ast$state\+\_\+p) \begin{DoxyCompactList}\small\item\em Objectively estimate IQ balance in a given complex buffer. \end{DoxyCompactList}\item float \textbf{ osmo\+\_\+iqbal\+\_\+estimate} (const float complex $\ast$data, int fft\+\_\+size, int fft\+\_\+count) \begin{DoxyCompactList}\small\item\em Objectively estimate IQ balance in a given complex buffer. \end{DoxyCompactList}\item float \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+estimate} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$sig, int fft\+\_\+size, int fft\+\_\+count) \begin{DoxyCompactList}\small\item\em Objectively estimate IQ balance in a given complex vector. \end{DoxyCompactList}\item static float \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+value} (struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$state, float x[2]) \begin{DoxyCompactList}\small\item\em Optimization objective function -\/ Value. \end{DoxyCompactList}\item static void \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+gradient} (struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$state, float x[2], float v, float grad[2]) \begin{DoxyCompactList}\small\item\em Optimization objective function -\/ Gradient estimation. \end{DoxyCompactList}\item static float \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient} (struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$state, float x[2], float grad[2]) \begin{DoxyCompactList}\small\item\em Optimization objective function -\/ Value \& Gradient estimation. \end{DoxyCompactList}\item int \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$sig, float $\ast$mag, float $\ast$phase, const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} $\ast$opts) \begin{DoxyCompactList}\small\item\em Finds the best IQ balance correction parameters for a given signal. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection*{Variables} \begin{DoxyCompactItemize} \item const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} \textbf{ osmo\+\_\+iqbal\+\_\+default\+\_\+opts} \begin{DoxyCompactList}\small\item\em Default values for the optimization algorithm. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection{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 \+: {\texttt{ http\+://sdrsharp.\+com/index.\+php/automatic-\/iq-\/correction-\/algorithm}} The main differences are\+: \begin{DoxyItemize} \item Objective function uses complex correlation of left/right side of FFT \item Optimization based on steepest gradient with dynamic step size \end{DoxyItemize}