mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-24 17:08:36 -05:00
WDSP: remove wcomplex
This commit is contained in:
parent
0b62856e70
commit
3a4981046c
@ -611,9 +611,9 @@ void RXA::destroy_rxa (RXA *rxa)
|
||||
|
||||
void RXA::flush_rxa (RXA *rxa)
|
||||
{
|
||||
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));
|
||||
std::fill(rxa->inbuff, rxa->inbuff + 1 * rxa->dsp_insize * 2, 0);
|
||||
std::fill(rxa->outbuff, rxa->outbuff + 1 * rxa->dsp_outsize * 2, 0);
|
||||
std::fill(rxa->midbuff, rxa->midbuff + 2 * rxa->dsp_size * 2, 0);
|
||||
SHIFT::flush_shift (rxa->shift.p);
|
||||
RESAMPLE::flush_resample (rxa->rsmpin.p);
|
||||
GEN::flush_gen (rxa->gen0.p);
|
||||
|
@ -558,9 +558,9 @@ void TXA::destroy_txa (TXA *txa)
|
||||
|
||||
void TXA::flush_txa (TXA* txa)
|
||||
{
|
||||
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));
|
||||
std::fill(txa->inbuff, txa->inbuff + 1 * txa->dsp_insize * 2, 0);
|
||||
std::fill(txa->outbuff, txa->outbuff + 1 * txa->dsp_outsize * 2, 0);
|
||||
std::fill(txa->midbuff, txa->midbuff + 2 * txa->dsp_size * 2, 0);
|
||||
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(wcomplex));
|
||||
std::copy (a->in_buff, a->in_buff + a->buff_size * 2, a->out_buff);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ void AMMOD::xammod(AMMOD *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void AMMOD::setBuffers_ammod(AMMOD *a, float* in, float* out)
|
||||
|
@ -55,7 +55,7 @@ void AMSQ::compute_slews(AMSQ *a)
|
||||
void AMSQ::calc_amsq(AMSQ *a)
|
||||
{
|
||||
// signal averaging
|
||||
a->trigsig = new float[a->size * 2]; // (float *)malloc0(a->size * sizeof(wcomplex));
|
||||
a->trigsig = new float[a->size * 2];
|
||||
a->avm = exp(-1.0 / (a->rate * a->avtau));
|
||||
a->onem_avm = 1.0 - a->avm;
|
||||
a->avsig = 0.0;
|
||||
@ -120,7 +120,7 @@ void AMSQ::destroy_amsq (AMSQ *a)
|
||||
|
||||
void AMSQ::flush_amsq (AMSQ*a)
|
||||
{
|
||||
memset (a->trigsig, 0, a->size * sizeof (wcomplex));
|
||||
std::fill(a->trigsig, a->trigsig + a->size * 2, 0);
|
||||
a->avsig = 0.0;
|
||||
a->state = 0;
|
||||
}
|
||||
@ -192,12 +192,12 @@ void AMSQ::xamsq (AMSQ *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void AMSQ::xamsqcap (AMSQ *a)
|
||||
{
|
||||
memcpy (a->trigsig, a->trigger, a->size * sizeof (wcomplex));
|
||||
std::copy(a->trigger, a->trigger + a->size * 2, a->trigsig);
|
||||
}
|
||||
|
||||
void AMSQ::setBuffers_amsq (AMSQ *a, float* in, float* out, float* trigger)
|
||||
|
@ -53,7 +53,7 @@ void ANB::initBlanker(ANB *a)
|
||||
a->ombackmult = 1.0 - a->backmult;
|
||||
for (i = 0; i <= a->trans_count; i++)
|
||||
a->wave[i] = 0.5 * cos(i * a->coef);
|
||||
memset(a->dline, 0, a->dline_size * sizeof(wcomplex));
|
||||
std::fill(a->dline, a->dline + a->dline_size * 2, 0);
|
||||
}
|
||||
|
||||
ANB* ANB::create_anb (
|
||||
@ -178,7 +178,7 @@ void ANB::xanb (ANB *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->buffsize * sizeof (wcomplex));
|
||||
std::copy(a->in, a->in + a->buffsize * 2, a->out);
|
||||
}
|
||||
|
||||
void ANB::setBuffers_anb (ANB *a, float* in, float* out)
|
||||
|
@ -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 (wcomplex));
|
||||
std::copy(a->in_buff, a->in_buff + a->buff_size * 2, a->out_buff);
|
||||
}
|
||||
|
||||
void ANF::flush_anf (ANF *a)
|
||||
|
@ -140,7 +140,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 (wcomplex));
|
||||
std::copy(a->in_buff, a->in_buff + a->buff_size * 2, a->out_buff);
|
||||
}
|
||||
|
||||
void ANR::flush_anr (ANR *a)
|
||||
|
@ -99,7 +99,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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void BANDPASS::setBuffers_bandpass (BANDPASS *a, float* in, float* out)
|
||||
|
12
wdsp/bps.cpp
12
wdsp/bps.cpp
@ -43,8 +43,8 @@ namespace WDSP {
|
||||
void BPS::calc_bps (BPS *a)
|
||||
{
|
||||
float* impulse;
|
||||
a->infilt = new float[2 * a->size * 2]; // (float *)malloc0(2 * a->size * sizeof(wcomplex));
|
||||
a->product = new float[2 * a->size * 2]; // (float *)malloc0(2 * a->size * sizeof(wcomplex));
|
||||
a->infilt = new float[2 * a->size * 2];
|
||||
a->product = new float[2 * a->size * 2];
|
||||
impulse = FIR::fir_bandpass(a->size + 1, a->f_low, a->f_high, a->samplerate, a->wintype, 1, 1.0 / (float)(2 * a->size));
|
||||
a->mults = FIR::fftcv_mults(2 * a->size, impulse);
|
||||
a->CFor = fftwf_plan_dft_1d(2 * a->size, (fftwf_complex *)a->infilt, (fftwf_complex *)a->product, FFTW_FORWARD, FFTW_PATIENT);
|
||||
@ -87,7 +87,7 @@ void BPS::destroy_bps (BPS *a)
|
||||
|
||||
void BPS::flush_bps (BPS *a)
|
||||
{
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->infilt, a->infilt + 2 * a->size * 2, 0);
|
||||
}
|
||||
|
||||
void BPS::xbps (BPS *a, int pos)
|
||||
@ -96,7 +96,7 @@ void BPS::xbps (BPS *a, int pos)
|
||||
float I, Q;
|
||||
if (a->run && pos == a->position)
|
||||
{
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, &(a->infilt[2 * a->size]));
|
||||
fftwf_execute (a->CFor);
|
||||
for (i = 0; i < 2 * a->size; i++)
|
||||
{
|
||||
@ -106,10 +106,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];
|
||||
}
|
||||
fftwf_execute (a->CRev);
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
std::copy(&(a->infilt[2 * a->size]), &(a->infilt[2 * a->size]) + a->size * 2, a->infilt);
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void BPS::setBuffers_bps (BPS *a, float* in, float* out)
|
||||
|
@ -131,7 +131,7 @@ void BPSNBA::destroy_bpsnba (BPSNBA *a)
|
||||
|
||||
void BPSNBA::flush_bpsnba (BPSNBA *a)
|
||||
{
|
||||
memset (a->buff, 0, a->size * sizeof (wcomplex));
|
||||
std::fill(a->buff, a->buff + a->size * 2, 0);
|
||||
NBP::flush_nbp (a->bpsnba);
|
||||
}
|
||||
|
||||
@ -160,7 +160,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 (wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, a->buff);
|
||||
}
|
||||
|
||||
void BPSNBA::xbpsnbaout (BPSNBA *a, int position)
|
||||
|
@ -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 (wcomplex));
|
||||
std::copy(a->in_buff, a->in_buff + a->buff_size * 2, a->out_buff);
|
||||
}
|
||||
|
||||
void CBL::setBuffers_cbl (CBL *a, float* in, float* 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 (wcomplex));
|
||||
std::copy(a->in, a->in + a->bsize * 2, a->out);
|
||||
}
|
||||
|
||||
void CFCOMP::setBuffers_cfcomp (CFCOMP *a, float* in, float* 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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void CFIR::setBuffers_cfir (CFIR *a, float* in, float* out)
|
||||
|
@ -74,12 +74,6 @@ warren@wpratt.com
|
||||
#define PI 3.1415926535897932
|
||||
#define TWOPI 6.2831853071795864
|
||||
|
||||
namespace WDSP {
|
||||
// miscellaneous
|
||||
typedef float wcomplex[2];
|
||||
typedef double dcomplex[2];
|
||||
}
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <cstdint>
|
||||
|
@ -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 (wcomplex));
|
||||
std::copy(a->inbuff, a->inbuff + a->buffsize * 2, a->outbuff);
|
||||
}
|
||||
|
||||
void COMPRESSOR::setBuffers_compressor (COMPRESSOR *a, float* in, float* out)
|
||||
|
@ -67,7 +67,7 @@ void DELAY::destroy_delay (DELAY *a)
|
||||
|
||||
void DELAY::flush_delay (DELAY *a)
|
||||
{
|
||||
memset (a->ring, 0, a->cpp * sizeof (wcomplex));
|
||||
std::fill(a->ring, a->ring + a->cpp * 2, 0);
|
||||
a->idx_in = 0;
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ void DELAY::xdelay (DELAY *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void EMPHP::setBuffers_emphp (EMPHP *a, float* in, float* out)
|
||||
@ -206,7 +206,7 @@ void EMPH::destroy_emph (EMPH *a)
|
||||
|
||||
void EMPH::flush_emph (EMPH *a)
|
||||
{
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->infilt, a->infilt + 2 * a->size * 2, 0);
|
||||
}
|
||||
|
||||
void EMPH::xemph (EMPH *a, int position)
|
||||
@ -215,7 +215,7 @@ void EMPH::xemph (EMPH *a, int position)
|
||||
float I, Q;
|
||||
if (a->run && a->position == position)
|
||||
{
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, &(a->infilt[2 * a->size]));
|
||||
fftwf_execute (a->CFor);
|
||||
for (i = 0; i < 2 * a->size; i++)
|
||||
{
|
||||
@ -225,10 +225,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];
|
||||
}
|
||||
fftwf_execute (a->CRev);
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
std::copy(&(a->infilt[2 * a->size]), &(a->infilt[2 * a->size]) + a->size * 2, a->infilt);
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void EMPH::setBuffers_emph (EMPH *a, float* in, float* 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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void EQP::setBuffers_eqp (EQP *a, float* in, float* out)
|
||||
@ -579,7 +579,7 @@ void EQ::destroy_eq (EQ *a)
|
||||
|
||||
void EQ::flush_eq (EQ *a)
|
||||
{
|
||||
memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->infilt, a->infilt + 2 * a->size * 2, 0);
|
||||
}
|
||||
|
||||
void EQ::xeq (EQ *a)
|
||||
@ -588,7 +588,7 @@ void EQ::xeq (EQ *a)
|
||||
float I, Q;
|
||||
if (a->run)
|
||||
{
|
||||
memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, &(a->infilt[2 * a->size]));
|
||||
fftwf_execute (a->CFor);
|
||||
for (i = 0; i < 2 * a->size; i++)
|
||||
{
|
||||
@ -598,10 +598,10 @@ void EQ::xeq (EQ *a)
|
||||
a->product[2 * i + 1] = I * a->mults[2 * i + 1] + Q * a->mults[2 * i + 0];
|
||||
}
|
||||
fftwf_execute (a->CRev);
|
||||
memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
std::copy(&(a->infilt[2 * a->size]), &(a->infilt[2 * a->size]) + a->size * 2, a->infilt);
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void EQ::setBuffers_eq (EQ *a, float* in, float* out)
|
||||
|
18
wdsp/fir.cpp
18
wdsp/fir.cpp
@ -33,13 +33,13 @@ namespace WDSP {
|
||||
|
||||
float* FIR::fftcv_mults (int NM, float* c_impulse)
|
||||
{
|
||||
float* mults = new float[NM * 2]; // (float *) malloc0 (NM * sizeof (wcomplex));
|
||||
float* cfft_impulse = new float[NM * 2]; // (float *) malloc0 (NM * sizeof (wcomplex));
|
||||
float* mults = new float[NM * 2];
|
||||
float* cfft_impulse = new float[NM * 2];
|
||||
fftwf_plan ptmp = fftwf_plan_dft_1d(NM, (fftwf_complex *) cfft_impulse,
|
||||
(fftwf_complex *) mults, FFTW_FORWARD, FFTW_PATIENT);
|
||||
memset (cfft_impulse, 0, NM * sizeof (wcomplex));
|
||||
std::fill(cfft_impulse, cfft_impulse + NM * 2, 0);
|
||||
// store complex coefs right-justified in the buffer
|
||||
memcpy (&(cfft_impulse[NM - 2]), c_impulse, (NM / 2 + 1) * sizeof(wcomplex));
|
||||
std::copy(c_impulse, c_impulse + (NM / 2 + 1) * 2, &(cfft_impulse[NM - 2]));
|
||||
fftwf_execute (ptmp);
|
||||
fftwf_destroy_plan (ptmp);
|
||||
delete[] cfft_impulse;
|
||||
@ -91,8 +91,8 @@ float* FIR::fir_fsamp_odd (int N, float* A, int rtype, float scale, int wintype)
|
||||
int mid = (N - 1) / 2;
|
||||
float mag, phs;
|
||||
float* window;
|
||||
float *fcoef = new float[N * 2]; // (float *) malloc0 (N * sizeof (wcomplex));
|
||||
float *c_impulse = new float[N * 2]; // (float *) malloc0 (N * sizeof (wcomplex));
|
||||
float *fcoef = new float[N * 2];
|
||||
float *c_impulse = new float[N * 2];
|
||||
fftwf_plan ptmp = fftwf_plan_dft_1d(N, (fftwf_complex *)fcoef, (fftwf_complex *)c_impulse, FFTW_BACKWARD, FFTW_PATIENT);
|
||||
float local_scale = 1.0 / (float)N;
|
||||
for (i = 0; i <= mid; i++)
|
||||
@ -339,7 +339,7 @@ void FIR::mp_imp (int N, float* fir, float* mpfir, int pfactor, int polarity)
|
||||
float* ana = new float[size * 2]; // (float *) malloc0 (size * sizeof (complex));
|
||||
float* impulse = new float[size * 2]; // (float *) malloc0 (size * sizeof (complex));
|
||||
float* newfreq = new float[size * 2]; // (float *) malloc0 (size * sizeof (complex));
|
||||
memcpy (firpad, fir, N * sizeof (wcomplex));
|
||||
std::copy(fir, fir + N * 2, firpad);
|
||||
fftwf_plan pfor = fftwf_plan_dft_1d (size, (fftwf_complex *) firpad,
|
||||
(fftwf_complex *) firfreq, FFTW_FORWARD, FFTW_PATIENT);
|
||||
fftwf_plan prev = fftwf_plan_dft_1d (size, (fftwf_complex *) newfreq,
|
||||
@ -365,9 +365,9 @@ void FIR::mp_imp (int N, float* fir, float* mpfir, int pfactor, int polarity)
|
||||
}
|
||||
fftwf_execute (prev);
|
||||
if (polarity)
|
||||
memcpy (mpfir, &impulse[2 * (pfactor - 1) * N], N * sizeof (wcomplex));
|
||||
std::copy(&impulse[2 * (pfactor - 1) * N], &impulse[2 * (pfactor - 1) * N] + N * 2, mpfir);
|
||||
else
|
||||
memcpy (mpfir, impulse, N * sizeof (wcomplex));
|
||||
std::copy(impulse, impulse + N * 2, mpfir);
|
||||
// print_impulse("min_imp.txt", N, mpfir, 1, 0);
|
||||
fftwf_destroy_plan (prev);
|
||||
fftwf_destroy_plan (pfor);
|
||||
|
@ -79,13 +79,13 @@ 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 (wcomplex));
|
||||
std::copy(a->impulse, a->impulse + a->nc * 2, a->imp);
|
||||
|
||||
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(wcomplex));
|
||||
std::copy(&(a->imp[2 * a->size * i]), &(a->imp[2 * a->size * i]) + a->size * 2, &(a->maskgen[2 * a->size]));
|
||||
fftwf_execute (a->maskplan[1 - a->cset][i]);
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ FIRCORE* FIRCORE::create_fircore (int size, float* in, float* out, int nc, int m
|
||||
plan_fircore (a);
|
||||
a->impulse = new float[a->nc * 2]; // (float *) malloc0 (a->nc * sizeof (complex));
|
||||
a->imp = new float[a->nc * 2]; // (float *) malloc0 (a->nc * sizeof (complex));
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex));
|
||||
std::copy(impulse, impulse + a->nc * 2, a->impulse);
|
||||
calc_fircore (a, 1);
|
||||
return a;
|
||||
}
|
||||
@ -152,19 +152,19 @@ void FIRCORE::destroy_fircore (FIRCORE *a)
|
||||
void FIRCORE::flush_fircore (FIRCORE *a)
|
||||
{
|
||||
int i;
|
||||
memset (a->fftin, 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->fftin, a->fftin + 2 * a->size * 2, 0);
|
||||
for (i = 0; i < a->nfor; i++)
|
||||
memset (a->fftout[i], 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->fftout[i], a->fftout[i] + 2 * a->size * 2, 0);
|
||||
a->buffidx = 0;
|
||||
}
|
||||
|
||||
void FIRCORE::xfircore (FIRCORE *a)
|
||||
{
|
||||
int i, j, k;
|
||||
memcpy (&(a->fftin[2 * a->size]), a->in, a->size * sizeof (wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, &(a->fftin[2 * a->size]));
|
||||
fftwf_execute (a->pcfor[a->buffidx]);
|
||||
k = a->buffidx;
|
||||
memset (a->accum, 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->accum, a->accum + 2 * a->size * 2, 0);
|
||||
|
||||
for (j = 0; j < a->nfor; j++)
|
||||
{
|
||||
@ -179,7 +179,7 @@ void FIRCORE::xfircore (FIRCORE *a)
|
||||
|
||||
a->buffidx = (a->buffidx + 1) & a->idxmask;
|
||||
fftwf_execute (a->crev);
|
||||
memcpy (a->fftin, &(a->fftin[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
std::copy(&(a->fftin[2 * a->size]), &(a->fftin[2 * a->size]) + a->size * 2, a->fftin);
|
||||
}
|
||||
|
||||
void FIRCORE::setBuffers_fircore (FIRCORE *a, float* in, float* out)
|
||||
@ -201,7 +201,7 @@ void FIRCORE::setSize_fircore (FIRCORE *a, int size)
|
||||
|
||||
void FIRCORE::setImpulse_fircore (FIRCORE *a, float* impulse, int update)
|
||||
{
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex));
|
||||
std::copy(impulse, impulse + a->nc * 2, a->impulse);
|
||||
calc_fircore (a, update);
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ void FIRCORE::setNc_fircore (FIRCORE *a, int nc, float* impulse)
|
||||
plan_fircore (a);
|
||||
a->imp = new float[a->nc * 2]; // (float *) malloc0 (a->nc * sizeof (complex));
|
||||
a->impulse = new float[a->nc * 2]; // (float *) malloc0 (a->nc * sizeof (complex));
|
||||
memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex));
|
||||
std::copy(impulse, impulse + a->nc * 2, a->impulse);
|
||||
calc_fircore (a, 1);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ void FIRMIN::destroy_firmin (FIRMIN *a)
|
||||
|
||||
void FIRMIN::flush_firmin (FIRMIN *a)
|
||||
{
|
||||
memset (a->ring, 0, a->rsize * sizeof (wcomplex));
|
||||
std::fill(a->ring, a->ring + a->rsize * 2, 0);
|
||||
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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void FIRMIN::setBuffers_firmin (FIRMIN *a, float* in, float* out)
|
||||
|
@ -72,7 +72,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(wcomplex));
|
||||
std::copy(&(impulse[2 * a->size * i]), &(impulse[2 * a->size * i]) + a->size * 2, &(a->maskgen[2 * a->size]));
|
||||
fftwf_execute (a->maskplan[i]);
|
||||
}
|
||||
delete[] (impulse);
|
||||
@ -127,9 +127,9 @@ void FIROPT::destroy_firopt (FIROPT *a)
|
||||
void FIROPT::flush_firopt (FIROPT *a)
|
||||
{
|
||||
int i;
|
||||
memset (a->fftin, 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->fftin, a->fftin + 2 * a->size * 2, 0);
|
||||
for (i = 0; i < a->nfor; i++)
|
||||
memset (a->fftout[i], 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->fftout[i], a->fftout[i] + 2 * a->size * 2, 0);
|
||||
a->buffidx = 0;
|
||||
}
|
||||
|
||||
@ -138,10 +138,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 (wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, &(a->fftin[2 * a->size]));
|
||||
fftwf_execute (a->pcfor[a->buffidx]);
|
||||
k = a->buffidx;
|
||||
memset (a->accum, 0, 2 * a->size * sizeof (wcomplex));
|
||||
std::fill(a->accum, a->accum + 2 * a->size * 2, 0);
|
||||
for (j = 0; j < a->nfor; j++)
|
||||
{
|
||||
for (i = 0; i < 2 * a->size; i++)
|
||||
@ -153,10 +153,10 @@ void FIROPT::xfiropt (FIROPT *a, int pos)
|
||||
}
|
||||
a->buffidx = (a->buffidx + 1) & a->idxmask;
|
||||
fftwf_execute (a->crev);
|
||||
memcpy (a->fftin, &(a->fftin[2 * a->size]), a->size * sizeof(wcomplex));
|
||||
std::copy(&(a->fftin[2 * a->size]), &(a->fftin[2 * a->size]) + a->size * 2, a->fftin);
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void FIROPT::setBuffers_firopt (FIROPT *a, float* in, float* out)
|
||||
|
@ -160,7 +160,7 @@ void FMD::destroy_fmd (FMD *a)
|
||||
|
||||
void FMD::flush_fmd (FMD *a)
|
||||
{
|
||||
memset (a->audio, 0, a->size * sizeof (wcomplex));
|
||||
std::fill(a->audio, a->audio + a->size * 2, 0);
|
||||
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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void FMD::setBuffers_fmd (FMD *a, float* in, float* 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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void FMMOD::setBuffers_fmmod (FMMOD *a, float* in, float* out)
|
||||
|
@ -228,7 +228,7 @@ void FMSQ::xfmsq (FMSQ *a)
|
||||
}
|
||||
}
|
||||
else if (a->insig != a->outsig)
|
||||
memcpy (a->outsig, a->insig, a->size * sizeof (wcomplex));
|
||||
std::copy(a->insig, a->insig + a->size * 2, a->outsig);
|
||||
}
|
||||
|
||||
void FMSQ::setBuffers_fmsq (FMSQ *a, float* in, float* out, float* trig)
|
||||
|
@ -73,7 +73,7 @@ void GAIN::xgain (GAIN *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void GAIN::setBuffers_gain (GAIN *a, float* in, float* out)
|
||||
|
@ -351,13 +351,13 @@ void GEN::xgen (GEN *a)
|
||||
break;
|
||||
default: // silence
|
||||
{
|
||||
memset (a->out, 0, a->size * sizeof (wcomplex));
|
||||
std::fill(a->out, a->out + a->size * 2, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void GEN::setBuffers_gen (GEN *a, float* in, float* 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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void ICFIR::setBuffers_icfir (ICFIR *a, float* in, float* out)
|
||||
|
26
wdsp/iir.cpp
26
wdsp/iir.cpp
@ -93,7 +93,7 @@ void SNOTCH::xsnotch (SNOTCH *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void SNOTCH::setBuffers_snotch (SNOTCH *a, float* in, float* out)
|
||||
@ -289,7 +289,7 @@ void SPEAK::xspeak (SPEAK *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void SPEAK::setBuffers_speak (SPEAK *a, float* in, float* out)
|
||||
@ -426,7 +426,7 @@ void MPEAK::xmpeak (MPEAK *a)
|
||||
if (a->run)
|
||||
{
|
||||
int i, j;
|
||||
memset (a->mix, 0, a->size * sizeof (wcomplex));
|
||||
std::fill(a->mix, a->mix + a->size * 2, 0);
|
||||
|
||||
for (i = 0; i < a->npeaks; i++)
|
||||
{
|
||||
@ -438,11 +438,11 @@ void MPEAK::xmpeak (MPEAK *a)
|
||||
}
|
||||
}
|
||||
|
||||
memcpy (a->out, a->mix, a->size * sizeof (wcomplex));
|
||||
std::copy(a->mix, a->mix + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void MPEAK::setBuffers_mpeak (MPEAK *a, float* in, float* out)
|
||||
@ -601,7 +601,7 @@ void PHROT::xphrot (PHROT *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void PHROT::setBuffers_phrot (PHROT *a, float* in, float* out)
|
||||
@ -755,7 +755,7 @@ void BQLP::xbqlp(BQLP *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy(a->out, a->in, a->size * sizeof(wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void BQLP::setBuffers_bqlp(BQLP *a, float* in, float* out)
|
||||
@ -992,7 +992,7 @@ void BQBP::xbqbp(BQBP *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy(a->out, a->in, a->size * sizeof(wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void BQBP::setBuffers_bqbp(BQBP *a, float* in, float* out)
|
||||
@ -1180,10 +1180,10 @@ void SPHP::destroy_sphp(SPHP *a)
|
||||
|
||||
void SPHP::flush_sphp(SPHP *a)
|
||||
{
|
||||
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));
|
||||
std::fill(a->x0, a->x0 + a->nstages * 2, 0);
|
||||
std::fill(a->x1, a->x0 + a->nstages * 2, 0);
|
||||
std::fill(a->y0, a->x0 + a->nstages * 2, 0);
|
||||
std::fill(a->y1, a->x0 + a->nstages * 2, 0);
|
||||
}
|
||||
|
||||
void SPHP::xsphp(SPHP *a)
|
||||
@ -1214,7 +1214,7 @@ void SPHP::xsphp(SPHP *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy(a->out, a->in, a->size * sizeof(wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void SPHP::setBuffers_sphp(SPHP *a, float* in, float* out)
|
||||
|
@ -203,7 +203,7 @@ void IQC::xiqc (IQC *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void IQC::setBuffers_iqc (IQC *a, float* in, float* 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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void NBP::setBuffers_nbp (NBP *a, float* in, float* out)
|
||||
|
10
wdsp/nob.cpp
10
wdsp/nob.cpp
@ -150,10 +150,10 @@ void NOB::flush_nob (NOB *a)
|
||||
a->avg = 1.0;
|
||||
a->bfb_in_idx = a->filterlen - 1;
|
||||
a->ffb_in_idx = a->filterlen - 1;
|
||||
memset (a->dline, 0, a->dline_size * sizeof (wcomplex));
|
||||
memset (a->imp, 0, a->dline_size * sizeof (int));
|
||||
memset (a->bfbuff, 0, a->filterlen * sizeof (wcomplex));
|
||||
memset (a->ffbuff, 0, a->filterlen * sizeof (wcomplex));
|
||||
std::fill(a->dline, a->dline + a->dline_size * 2, 0);
|
||||
std::fill(a->imp, a->imp + a->dline_size, 0);
|
||||
std::fill(a->bfbuff, a->bfbuff + a->filterlen * 2, 0);
|
||||
std::fill(a->ffbuff, a->ffbuff + a->filterlen * 2, 0);
|
||||
}
|
||||
|
||||
void NOB::xnob (NOB *a)
|
||||
@ -491,7 +491,7 @@ void NOB::xnob (NOB *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->buffsize * sizeof (wcomplex));
|
||||
std::copy(a->in, a->in + a->buffsize * 2, a->out);
|
||||
}
|
||||
|
||||
void NOB::setBuffers_nob (NOB *a, float* in, float* out)
|
||||
|
@ -83,8 +83,8 @@ void OSCTRL::destroy_osctrl (OSCTRL *a)
|
||||
|
||||
void OSCTRL::flush_osctrl (OSCTRL *a)
|
||||
{
|
||||
memset (a->dl, 0, a->dl_len * sizeof (wcomplex));
|
||||
memset (a->dlenv, 0, a->pn * sizeof (float));
|
||||
std::fill(a->dl, a->dl + a->dl_len * 2, 0);
|
||||
std::fill(a->dlenv, a->dlenv + a->pn, 0);
|
||||
}
|
||||
|
||||
void OSCTRL::xosctrl (OSCTRL *a)
|
||||
@ -116,7 +116,7 @@ void OSCTRL::xosctrl (OSCTRL *a)
|
||||
}
|
||||
}
|
||||
else if (a->inbuff != a->outbuff)
|
||||
memcpy (a->outbuff, a->inbuff, a->size * sizeof (wcomplex));
|
||||
std::copy(a->inbuff, a->inbuff + a->size * 2, a->outbuff);
|
||||
}
|
||||
|
||||
void OSCTRL::setBuffers_osctrl (OSCTRL *a, float* in, float* out)
|
||||
|
@ -166,7 +166,7 @@ int RESAMPLE::xresample (RESAMPLE *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
return outsamps;
|
||||
}
|
||||
|
||||
|
@ -334,8 +334,8 @@ void RMATCH::xrmatchIN (void* b, float* in)
|
||||
second = 0;
|
||||
}
|
||||
|
||||
memcpy (a->baux, a->ring + 2 * a->iout, first * sizeof (wcomplex));
|
||||
memcpy (a->baux + 2 * first, a->ring, second * sizeof (wcomplex));
|
||||
std::copy(a->ring + 2 * a->iout, a->ring + 2 * a->iout + first * 2, a->baux);
|
||||
std::copy(a->ring, a->ring + second * 2, a->baux + 2 * first);
|
||||
// a->iout = (a->iout + ovfl + a->rsize / 2) % a->rsize;
|
||||
a->iout = (a->iout + ovfl) % a->rsize; //
|
||||
}
|
||||
@ -351,8 +351,8 @@ void RMATCH::xrmatchIN (void* b, float* in)
|
||||
second = 0;
|
||||
}
|
||||
|
||||
memcpy (a->ring + 2 * a->iin, a->resout, first * sizeof (wcomplex));
|
||||
memcpy (a->ring, a->resout + 2 * first, second * sizeof (wcomplex));
|
||||
std::copy(a->resout, a->resout + first * 2, a->ring + 2 * a->iin);
|
||||
std::copy(a->resout + 2 * first, a->resout + 2 * first + second * 2, a->ring);
|
||||
|
||||
if (a->ucnt >= 0)
|
||||
upslew(a, newsamps);
|
||||
@ -427,8 +427,8 @@ void RMATCH::dslew (RMATCH *a)
|
||||
first = zeros;
|
||||
second = 0;
|
||||
}
|
||||
memset (a->ring + 2 * i, 0, first * sizeof (wcomplex));
|
||||
memset (a->ring, 0, second * sizeof (wcomplex));
|
||||
std::fill(a->ring + 2 * i, a->ring + 2 * i + first * 2, 0);
|
||||
std::fill(a->ring, a->ring + second * 2, 0);
|
||||
n += zeros; //
|
||||
} //
|
||||
// a->n_ring = a->outsize + a->rsize / 2;
|
||||
@ -464,8 +464,8 @@ void RMATCH::xrmatchOUT (void* b, float* out)
|
||||
second = 0;
|
||||
}
|
||||
|
||||
memcpy (a->out, a->ring + 2 * a->iout, first * sizeof (wcomplex));
|
||||
memcpy (a->out + 2 * first, a->ring, second * sizeof (wcomplex));
|
||||
std::copy(a->ring + 2 * a->iout, a->ring + 2 * a->iout + first * 2, a->out);
|
||||
std::copy(a->ring, a->ring + second * 2, a->out + 2 * first);
|
||||
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 (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void SHIFT::setBuffers_shift(SHIFT *a, float* in, float* out)
|
||||
|
@ -101,9 +101,9 @@ void SIPHON::destroy_siphon (SIPHON *a)
|
||||
|
||||
void SIPHON::flush_siphon (SIPHON *a)
|
||||
{
|
||||
memset (a->sipbuff, 0, a->sipsize * sizeof (wcomplex));
|
||||
memset (a->sipout , 0, a->sipsize * sizeof (wcomplex));
|
||||
memset (a->specout, 0, a->fftsize * sizeof (wcomplex));
|
||||
std::fill(a->sipbuff, a->sipbuff + a->sipsize * 2, 0);
|
||||
std::fill(a->sipout, a->sipout + a->sipsize * 2, 0);
|
||||
std::fill(a->specout, a->specout + a->fftsize * 2, 0);
|
||||
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 (wcomplex));
|
||||
std::copy(&(a->in[2 * (a->insize - a->sipsize)]), &(a->in[2 * (a->insize - a->sipsize)]) + a->sipsize * 2, a->sipbuff);
|
||||
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 (wcomplex));
|
||||
memcpy (a->sipbuff, a->in + 2 * first, second * sizeof (wcomplex));
|
||||
std::copy(a->in, a->in + first * 2, a->sipbuff + 2 * a->idx);
|
||||
std::copy(a->in + 2 * first, a->in + 2 * first + second * 2, a->sipbuff);
|
||||
if ((a->idx += a->insize) >= a->sipsize) a->idx -= a->sipsize;
|
||||
}
|
||||
break;
|
||||
@ -166,11 +166,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 (wcomplex));
|
||||
std::copy(&(a->sipbuff[2 * j]), &(a->sipbuff[2 * j]) + a->outsize * 2, a->sipout);
|
||||
else
|
||||
{
|
||||
memcpy (a->sipout, &(a->sipbuff[2 * j]), size * sizeof (wcomplex));
|
||||
memcpy (&(a->sipout[2 * size]), a->sipbuff, (a->outsize - size) * sizeof (wcomplex));
|
||||
std::copy(&(a->sipbuff[2 * j]), &(a->sipbuff[2 * j]) + size * 2, a->sipout);
|
||||
std::copy(a->sipbuff, a->sipbuff + (a->outsize - size) * 2, &(a->sipout[2 * size]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ void USLEW::xuslew (USLEW *a)
|
||||
}
|
||||
}
|
||||
else if (a->out != a->in)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void USLEW::setBuffers_uslew (USLEW *a, float* in, float* out)
|
||||
|
@ -240,8 +240,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 (wcomplex));
|
||||
memset (d->outbuff, 0, d->isize * sizeof (wcomplex));
|
||||
std::fill(d->inbuff, d->inbuff + d->isize * 2, 0);
|
||||
std::fill(d->outbuff, d->outbuff + d->isize * 2, 0);
|
||||
|
||||
RESAMPLE::flush_resample (d->inresamp);
|
||||
RESAMPLE::flush_resample (d->outresamp);
|
||||
@ -673,7 +673,7 @@ void SNBA::xsnba (SNBA *d)
|
||||
RESAMPLE::xresample (d->outresamp);
|
||||
}
|
||||
else if (d->out != d->in)
|
||||
memcpy (d->out, d->in, d->bsize * sizeof (wcomplex));
|
||||
std::copy(d->in, d->in + d->bsize * 2, d->out);
|
||||
}
|
||||
|
||||
/********************************************************************************************************
|
||||
|
@ -229,7 +229,7 @@ void SSQL::destroy_ssql (SSQL *a)
|
||||
void SSQL::flush_ssql (SSQL *a)
|
||||
{
|
||||
|
||||
memset (a->b1, 0, a->size * sizeof (wcomplex));
|
||||
std::fill(a->b1, a->b1 + a->size * 2, 0);
|
||||
CBL::flush_cbl (a->dcbl);
|
||||
memset (a->ibuff, 0, a->size * sizeof (float));
|
||||
memset (a->ftovbuff, 0, a->size * sizeof (float));
|
||||
@ -317,7 +317,7 @@ void SSQL::xssql (SSQL *a)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof(wcomplex));
|
||||
std::copy(a->in, a->in + a->size * 2, a->out);
|
||||
}
|
||||
|
||||
void SSQL::setBuffers_ssql (SSQL *a, float* in, float* out)
|
||||
|
@ -120,7 +120,7 @@ void VARSAMP::destroy_varsamp (VARSAMP *a)
|
||||
|
||||
void VARSAMP::flush_varsamp (VARSAMP *a)
|
||||
{
|
||||
memset (a->ring, 0, a->rsize * sizeof (wcomplex));
|
||||
std::fill(a->ring, a->ring + a->rsize * 2, 0);
|
||||
a->idx_in = a->rsize - 1;
|
||||
a->h_offset = 0.0;
|
||||
a->isamps = 0.0;
|
||||
@ -191,7 +191,7 @@ int VARSAMP::xvarsamp (VARSAMP *a, float var)
|
||||
}
|
||||
}
|
||||
else if (a->in != a->out)
|
||||
memcpy (a->out, a->in, a->size * sizeof (wcomplex));
|
||||
std::copy( a->in, a->in + a->size * 2, a->out);
|
||||
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 (wcomplex));
|
||||
std::copy(a->in, a->in + a->io_buffsize * 2, a->out);
|
||||
}
|
||||
|
||||
void WCPAGC::setBuffers_wcpagc (WCPAGC *a, float* in, float* out)
|
||||
|
Loading…
Reference in New Issue
Block a user