mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
WDSP corrections
This commit is contained in:
parent
b2303b028c
commit
8d9dc3b5ed
@ -578,9 +578,9 @@ void RXA::destroy_rxa (RXA *rxa)
|
||||
|
||||
void RXA::flush_rxa (RXA *rxa)
|
||||
{
|
||||
memset (rxa->inbuff, 0, 1 * rxa->dsp_insize * sizeof (dcomplex));
|
||||
memset (rxa->outbuff, 0, 1 * rxa->dsp_outsize * sizeof (dcomplex));
|
||||
memset (rxa->midbuff, 0, 2 * rxa->dsp_size * sizeof (dcomplex));
|
||||
memset (rxa->inbuff, 0, 1 * rxa->dsp_insize * sizeof (wcomplex));
|
||||
memset (rxa->outbuff, 0, 1 * rxa->dsp_outsize * sizeof (wcomplex));
|
||||
memset (rxa->midbuff, 0, 2 * rxa->dsp_size * sizeof (wcomplex));
|
||||
SHIFT::flush_shift (rxa->shift.p);
|
||||
RESAMPLE::flush_resample (rxa->rsmpin.p);
|
||||
GEN::flush_gen (rxa->gen0.p);
|
||||
|
@ -565,9 +565,9 @@ void TXA::destroy_txa (TXA *txa)
|
||||
|
||||
void TXA::flush_txa (TXA* txa)
|
||||
{
|
||||
memset (txa->inbuff, 0, 1 * txa->dsp_insize * sizeof (dcomplex));
|
||||
memset (txa->outbuff, 0, 1 * txa->dsp_outsize * sizeof (dcomplex));
|
||||
memset (txa->midbuff, 0, 2 * txa->dsp_size * sizeof (dcomplex));
|
||||
memset (txa->inbuff, 0, 1 * txa->dsp_insize * sizeof (wcomplex));
|
||||
memset (txa->outbuff, 0, 1 * txa->dsp_outsize * sizeof (wcomplex));
|
||||
memset (txa->midbuff, 0, 2 * txa->dsp_size * sizeof (wcomplex));
|
||||
RESAMPLE::flush_resample (txa->rsmpin.p);
|
||||
GEN::flush_gen (txa->gen0.p);
|
||||
PANEL::flush_panel (txa->panel.p);
|
||||
|
@ -247,7 +247,7 @@ void AMD::xamd (AMD *a)
|
||||
}
|
||||
else if (a->in_buff != a->out_buff)
|
||||
{
|
||||
memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof(dcomplex));
|
||||
memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof(wcomplex));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ void AMMOD::xammod(AMMOD *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void AMMOD::setBuffers_ammod(AMMOD *a, double* in, double* out)
|
||||
|
@ -57,7 +57,7 @@ void AMSQ::compute_slews(AMSQ *a)
|
||||
void AMSQ::calc_amsq(AMSQ *a)
|
||||
{
|
||||
// signal averaging
|
||||
a->trigsig = new double[a->size * 2]; // (double *)malloc0(a->size * sizeof(dcomplex));
|
||||
a->trigsig = new double[a->size * 2]; // (double *)malloc0(a->size * sizeof(wcomplex));
|
||||
a->avm = exp(-1.0 / (a->rate * a->avtau));
|
||||
a->onem_avm = 1.0 - a->avm;
|
||||
a->avsig = 0.0;
|
||||
@ -108,7 +108,7 @@ void AMSQ::destroy_amsq (AMSQ *a)
|
||||
|
||||
void AMSQ::flush_amsq (AMSQ*a)
|
||||
{
|
||||
memset (a->trigsig, 0, a->size * sizeof (dcomplex));
|
||||
memset (a->trigsig, 0, a->size * sizeof (wcomplex));
|
||||
a->avsig = 0.0;
|
||||
a->state = 0;
|
||||
}
|
||||
@ -180,12 +180,12 @@ void AMSQ::xamsq (AMSQ *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void AMSQ::xamsqcap (AMSQ *a)
|
||||
{
|
||||
memcpy (a->trigsig, a->trigger, a->size * sizeof (dcomplex));
|
||||
memcpy (a->trigsig, a->trigger, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void AMSQ::setBuffers_amsq (AMSQ *a, double* in, double* out, double* trigger)
|
||||
|
@ -139,7 +139,7 @@ void ANF::xanf(ANF *a, int position)
|
||||
}
|
||||
}
|
||||
else if (a->in_buff != a->out_buff)
|
||||
memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (dcomplex));
|
||||
memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void ANF::flush_anf (ANF *a)
|
||||
|
@ -142,7 +142,7 @@ void ANR::xanr (ANR *a, int position)
|
||||
}
|
||||
}
|
||||
else if (a->in_buff != a->out_buff)
|
||||
memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (dcomplex));
|
||||
memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void ANR::flush_anr (ANR *a)
|
||||
|
@ -80,7 +80,7 @@ void BANDPASS::xbandpass (BANDPASS *a, int pos)
|
||||
if (a->run && a->position == pos)
|
||||
FIRCORE::xfircore (a->p);
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void BANDPASS::setBuffers_bandpass (BANDPASS *a, double* in, double* out)
|
||||
|
12
wdsp/bps.cpp
12
wdsp/bps.cpp
@ -45,8 +45,8 @@ namespace WDSP {
|
||||
void BPS::calc_bps (BPS *a)
|
||||
{
|
||||
double* impulse;
|
||||
a->infilt = new double[2 * a->size * 2]; // (double *)malloc0(2 * a->size * sizeof(dcomplex));
|
||||
a->product = new double[2 * a->size * 2]; // (double *)malloc0(2 * a->size * sizeof(dcomplex));
|
||||
a->infilt = new double[2 * a->size * 2]; // (double *)malloc0(2 * a->size * sizeof(wcomplex));
|
||||
a->product = new double[2 * a->size * 2]; // (double *)malloc0(2 * a->size * sizeof(wcomplex));
|
||||
impulse = FIR::fir_bandpass(a->size + 1, a->f_low, a->f_high, a->samplerate, a->wintype, 1, 1.0 / (double)(2 * a->size));
|
||||
a->mults = FIR::fftcv_mults(2 * a->size, impulse);
|
||||
a->CFor = fftw_plan_dft_1d(2 * a->size, (fftw_complex *)a->infilt, (fftw_complex *)a->product, FFTW_FORWARD, FFTW_PATIENT);
|
||||
@ -89,7 +89,7 @@ void BPS::destroy_bps (BPS *a)
|
||||
|
||||
void BPS::flush_bps (BPS *a)
|
||||
{
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void BPS::xbps (BPS *a, int pos)
|
||||
@ -98,7 +98,7 @@ void BPS::xbps (BPS *a, int pos)
|
||||
double I, Q;
|
||||
if (a->run && pos == a->position)
|
||||
{
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
fftw_execute (a->CFor);
|
||||
for (i = 0; i < 2 * a->size; i++)
|
||||
{
|
||||
@ -108,10 +108,10 @@ void BPS::xbps (BPS *a, int pos)
|
||||
a->product[2 * i + 1] = I * a->mults[2 * i + 1] + Q * a->mults[2 * i + 0];
|
||||
}
|
||||
fftw_execute (a->CRev);
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(dcomplex));
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void BPS::setBuffers_bps (BPS *a, double* in, double* out)
|
||||
|
@ -29,7 +29,7 @@ warren@wpratt.com
|
||||
|
||||
namespace WDSP {
|
||||
|
||||
const double GG[241 * 241] = {
|
||||
const double Calculus::GG[241 * 241] = {
|
||||
7.25654181154076983e-01, 7.05038822098223439e-01, 6.85008217584843870e-01, 6.65545775927326222e-01,
|
||||
6.46635376294157682e-01, 6.28261355371665386e-01, 6.10408494407843394e-01, 5.93062006626410732e-01,
|
||||
5.76207525000389742e-01, 5.59831090374464435e-01, 5.43919139925240769e-01, 5.28458495948192608e-01,
|
||||
@ -14552,7 +14552,7 @@ const double GG[241 * 241] = {
|
||||
1.00000000000000000e+00, 1.00000000000000000e+00, 1.00000000000000000e+00, 1.00000000000000000e+00,
|
||||
1.00000000000000000e+00 };
|
||||
|
||||
const double GGS[241 * 241] = {
|
||||
const double Calculus::GGS[241 * 241] = {
|
||||
8.00014908335353492e-01, 8.00020707540703313e-01, 8.00026700706648830e-01, 8.00032894400760863e-01,
|
||||
8.00039295417528384e-01, 8.00045910786425396e-01, 8.00052747780268358e-01, 8.00059813923879481e-01,
|
||||
8.00067117003061101e-01, 8.00074665073896907e-01, 8.00082466472385456e-01, 8.00090529824419749e-01,
|
||||
|
@ -95,7 +95,7 @@ void CBL::xcbl (CBL *a)
|
||||
}
|
||||
}
|
||||
else if (a->in_buff != a->out_buff)
|
||||
memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (dcomplex));
|
||||
memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void CBL::setBuffers_cbl (CBL *a, double* in, double* out)
|
||||
|
@ -387,7 +387,7 @@ void CFCOMP::xcfcomp (CFCOMP *a, int pos)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->bsize * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->bsize * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void CFCOMP::setBuffers_cfcomp (CFCOMP *a, double* in, double* out)
|
||||
|
@ -98,7 +98,7 @@ void CFIR::xcfir (CFIR *a)
|
||||
if (a->run)
|
||||
FIRCORE::xfircore (a->p);
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void CFIR::setBuffers_cfir (CFIR *a, double* in, double* out)
|
||||
|
@ -25,6 +25,9 @@ warren@wpratt.com
|
||||
|
||||
*/
|
||||
|
||||
#ifndef wdsp_comm_h
|
||||
#define wdsp_comm_h
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
#define APPNAME "WDSP"
|
||||
@ -71,10 +74,14 @@ warren@wpratt.com
|
||||
#define PI 3.1415926535897932
|
||||
#define TWOPI 6.2831853071795864
|
||||
|
||||
namespace WDSP {
|
||||
// miscellaneous
|
||||
typedef double dcomplex[2];
|
||||
typedef double wcomplex[2];
|
||||
}
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <cstdint>
|
||||
#include <algorithm>
|
||||
|
||||
#endif
|
||||
|
@ -74,7 +74,7 @@ void COMPRESSOR::xcompressor (COMPRESSOR *a)
|
||||
a->outbuff[2 * i + 1] = 0.0;
|
||||
}
|
||||
else if (a->inbuff != a->outbuff)
|
||||
memcpy(a->outbuff, a->inbuff, a->buffsize * sizeof (dcomplex));
|
||||
memcpy(a->outbuff, a->inbuff, a->buffsize * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void COMPRESSOR::setBuffers_compressor (COMPRESSOR *a, double* in, double* out)
|
||||
|
@ -67,7 +67,7 @@ void DELAY::destroy_delay (DELAY *a)
|
||||
|
||||
void DELAY::flush_delay (DELAY *a)
|
||||
{
|
||||
memset (a->ring, 0, a->cpp * sizeof (dcomplex));
|
||||
memset (a->ring, 0, a->cpp * sizeof (wcomplex));
|
||||
a->idx_in = 0;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ void DELAY::xdelay (DELAY *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
|
@ -874,7 +874,7 @@ void EMNR::xemnr (EMNR *a, int pos)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->bsize * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->bsize * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void EMNR::setBuffers_emnr (EMNR *a, double* in, double* out)
|
||||
|
@ -76,7 +76,7 @@ void EMPHP::xemphp (EMPHP *a, int position)
|
||||
if (a->run && a->position == position)
|
||||
FIRCORE::xfircore (a->p);
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void EMPHP::setBuffers_emphp (EMPHP *a, double* in, double* out)
|
||||
@ -210,7 +210,7 @@ void EMPH::destroy_emph (EMPH *a)
|
||||
|
||||
void EMPH::flush_emph (EMPH *a)
|
||||
{
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void EMPH::xemph (EMPH *a, int position)
|
||||
@ -219,7 +219,7 @@ void EMPH::xemph (EMPH *a, int position)
|
||||
double I, Q;
|
||||
if (a->run && a->position == position)
|
||||
{
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
fftw_execute (a->CFor);
|
||||
for (i = 0; i < 2 * a->size; i++)
|
||||
{
|
||||
@ -229,10 +229,10 @@ void EMPH::xemph (EMPH *a, int position)
|
||||
a->product[2 * i + 1] = I * a->mults[2 * i + 1] + Q * a->mults[2 * i + 0];
|
||||
}
|
||||
fftw_execute (a->CRev);
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(dcomplex));
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void EMPH::setBuffers_emph (EMPH *a, double* in, double* out)
|
||||
|
10
wdsp/eq.cpp
10
wdsp/eq.cpp
@ -225,7 +225,7 @@ void EQP::xeqp (EQP *a)
|
||||
if (a->run)
|
||||
FIRCORE::xfircore (a->p);
|
||||
else
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void EQP::setBuffers_eqp (EQP *a, double* in, double* out)
|
||||
@ -585,7 +585,7 @@ void EQ::destroy_eq (EQ *a)
|
||||
|
||||
void EQ::flush_eq (EQ *a)
|
||||
{
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void EQ::xeq (EQ *a)
|
||||
@ -594,7 +594,7 @@ void EQ::xeq (EQ *a)
|
||||
double I, Q;
|
||||
if (a->run)
|
||||
{
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
fftw_execute (a->CFor);
|
||||
for (i = 0; i < 2 * a->size; i++)
|
||||
{
|
||||
@ -604,10 +604,10 @@ void EQ::xeq (EQ *a)
|
||||
a->product[2 * i + 1] = I * a->mults[2 * i + 1] + Q * a->mults[2 * i + 0];
|
||||
}
|
||||
fftw_execute (a->CRev);
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(dcomplex));
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void EQ::setBuffers_eq (EQ *a, double* in, double* out)
|
||||
|
18
wdsp/fir.cpp
18
wdsp/fir.cpp
@ -33,13 +33,13 @@ namespace WDSP {
|
||||
|
||||
double* FIR::fftcv_mults (int NM, double* c_impulse)
|
||||
{
|
||||
double* mults = new double[NM * 2]; // (double *) malloc0 (NM * sizeof (dcomplex));
|
||||
double* cfft_impulse = new double[NM * 2]; // (double *) malloc0 (NM * sizeof (dcomplex));
|
||||
double* mults = new double[NM * 2]; // (double *) malloc0 (NM * sizeof (wcomplex));
|
||||
double* cfft_impulse = new double[NM * 2]; // (double *) malloc0 (NM * sizeof (wcomplex));
|
||||
fftw_plan ptmp = fftw_plan_dft_1d(NM, (fftw_complex *) cfft_impulse,
|
||||
(fftw_complex *) mults, FFTW_FORWARD, FFTW_PATIENT);
|
||||
memset (cfft_impulse, 0, NM * sizeof (dcomplex));
|
||||
memset (cfft_impulse, 0, NM * sizeof (wcomplex));
|
||||
// store complex coefs right-justified in the buffer
|
||||
memcpy (&(cfft_impulse[NM - 2]), c_impulse, (NM / 2 + 1) * sizeof(dcomplex));
|
||||
memcpy (&(cfft_impulse[NM - 2]), c_impulse, (NM / 2 + 1) * sizeof(wcomplex));
|
||||
fftw_execute (ptmp);
|
||||
fftw_destroy_plan (ptmp);
|
||||
delete[] cfft_impulse;
|
||||
@ -91,8 +91,8 @@ double* FIR::fir_fsamp_odd (int N, double* A, int rtype, double scale, int winty
|
||||
int mid = (N - 1) / 2;
|
||||
double mag, phs;
|
||||
double* window;
|
||||
double *fcoef = new double[N * 2]; // (double *) malloc0 (N * sizeof (dcomplex));
|
||||
double *c_impulse = new double[N * 2]; // (double *) malloc0 (N * sizeof (dcomplex));
|
||||
double *fcoef = new double[N * 2]; // (double *) malloc0 (N * sizeof (wcomplex));
|
||||
double *c_impulse = new double[N * 2]; // (double *) malloc0 (N * sizeof (wcomplex));
|
||||
fftw_plan ptmp = fftw_plan_dft_1d(N, (fftw_complex *)fcoef, (fftw_complex *)c_impulse, FFTW_BACKWARD, FFTW_PATIENT);
|
||||
double local_scale = 1.0 / (double)N;
|
||||
for (i = 0; i <= mid; i++)
|
||||
@ -339,7 +339,7 @@ void FIR::mp_imp (int N, double* fir, double* mpfir, int pfactor, int polarity)
|
||||
double* ana = new double[size * 2]; // (double *) malloc0 (size * sizeof (complex));
|
||||
double* impulse = new double[size * 2]; // (double *) malloc0 (size * sizeof (complex));
|
||||
double* newfreq = new double[size * 2]; // (double *) malloc0 (size * sizeof (complex));
|
||||
memcpy (firpad, fir, N * sizeof (dcomplex));
|
||||
memcpy (firpad, fir, N * sizeof (wcomplex));
|
||||
fftw_plan pfor = fftw_plan_dft_1d (size, (fftw_complex *) firpad,
|
||||
(fftw_complex *) firfreq, FFTW_FORWARD, FFTW_PATIENT);
|
||||
fftw_plan prev = fftw_plan_dft_1d (size, (fftw_complex *) newfreq,
|
||||
@ -365,9 +365,9 @@ void FIR::mp_imp (int N, double* fir, double* mpfir, int pfactor, int polarity)
|
||||
}
|
||||
fftw_execute (prev);
|
||||
if (polarity)
|
||||
memcpy (mpfir, &impulse[2 * (pfactor - 1) * N], N * sizeof (dcomplex));
|
||||
memcpy (mpfir, &impulse[2 * (pfactor - 1) * N], N * sizeof (wcomplex));
|
||||
else
|
||||
memcpy (mpfir, impulse, N * sizeof (dcomplex));
|
||||
memcpy (mpfir, impulse, N * sizeof (wcomplex));
|
||||
// print_impulse("min_imp.txt", N, mpfir, 1, 0);
|
||||
fftw_destroy_plan (prev);
|
||||
fftw_destroy_plan (pfor);
|
||||
|
@ -74,7 +74,7 @@ void FIRMIN::destroy_firmin (FIRMIN *a)
|
||||
|
||||
void FIRMIN::flush_firmin (FIRMIN *a)
|
||||
{
|
||||
memset (a->ring, 0, a->rsize * sizeof (dcomplex));
|
||||
memset (a->ring, 0, a->rsize * sizeof (wcomplex));
|
||||
a->idx = 0;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ void FIRMIN::xfirmin (FIRMIN *a, int pos)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void FIRMIN::setBuffers_firmin (FIRMIN *a, double* in, double* out)
|
||||
@ -168,7 +168,7 @@ void FIROPT::calc_firopt (FIROPT *a)
|
||||
{
|
||||
// I right-justified the impulse response => take output from left side of output buff, discard right side
|
||||
// Be careful about flipping an asymmetrical impulse response.
|
||||
memcpy (&(a->maskgen[2 * a->size]), &(impulse[2 * a->size * i]), a->size * sizeof(dcomplex));
|
||||
memcpy (&(a->maskgen[2 * a->size]), &(impulse[2 * a->size * i]), a->size * sizeof(wcomplex));
|
||||
fftw_execute (a->maskplan[i]);
|
||||
}
|
||||
delete[] (impulse);
|
||||
@ -223,9 +223,9 @@ void FIROPT::destroy_firopt (FIROPT *a)
|
||||
void FIROPT::flush_firopt (FIROPT *a)
|
||||
{
|
||||
int i;
|
||||
memset (a->fftin, 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->fftin, 0, 2 * a->size * sizeof (wcomplex));
|
||||
for (i = 0; i < a->nfor; i++)
|
||||
memset (a->fftout[i], 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->fftout[i], 0, 2 * a->size * sizeof (wcomplex));
|
||||
a->buffidx = 0;
|
||||
}
|
||||
|
||||
@ -234,10 +234,10 @@ void FIROPT::xfiropt (FIROPT *a, int pos)
|
||||
if (a->run && (a->position == pos))
|
||||
{
|
||||
int i, j, k;
|
||||
memcpy (&(a->fftin[2 * a->size]), a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (&(a->fftin[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
fftw_execute (a->pcfor[a->buffidx]);
|
||||
k = a->buffidx;
|
||||
memset (a->accum, 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->accum, 0, 2 * a->size * sizeof (wcomplex));
|
||||
for (j = 0; j < a->nfor; j++)
|
||||
{
|
||||
for (i = 0; i < 2 * a->size; i++)
|
||||
@ -249,10 +249,10 @@ void FIROPT::xfiropt (FIROPT *a, int pos)
|
||||
}
|
||||
a->buffidx = (a->buffidx + 1) & a->idxmask;
|
||||
fftw_execute (a->crev);
|
||||
memcpy (a->fftin, &(a->fftin[2 * a->size]), a->size * sizeof(dcomplex));
|
||||
memcpy (a->fftin, &(a->fftin[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void FIROPT::setBuffers_firopt (FIROPT *a, double* in, double* out)
|
||||
@ -332,12 +332,12 @@ void FIRCORE::calc_fircore (FIRCORE *a, int flip)
|
||||
if (a->mp)
|
||||
FIR::mp_imp (a->nc, a->impulse, a->imp, 16, 0);
|
||||
else
|
||||
memcpy (a->imp, a->impulse, a->nc * sizeof (dcomplex));
|
||||
memcpy (a->imp, a->impulse, a->nc * sizeof (wcomplex));
|
||||
for (i = 0; i < a->nfor; i++)
|
||||
{
|
||||
// I right-justified the impulse response => take output from left side of output buff, discard right side
|
||||
// Be careful about flipping an asymmetrical impulse response.
|
||||
memcpy (&(a->maskgen[2 * a->size]), &(a->imp[2 * a->size * i]), a->size * sizeof(dcomplex));
|
||||
memcpy (&(a->maskgen[2 * a->size]), &(a->imp[2 * a->size * i]), a->size * sizeof(wcomplex));
|
||||
fftw_execute (a->maskplan[1 - a->cset][i]);
|
||||
}
|
||||
a->masks_ready = 1;
|
||||
@ -362,7 +362,7 @@ FIRCORE* FIRCORE::create_fircore (int size, double* in, double* out, int nc, int
|
||||
plan_fircore (a);
|
||||
a->impulse = new double[a->nc * 2]; // (double *) malloc0 (a->nc * sizeof (complex));
|
||||
a->imp = new double[a->nc * 2]; // (double *) malloc0 (a->nc * sizeof (complex));
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (dcomplex));
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex));
|
||||
calc_fircore (a, 1);
|
||||
return a;
|
||||
}
|
||||
@ -404,19 +404,19 @@ void FIRCORE::destroy_fircore (FIRCORE *a)
|
||||
void FIRCORE::flush_fircore (FIRCORE *a)
|
||||
{
|
||||
int i;
|
||||
memset (a->fftin, 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->fftin, 0, 2 * a->size * sizeof (wcomplex));
|
||||
for (i = 0; i < a->nfor; i++)
|
||||
memset (a->fftout[i], 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->fftout[i], 0, 2 * a->size * sizeof (wcomplex));
|
||||
a->buffidx = 0;
|
||||
}
|
||||
|
||||
void FIRCORE::xfircore (FIRCORE *a)
|
||||
{
|
||||
int i, j, k;
|
||||
memcpy (&(a->fftin[2 * a->size]), a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (&(a->fftin[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
fftw_execute (a->pcfor[a->buffidx]);
|
||||
k = a->buffidx;
|
||||
memset (a->accum, 0, 2 * a->size * sizeof (dcomplex));
|
||||
memset (a->accum, 0, 2 * a->size * sizeof (wcomplex));
|
||||
a->update.lock();
|
||||
for (j = 0; j < a->nfor; j++)
|
||||
{
|
||||
@ -430,7 +430,7 @@ void FIRCORE::xfircore (FIRCORE *a)
|
||||
a->update.unlock();
|
||||
a->buffidx = (a->buffidx + 1) & a->idxmask;
|
||||
fftw_execute (a->crev);
|
||||
memcpy (a->fftin, &(a->fftin[2 * a->size]), a->size * sizeof(dcomplex));
|
||||
memcpy (a->fftin, &(a->fftin[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
}
|
||||
|
||||
void FIRCORE::setBuffers_fircore (FIRCORE *a, double* in, double* out)
|
||||
@ -452,7 +452,7 @@ void FIRCORE::setSize_fircore (FIRCORE *a, int size)
|
||||
|
||||
void FIRCORE::setImpulse_fircore (FIRCORE *a, double* impulse, int update)
|
||||
{
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (dcomplex));
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex));
|
||||
calc_fircore (a, update);
|
||||
}
|
||||
|
||||
@ -466,7 +466,7 @@ void FIRCORE::setNc_fircore (FIRCORE *a, int nc, double* impulse)
|
||||
plan_fircore (a);
|
||||
a->imp = new double[a->nc * 2]; // (double *) malloc0 (a->nc * sizeof (complex));
|
||||
a->impulse = new double[a->nc * 2]; // (double *) malloc0 (a->nc * sizeof (complex));
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (dcomplex));
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex));
|
||||
calc_fircore (a, 1);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void FMD::destroy_fmd (FMD *a)
|
||||
|
||||
void FMD::flush_fmd (FMD *a)
|
||||
{
|
||||
memset (a->audio, 0, a->size * sizeof (dcomplex));
|
||||
memset (a->audio, 0, a->size * sizeof (wcomplex));
|
||||
FIRCORE::flush_fircore (a->pde);
|
||||
FIRCORE::flush_fircore (a->paud);
|
||||
a->phs = 0.0;
|
||||
@ -214,7 +214,7 @@ void FMD::xfmd (FMD *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void FMD::setBuffers_fmd (FMD *a, double* in, double* out)
|
||||
|
@ -127,7 +127,7 @@ void FMMOD::xfmmod (FMMOD *a)
|
||||
FIRCORE::xfircore (a->p);
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void FMMOD::setBuffers_fmmod (FMMOD *a, double* in, double* out)
|
||||
|
@ -226,7 +226,7 @@ void FMSQ::xfmsq (FMSQ *a)
|
||||
}
|
||||
}
|
||||
else if (a->insig != a->outsig)
|
||||
memcpy (a->outsig, a->insig, a->size * sizeof (dcomplex));
|
||||
memcpy (a->outsig, a->insig, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void FMSQ::setBuffers_fmsq (FMSQ *a, double* in, double* out, double* trig)
|
||||
|
@ -71,7 +71,7 @@ void GAIN::xgain (GAIN *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
|
@ -350,13 +350,13 @@ void GEN::xgen (GEN *a)
|
||||
break;
|
||||
default: // silence
|
||||
{
|
||||
memset (a->out, 0, a->size * sizeof (dcomplex));
|
||||
memset (a->out, 0, a->size * sizeof (wcomplex));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void GEN::setBuffers_gen (GEN *a, double* in, double* out)
|
||||
|
@ -113,7 +113,7 @@ void ICFIR::xicfir (ICFIR *a)
|
||||
if (a->run)
|
||||
FIRCORE::xfircore (a->p);
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void ICFIR::setBuffers_icfir (ICFIR *a, double* in, double* out)
|
||||
|
26
wdsp/iir.cpp
26
wdsp/iir.cpp
@ -94,7 +94,7 @@ void SNOTCH::xsnotch (SNOTCH *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ void SPEAK::xspeak (SPEAK *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ void MPEAK::xmpeak (MPEAK *a)
|
||||
if (a->run)
|
||||
{
|
||||
int i, j;
|
||||
memset (a->mix, 0, a->size * sizeof (dcomplex));
|
||||
memset (a->mix, 0, a->size * sizeof (wcomplex));
|
||||
for (i = 0; i < a->npeaks; i++)
|
||||
{
|
||||
if (a->enable[i])
|
||||
@ -450,10 +450,10 @@ void MPEAK::xmpeak (MPEAK *a)
|
||||
a->mix[j] += a->tmp[j];
|
||||
}
|
||||
}
|
||||
memcpy (a->out, a->mix, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->mix, a->size * sizeof (wcomplex));
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ void PHROT::xphrot (PHROT *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
@ -782,7 +782,7 @@ void BQLP::xbqlp(BQLP *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy(a->out, a->in, a->size * sizeof(dcomplex));
|
||||
memcpy(a->out, a->in, a->size * sizeof(wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
@ -1013,7 +1013,7 @@ void BQBP::xbqbp(BQBP *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy(a->out, a->in, a->size * sizeof(dcomplex));
|
||||
memcpy(a->out, a->in, a->size * sizeof(wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
@ -1199,10 +1199,10 @@ void SPHP::destroy_sphp(SPHP *a)
|
||||
|
||||
void SPHP::flush_sphp(SPHP *a)
|
||||
{
|
||||
memset(a->x0, 0, a->nstages * sizeof(dcomplex));
|
||||
memset(a->x1, 0, a->nstages * sizeof(dcomplex));
|
||||
memset(a->y0, 0, a->nstages * sizeof(dcomplex));
|
||||
memset(a->y1, 0, a->nstages * sizeof(dcomplex));
|
||||
memset(a->x0, 0, a->nstages * sizeof(wcomplex));
|
||||
memset(a->x1, 0, a->nstages * sizeof(wcomplex));
|
||||
memset(a->y0, 0, a->nstages * sizeof(wcomplex));
|
||||
memset(a->y1, 0, a->nstages * sizeof(wcomplex));
|
||||
}
|
||||
|
||||
void SPHP::xsphp(SPHP *a)
|
||||
@ -1230,7 +1230,7 @@ void SPHP::xsphp(SPHP *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy(a->out, a->in, a->size * sizeof(dcomplex));
|
||||
memcpy(a->out, a->in, a->size * sizeof(wcomplex));
|
||||
a->cs_update.unlock();
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ void IQC::xiqc (IQC *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void IQC::setBuffers_iqc (IQC *a, double* in, double* out)
|
||||
|
@ -363,7 +363,7 @@ void NBP::xnbp (NBP *a, int pos)
|
||||
if (a->run && pos == a->position)
|
||||
FIRCORE::xfircore (a->p);
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void NBP::setBuffers_nbp (NBP *a, double* in, double* out)
|
||||
|
@ -83,7 +83,7 @@ void OSCTRL::destroy_osctrl (OSCTRL *a)
|
||||
|
||||
void OSCTRL::flush_osctrl (OSCTRL *a)
|
||||
{
|
||||
memset (a->dl, 0, a->dl_len * sizeof (dcomplex));
|
||||
memset (a->dl, 0, a->dl_len * sizeof (wcomplex));
|
||||
memset (a->dlenv, 0, a->pn * sizeof (double));
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ void OSCTRL::xosctrl (OSCTRL *a)
|
||||
}
|
||||
}
|
||||
else if (a->inbuff != a->outbuff)
|
||||
memcpy (a->outbuff, a->inbuff, a->size * sizeof (dcomplex));
|
||||
memcpy (a->outbuff, a->inbuff, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void OSCTRL::setBuffers_osctrl (OSCTRL *a, double* in, double* out)
|
||||
|
@ -116,7 +116,7 @@ void RESAMPLE::destroy_resample (RESAMPLE *a)
|
||||
|
||||
void RESAMPLE::flush_resample (RESAMPLE *a)
|
||||
{
|
||||
memset (a->ring, 0, a->ringsize * sizeof (dcomplex));
|
||||
memset (a->ring, 0, a->ringsize * sizeof (wcomplex));
|
||||
a->idx_in = a->ringsize - 1;
|
||||
a->phnum = 0;
|
||||
}
|
||||
@ -156,7 +156,7 @@ int RESAMPLE::xresample (RESAMPLE *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
return outsamps;
|
||||
}
|
||||
|
||||
|
@ -334,8 +334,8 @@ void RMATCH::xrmatchIN (void* b, double* in)
|
||||
first = a->ntslew + 1;
|
||||
second = 0;
|
||||
}
|
||||
memcpy (a->baux, a->ring + 2 * a->iout, first * sizeof (dcomplex));
|
||||
memcpy (a->baux + 2 * first, a->ring, second * sizeof (dcomplex));
|
||||
memcpy (a->baux, a->ring + 2 * a->iout, first * sizeof (wcomplex));
|
||||
memcpy (a->baux + 2 * first, a->ring, second * sizeof (wcomplex));
|
||||
// a->iout = (a->iout + ovfl + a->rsize / 2) % a->rsize;
|
||||
a->iout = (a->iout + ovfl) % a->rsize; //
|
||||
}
|
||||
@ -349,8 +349,8 @@ void RMATCH::xrmatchIN (void* b, double* in)
|
||||
first = newsamps;
|
||||
second = 0;
|
||||
}
|
||||
memcpy (a->ring + 2 * a->iin, a->resout, first * sizeof (dcomplex));
|
||||
memcpy (a->ring, a->resout + 2 * first, second * sizeof (dcomplex));
|
||||
memcpy (a->ring + 2 * a->iin, a->resout, first * sizeof (wcomplex));
|
||||
memcpy (a->ring, a->resout + 2 * first, second * sizeof (wcomplex));
|
||||
if (a->ucnt >= 0) upslew(a, newsamps);
|
||||
a->iin = (a->iin + newsamps) % a->rsize;
|
||||
if (ovfl > 0) blend (a);
|
||||
@ -418,8 +418,8 @@ void RMATCH::dslew (RMATCH *a)
|
||||
first = zeros;
|
||||
second = 0;
|
||||
}
|
||||
memset (a->ring + 2 * i, 0, first * sizeof (dcomplex));
|
||||
memset (a->ring, 0, second * sizeof (dcomplex));
|
||||
memset (a->ring + 2 * i, 0, first * sizeof (wcomplex));
|
||||
memset (a->ring, 0, second * sizeof (wcomplex));
|
||||
n += zeros; //
|
||||
} //
|
||||
// a->n_ring = a->outsize + a->rsize / 2;
|
||||
@ -453,8 +453,8 @@ void RMATCH::xrmatchOUT (void* b, double* out)
|
||||
first = a->outsize;
|
||||
second = 0;
|
||||
}
|
||||
memcpy (a->out, a->ring + 2 * a->iout, first * sizeof (dcomplex));
|
||||
memcpy (a->out + 2 * first, a->ring, second * sizeof (dcomplex));
|
||||
memcpy (a->out, a->ring + 2 * a->iout, first * sizeof (wcomplex));
|
||||
memcpy (a->out + 2 * first, a->ring, second * sizeof (wcomplex));
|
||||
a->iout = (a->iout + a->outsize) % a->rsize;
|
||||
a->n_ring -= a->outsize;
|
||||
a->dlast[0] = a->out[2 * (a->outsize - 1) + 0];
|
||||
|
@ -86,7 +86,7 @@ void SHIFT::xshift (SHIFT *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void SHIFT::setBuffers_shift(SHIFT *a, double* in, double* out)
|
||||
|
@ -101,9 +101,9 @@ void SIPHON::destroy_siphon (SIPHON *a)
|
||||
|
||||
void SIPHON::flush_siphon (SIPHON *a)
|
||||
{
|
||||
memset (a->sipbuff, 0, a->sipsize * sizeof (dcomplex));
|
||||
memset (a->sipout , 0, a->sipsize * sizeof (dcomplex));
|
||||
memset (a->specout, 0, a->fftsize * sizeof (dcomplex));
|
||||
memset (a->sipbuff, 0, a->sipsize * sizeof (wcomplex));
|
||||
memset (a->sipout , 0, a->sipsize * sizeof (wcomplex));
|
||||
memset (a->specout, 0, a->fftsize * sizeof (wcomplex));
|
||||
a->idx = 0;
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ void SIPHON::xsiphon (SIPHON *a, int pos)
|
||||
{
|
||||
case 0:
|
||||
if (a->insize >= a->sipsize)
|
||||
memcpy (a->sipbuff, &(a->in[2 * (a->insize - a->sipsize)]), a->sipsize * sizeof (dcomplex));
|
||||
memcpy (a->sipbuff, &(a->in[2 * (a->insize - a->sipsize)]), a->sipsize * sizeof (wcomplex));
|
||||
else
|
||||
{
|
||||
if (a->insize > (a->sipsize - a->idx))
|
||||
@ -130,8 +130,8 @@ void SIPHON::xsiphon (SIPHON *a, int pos)
|
||||
first = a->insize;
|
||||
second = 0;
|
||||
}
|
||||
memcpy (a->sipbuff + 2 * a->idx, a->in, first * sizeof (dcomplex));
|
||||
memcpy (a->sipbuff, a->in + 2 * first, second * sizeof (dcomplex));
|
||||
memcpy (a->sipbuff + 2 * a->idx, a->in, first * sizeof (wcomplex));
|
||||
memcpy (a->sipbuff, a->in + 2 * first, second * sizeof (wcomplex));
|
||||
if ((a->idx += a->insize) >= a->sipsize) a->idx -= a->sipsize;
|
||||
}
|
||||
break;
|
||||
@ -167,11 +167,11 @@ void SIPHON::suck (SIPHON *a)
|
||||
int j = (a->idx - a->outsize) & mask;
|
||||
int size = a->sipsize - j;
|
||||
if (size >= a->outsize)
|
||||
memcpy (a->sipout, &(a->sipbuff[2 * j]), a->outsize * sizeof (dcomplex));
|
||||
memcpy (a->sipout, &(a->sipbuff[2 * j]), a->outsize * sizeof (wcomplex));
|
||||
else
|
||||
{
|
||||
memcpy (a->sipout, &(a->sipbuff[2 * j]), size * sizeof (dcomplex));
|
||||
memcpy (&(a->sipout[2 * size]), a->sipbuff, (a->outsize - size) * sizeof (dcomplex));
|
||||
memcpy (a->sipout, &(a->sipbuff[2 * j]), size * sizeof (wcomplex));
|
||||
memcpy (&(a->sipout[2 * size]), a->sipbuff, (a->outsize - size) * sizeof (wcomplex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void USLEW::xuslew (USLEW *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void USLEW::setBuffers_uslew (USLEW *a, double* in, double* out)
|
||||
|
10
wdsp/snb.cpp
10
wdsp/snb.cpp
@ -214,8 +214,8 @@ void SNBA::flush_snba (SNBA *d)
|
||||
memset (d->sdet.vp, 0, d->xsize * sizeof (double));
|
||||
memset (d->sdet.vpwr, 0, d->xsize * sizeof (double));
|
||||
|
||||
memset (d->inbuff, 0, d->isize * sizeof (dcomplex));
|
||||
memset (d->outbuff, 0, d->isize * sizeof (dcomplex));
|
||||
memset (d->inbuff, 0, d->isize * sizeof (wcomplex));
|
||||
memset (d->outbuff, 0, d->isize * sizeof (wcomplex));
|
||||
RESAMPLE::flush_resample (d->inresamp);
|
||||
RESAMPLE::flush_resample (d->outresamp);
|
||||
}
|
||||
@ -626,7 +626,7 @@ void SNBA::xsnba (SNBA *d)
|
||||
RESAMPLE::xresample (d->outresamp);
|
||||
}
|
||||
else if (d->out != d->in)
|
||||
memcpy (d->out, d->in, d->bsize * sizeof (dcomplex));
|
||||
memcpy (d->out, d->in, d->bsize * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
/********************************************************************************************************
|
||||
@ -842,7 +842,7 @@ void BPSNBA::destroy_bpsnba (BPSNBA *a)
|
||||
|
||||
void BPSNBA::flush_bpsnba (BPSNBA *a)
|
||||
{
|
||||
memset (a->buff, 0, a->size * sizeof (dcomplex));
|
||||
memset (a->buff, 0, a->size * sizeof (wcomplex));
|
||||
NBP::flush_nbp (a->bpsnba);
|
||||
}
|
||||
|
||||
@ -871,7 +871,7 @@ void BPSNBA::setSize_bpsnba (BPSNBA *a, int size)
|
||||
void BPSNBA::xbpsnbain (BPSNBA *a, int position)
|
||||
{
|
||||
if (a->run && a->position == position)
|
||||
memcpy (a->buff, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->buff, a->in, a->size * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void BPSNBA::xbpsnbaout (BPSNBA *a, int position)
|
||||
|
@ -229,7 +229,7 @@ void SSQL::destroy_ssql (SSQL *a)
|
||||
void SSQL::flush_ssql (SSQL *a)
|
||||
{
|
||||
|
||||
memset (a->b1, 0, a->size * sizeof (dcomplex));
|
||||
memset (a->b1, 0, a->size * sizeof (wcomplex));
|
||||
CBL::flush_cbl (a->dcbl);
|
||||
memset (a->ibuff, 0, a->size * sizeof (double));
|
||||
memset (a->ftovbuff, 0, a->size * sizeof (double));
|
||||
@ -317,7 +317,7 @@ void SSQL::xssql (SSQL *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof(dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof(wcomplex));
|
||||
}
|
||||
|
||||
void SSQL::setBuffers_ssql (SSQL *a, double* in, double* out)
|
||||
|
@ -120,7 +120,7 @@ void VARSAMP::destroy_varsamp (VARSAMP *a)
|
||||
|
||||
void VARSAMP::flush_varsamp (VARSAMP *a)
|
||||
{
|
||||
memset (a->ring, 0, a->rsize * sizeof (dcomplex));
|
||||
memset (a->ring, 0, a->rsize * sizeof (wcomplex));
|
||||
a->idx_in = a->rsize - 1;
|
||||
a->h_offset = 0.0;
|
||||
a->isamps = 0.0;
|
||||
@ -165,7 +165,7 @@ int VARSAMP::xvarsamp (VARSAMP *a, double var)
|
||||
a->inv_cvar += a->dicvar;
|
||||
picvar = (uint64_t*)(&a->inv_cvar);
|
||||
N = *picvar & 0xffffffffffff0000;
|
||||
a->inv_cvar = *((double *)&N);
|
||||
a->inv_cvar = static_cast<double>(N);
|
||||
a->delta = 1.0 - a->inv_cvar;
|
||||
while (a->isamps < 1.0)
|
||||
{
|
||||
@ -191,7 +191,7 @@ int VARSAMP::xvarsamp (VARSAMP *a, double var)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (dcomplex));
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
return outsamps;
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ void WCPAGC::xwcpagc (WCPAGC *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy(a->out, a->in, a->io_buffsize * sizeof (dcomplex));
|
||||
memcpy(a->out, a->in, a->io_buffsize * sizeof (wcomplex));
|
||||
}
|
||||
|
||||
void WCPAGC::setBuffers_wcpagc (WCPAGC *a, double* in, double* out)
|
||||
|
Loading…
Reference in New Issue
Block a user