1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-11 02:46:12 -05:00
sdrangel/wdsp/cfcomp.hpp

153 lines
3.6 KiB
C++
Raw Normal View History

2024-06-16 05:31:13 -04:00
/* cfcomp.h
This file is part of a program that implements a Software-Defined Radio.
Copyright (C) 2017, 2021 Warren Pratt, NR0V
Copyright (C) 2024 Edouard Griffiths, F4EXB Adapted to SDRangel
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.
The author can be reached by email at
warren@wpratt.com
*/
#ifndef wdsp_cfcomp_h
#define wdsp_cfcomp_h
#include "fftw3.h"
#include "export.h"
namespace WDSP {
class TXA;
class WDSP_API CFCOMP
{
public:
int run;
int position;
int bsize;
2024-06-24 21:50:48 -04:00
float* in;
float* out;
2024-06-16 05:31:13 -04:00
int fsize;
int ovrlp;
int incr;
2024-06-24 21:50:48 -04:00
float* window;
2024-06-16 05:31:13 -04:00
int iasize;
2024-06-24 21:50:48 -04:00
float* inaccum;
float* forfftin;
float* forfftout;
2024-06-16 05:31:13 -04:00
int msize;
2024-06-24 21:50:48 -04:00
float* cmask;
float* mask;
2024-06-16 05:31:13 -04:00
int mask_ready;
2024-06-24 21:50:48 -04:00
float* cfc_gain;
float* revfftin;
float* revfftout;
float** save;
2024-06-16 05:31:13 -04:00
int oasize;
2024-06-24 21:50:48 -04:00
float* outaccum;
float rate;
2024-06-16 05:31:13 -04:00
int wintype;
2024-06-24 21:50:48 -04:00
float pregain;
float postgain;
2024-06-16 05:31:13 -04:00
int nsamps;
int iainidx;
int iaoutidx;
int init_oainidx;
int oainidx;
int oaoutidx;
int saveidx;
2024-06-24 21:50:48 -04:00
fftwf_plan Rfor;
fftwf_plan Rrev;
2024-06-16 05:31:13 -04:00
int comp_method;
int nfreqs;
2024-06-24 21:50:48 -04:00
float* F;
float* G;
float* E;
float* fp;
float* gp;
float* ep;
float* comp;
float precomp;
float precomplin;
float* peq;
2024-06-16 05:31:13 -04:00
int peq_run;
2024-06-24 21:50:48 -04:00
float prepeq;
float prepeqlin;
float winfudge;
2024-06-16 05:31:13 -04:00
2024-06-24 21:50:48 -04:00
float gain;
float mtau;
float mmult;
2024-06-16 05:31:13 -04:00
// display stuff
2024-06-24 21:50:48 -04:00
float dtau;
float dmult;
float* delta;
float* delta_copy;
float* cfc_gain_copy;
2024-06-16 05:31:13 -04:00
static CFCOMP* create_cfcomp (
int run,
int position,
int peq_run,
int size,
2024-06-24 21:50:48 -04:00
float* in,
float* out,
2024-06-16 05:31:13 -04:00
int fsize,
int ovrlp,
int rate,
int wintype,
int comp_method,
int nfreqs,
2024-06-24 21:50:48 -04:00
float precomp,
float prepeq,
float* F,
float* G,
float* E,
float mtau,
float dtau
2024-06-16 05:31:13 -04:00
);
static void destroy_cfcomp (CFCOMP *a);
static void flush_cfcomp (CFCOMP *a);
static void xcfcomp (CFCOMP *a, int pos);
2024-06-24 21:50:48 -04:00
static void setBuffers_cfcomp (CFCOMP *a, float* in, float* out);
2024-06-16 05:31:13 -04:00
static void setSamplerate_cfcomp (CFCOMP *a, int rate);
static void setSize_cfcomp (CFCOMP *a, int size);
// TXA Properties
static void SetCFCOMPRun (TXA& txa, int run);
static void SetCFCOMPPosition (TXA& txa, int pos);
2024-06-24 21:50:48 -04:00
static void SetCFCOMPprofile (TXA& txa, int nfreqs, float* F, float* G, float *E);
static void SetCFCOMPPrecomp (TXA& txa, float precomp);
2024-06-16 05:31:13 -04:00
static void SetCFCOMPPeqRun (TXA& txa, int run);
2024-06-24 21:50:48 -04:00
static void SetCFCOMPPrePeq (TXA& txa, float prepeq);
static void GetCFCOMPDisplayCompression (TXA& txa, float* comp_values, int* ready);
2024-06-16 05:31:13 -04:00
private:
static void calc_cfcwindow (CFCOMP *a);
static int fCOMPcompare (const void *a, const void *b);
static void calc_comp (CFCOMP *a);
static void calc_cfcomp(CFCOMP *a);
static void decalc_cfcomp(CFCOMP *a);
static void calc_mask (CFCOMP *a);
};
} // namespace WDSP
#endif