Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define ht length #227

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Core/fft_mt_r2iq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void fft_mt_r2iq::Init(float gain, ringbuffer<int16_t> *input, ringbuffer<float>

// DbgPrintf((char *) "RandTable generated\n");

#define HTLEN (halfFft / 4 + 1)
ik1xpv marked this conversation as resolved.
Show resolved Hide resolved
// filters
fftwf_complex *pfilterht; // time filter ht
pfilterht = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*halfFft); // halfFft
Expand All @@ -166,7 +167,7 @@ void fft_mt_r2iq::Init(float gain, ringbuffer<int16_t> *input, ringbuffer<float>
}

filterplan_t2f_c2c = fftwf_plan_dft_1d(halfFft, pfilterht, filterHw[0], FFTW_FORWARD, FFTW_MEASURE);
float *pht = new float[halfFft / 4 + 1];
float *pht = new float[HTLEN];
const float Astop = 120.0f;
const float relPass = 0.85f; // 85% of Nyquist should be usable
const float relStop = 1.1f; // 'some' alias back into transition band is OK
Expand All @@ -176,7 +177,7 @@ void fft_mt_r2iq::Init(float gain, ringbuffer<int16_t> *input, ringbuffer<float>
// to allow same stopband-attenuation for all decimations
float Bw = 64.0f / mratio[d];
// Bw *= 0.8f; // easily visualize Kaiser filter's response
KaiserWindow(halfFft / 4 + 1, Astop, relPass * Bw / 128.0f, relStop * Bw / 128.0f, pht);
KaiserWindow(HTLEN, Astop, relPass * Bw / 128.0f, relStop * Bw / 128.0f, pht);

float gainadj = gain * 2048.0f / (float)FFTN_R_ADC; // reference is FFTN_R_ADC == 2048

Expand All @@ -185,7 +186,7 @@ void fft_mt_r2iq::Init(float gain, ringbuffer<int16_t> *input, ringbuffer<float>
pfilterht[t][0] = pfilterht[t][1]= 0.0F;
}

for (int t = 0; t < (halfFft/4+1); t++)
for (int t = 0; t < (HTLEN); t++)
{
pfilterht[halfFft-1-t][0] = gainadj * pht[t];
}
Expand Down