mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-20 19:36:16 -04:00
FT8 support: remove or comment out asserts
This commit is contained in:
parent
886ce74220
commit
4067aecd33
56
ft8/fft.cpp
56
ft8/fft.cpp
@ -19,7 +19,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <assert.h>
|
||||
// #include <assert.h>
|
||||
#include <QDebug>
|
||||
#include "fft.h"
|
||||
#include "util.h"
|
||||
@ -83,9 +83,9 @@ FFTEngine::Plan *FFTEngine::get_plan(int n, const char *why)
|
||||
p->uses_ = 1;
|
||||
p->why_ = why;
|
||||
p->r_ = (float *)fftwf_malloc(n * sizeof(float));
|
||||
assert(p->r_);
|
||||
// assert(p->r_);
|
||||
p->c_ = (fftwf_complex *)fftwf_malloc(((n / 2) + 1) * sizeof(fftwf_complex));
|
||||
assert(p->c_);
|
||||
// assert(p->c_);
|
||||
|
||||
// FFTW_ESTIMATE
|
||||
// FFTW_MEASURE
|
||||
@ -94,25 +94,25 @@ FFTEngine::Plan *FFTEngine::get_plan(int n, const char *why)
|
||||
int type = M_FFTW_TYPE;
|
||||
p->type_ = type;
|
||||
p->fwd_ = fftwf_plan_dft_r2c_1d(n, p->r_, p->c_, type);
|
||||
assert(p->fwd_);
|
||||
// assert(p->fwd_);
|
||||
p->rev_ = fftwf_plan_dft_c2r_1d(n, p->c_, p->r_, type);
|
||||
assert(p->rev_);
|
||||
// assert(p->rev_);
|
||||
|
||||
//
|
||||
// complex -> complex
|
||||
//
|
||||
p->cc1_ = (fftwf_complex *)fftwf_malloc(n * sizeof(fftwf_complex));
|
||||
assert(p->cc1_);
|
||||
// assert(p->cc1_);
|
||||
p->cc2_ = (fftwf_complex *)fftwf_malloc(n * sizeof(fftwf_complex));
|
||||
assert(p->cc2_);
|
||||
// assert(p->cc2_);
|
||||
p->cfwd_ = fftwf_plan_dft_1d(n, p->cc1_, p->cc2_, FFTW_FORWARD, type);
|
||||
assert(p->cfwd_);
|
||||
// assert(p->cfwd_);
|
||||
p->crev_ = fftwf_plan_dft_1d(n, p->cc2_, p->cc1_, FFTW_BACKWARD, type);
|
||||
assert(p->crev_);
|
||||
// assert(p->crev_);
|
||||
|
||||
m_plansmu2.unlock();
|
||||
|
||||
assert(m_nplans + 1 < 1000);
|
||||
// assert(m_nplans + 1 < 1000);
|
||||
|
||||
m_plans[m_nplans] = p;
|
||||
m_nplans += 1;
|
||||
@ -144,15 +144,15 @@ std::vector<std::complex<float>> FFTEngine::one_fft(
|
||||
FFTEngine::Plan *p
|
||||
)
|
||||
{
|
||||
assert(i0 >= 0);
|
||||
assert(block > 1);
|
||||
// assert(i0 >= 0);
|
||||
// assert(block > 1);
|
||||
|
||||
int nsamples = samples.size();
|
||||
int nbins = (block / 2) + 1;
|
||||
|
||||
if (p)
|
||||
{
|
||||
assert(p->n_ == block);
|
||||
// assert(p->n_ == block);
|
||||
p->uses_ += 1;
|
||||
}
|
||||
else
|
||||
@ -165,7 +165,7 @@ std::vector<std::complex<float>> FFTEngine::one_fft(
|
||||
double t0 = now();
|
||||
#endif
|
||||
|
||||
assert((int)samples.size() - i0 >= block);
|
||||
// assert((int)samples.size() - i0 >= block);
|
||||
|
||||
int m_in_allocated = 0;
|
||||
float *m_in = (float *)samples.data() + i0;
|
||||
@ -174,7 +174,7 @@ std::vector<std::complex<float>> FFTEngine::one_fft(
|
||||
{
|
||||
// m_in must be on a 16-byte boundary for FFTW.
|
||||
m_in = (float *)fftwf_malloc(sizeof(float) * p->n_);
|
||||
assert(m_in);
|
||||
// assert(m_in);
|
||||
m_in_allocated = 1;
|
||||
for (int i = 0; i < block; i++)
|
||||
{
|
||||
@ -190,7 +190,7 @@ std::vector<std::complex<float>> FFTEngine::one_fft(
|
||||
}
|
||||
|
||||
fftwf_complex *m_out = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * ((p->n_ / 2) + 1));
|
||||
assert(m_out);
|
||||
// assert(m_out);
|
||||
|
||||
fftwf_execute_dft_r2c(m_plan, m_in, m_out);
|
||||
|
||||
@ -220,8 +220,8 @@ std::vector<std::complex<float>> FFTEngine::one_fft(
|
||||
//
|
||||
FFTEngine::ffts_t FFTEngine::ffts(const std::vector<float> &samples, int i0, int block, const char *why)
|
||||
{
|
||||
assert(i0 >= 0);
|
||||
assert(block > 1 && (block % 2) == 0);
|
||||
// assert(i0 >= 0);
|
||||
// assert(block > 1 && (block % 2) == 0);
|
||||
|
||||
int nsamples = samples.size();
|
||||
int nbins = (block / 2) + 1;
|
||||
@ -242,7 +242,7 @@ FFTEngine::ffts_t FFTEngine::ffts(const std::vector<float> &samples, int i0, int
|
||||
// allocate our own b/c using p->m_in and p->m_out isn't thread-safe.
|
||||
float *m_in = (float *)fftwf_malloc(sizeof(float) * p->n_);
|
||||
fftwf_complex *m_out = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * ((p->n_ / 2) + 1));
|
||||
assert(m_in && m_out);
|
||||
// assert(m_in && m_out);
|
||||
|
||||
// float *m_in = p->r_;
|
||||
// fftw_complex *m_out = p->c_;
|
||||
@ -296,8 +296,8 @@ std::vector<std::complex<float>> FFTEngine::one_fft_c(
|
||||
const char *why
|
||||
)
|
||||
{
|
||||
assert(i0 >= 0);
|
||||
assert(block > 1);
|
||||
// assert(i0 >= 0);
|
||||
// assert(block > 1);
|
||||
|
||||
int nsamples = samples.size();
|
||||
|
||||
@ -310,7 +310,7 @@ std::vector<std::complex<float>> FFTEngine::one_fft_c(
|
||||
|
||||
fftwf_complex *m_in = (fftwf_complex *)fftwf_malloc(block * sizeof(fftwf_complex));
|
||||
fftwf_complex *m_out = (fftwf_complex *)fftwf_malloc(block * sizeof(fftwf_complex));
|
||||
assert(m_in && m_out);
|
||||
// assert(m_in && m_out);
|
||||
|
||||
for (int i = 0; i < block; i++)
|
||||
{
|
||||
@ -356,8 +356,8 @@ std::vector<std::complex<float>> FFTEngine::one_fft_cc(
|
||||
const char *why
|
||||
)
|
||||
{
|
||||
assert(i0 >= 0);
|
||||
assert(block > 1);
|
||||
// assert(i0 >= 0);
|
||||
// assert(block > 1);
|
||||
|
||||
int nsamples = samples.size();
|
||||
|
||||
@ -370,7 +370,7 @@ std::vector<std::complex<float>> FFTEngine::one_fft_cc(
|
||||
|
||||
fftwf_complex *m_in = (fftwf_complex *)fftwf_malloc(block * sizeof(fftwf_complex));
|
||||
fftwf_complex *m_out = (fftwf_complex *)fftwf_malloc(block * sizeof(fftwf_complex));
|
||||
assert(m_in && m_out);
|
||||
// assert(m_in && m_out);
|
||||
|
||||
for (int i = 0; i < block; i++)
|
||||
{
|
||||
@ -426,7 +426,7 @@ std::vector<std::complex<float>> FFTEngine::one_ifft_cc(
|
||||
|
||||
fftwf_complex *m_in = (fftwf_complex *)fftwf_malloc(block * sizeof(fftwf_complex));
|
||||
fftwf_complex *m_out = (fftwf_complex *)fftwf_malloc(block * sizeof(fftwf_complex));
|
||||
assert(m_in && m_out);
|
||||
// assert(m_in && m_out);
|
||||
|
||||
for (int bi = 0; bi < block; bi++)
|
||||
{
|
||||
@ -512,7 +512,7 @@ std::vector<std::complex<float>> FFTEngine::analytic(const std::vector<float> &x
|
||||
ulong n = x.size();
|
||||
|
||||
std::vector<std::complex<float>> y = one_fft_c(x, 0, n, why);
|
||||
assert(y.size() == n);
|
||||
// assert(y.size() == n);
|
||||
|
||||
// leave y[0] alone.
|
||||
// float the first (positive) half of the spectrum.
|
||||
@ -553,7 +553,7 @@ std::vector<float> FFTEngine::hilbert_shift(const std::vector<float> &x, float h
|
||||
{
|
||||
// y = scipy.signal.hilbert(x)
|
||||
std::vector<std::complex<float>> y = analytic(x, "hilbert_shift");
|
||||
assert(y.size() == x.size());
|
||||
// assert(y.size() == x.size());
|
||||
|
||||
float dt = 1.0 / rate;
|
||||
int n = x.size();
|
||||
|
53
ft8/ft8.cpp
53
ft8/ft8.cpp
@ -29,7 +29,7 @@
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
// #include <assert.h>
|
||||
#include <math.h>
|
||||
#include <complex>
|
||||
#include <fftw3.h>
|
||||
@ -373,8 +373,8 @@ float FT8::one_coarse_strength(const FFTEngine::ffts_t &bins, int bi0, int si0)
|
||||
{
|
||||
int costas[] = {3, 1, 4, 0, 6, 5, 2};
|
||||
|
||||
assert(si0 >= 0 && si0 + 72 + 8 <= (int)bins.size());
|
||||
assert(bi0 >= 0 && bi0 + 8 <= (int)bins[0].size());
|
||||
// assert(si0 >= 0 && si0 + 72 + 8 <= (int)bins.size());
|
||||
// assert(bi0 >= 0 && bi0 + 8 <= (int)bins[0].size());
|
||||
|
||||
float sig = 0.0;
|
||||
float noise = 0.0;
|
||||
@ -486,8 +486,7 @@ float FT8::one_coarse_strength(const FFTEngine::ffts_t &bins, int bi0, int si0)
|
||||
int FT8::blocksize(int rate)
|
||||
{
|
||||
// FT8 symbol length is 1920 at 12000 samples/second.
|
||||
int xblock = 1920 / (12000.0 / rate);
|
||||
assert(xblock == (int)xblock);
|
||||
int xblock = (1920*rate) / 12000;
|
||||
int block = xblock;
|
||||
return block;
|
||||
}
|
||||
@ -561,8 +560,8 @@ std::vector<float> FT8::reduce_rate(
|
||||
float &delta_hz
|
||||
)
|
||||
{
|
||||
assert(brate < arate);
|
||||
assert(hz1 - hz0 <= brate / 2);
|
||||
// assert(brate < arate);
|
||||
// assert(hz1 - hz0 <= brate / 2);
|
||||
|
||||
// the pass band is hz0..hz1
|
||||
// stop bands are 0..hz00 and hz11..nyquist.
|
||||
@ -621,7 +620,7 @@ std::vector<float> FT8::reduce_rate(
|
||||
int nmid = (brate / 4.0) / bin_hz;
|
||||
|
||||
int delta = omid - nmid; // amount to move down
|
||||
assert(delta < nbins1);
|
||||
// assert(delta < nbins1);
|
||||
int blen = round(alen * (brate / (float)arate));
|
||||
std::vector<std::complex<float>> bbins(blen / 2 + 1);
|
||||
for (int i = 0; i < (int)bbins.size(); i++)
|
||||
@ -677,7 +676,7 @@ void FT8::go(int npasses)
|
||||
samples_.resize(nice);
|
||||
}
|
||||
|
||||
assert(min_hz_ >= 0 && max_hz_ + 50 <= rate_ / 2);
|
||||
// assert(min_hz_ >= 0 && max_hz_ + 50 <= rate_ / 2);
|
||||
|
||||
// can we reduce the sample rate?
|
||||
int nrate = -1;
|
||||
@ -742,8 +741,8 @@ void FT8::go(int npasses)
|
||||
}
|
||||
}
|
||||
|
||||
assert(max_hz_ + 50 < nrate / 2);
|
||||
assert(min_hz_ >= 0);
|
||||
// assert(max_hz_ + 50 < nrate / 2);
|
||||
// assert(min_hz_ >= 0);
|
||||
|
||||
float ratio = nrate / (float)rate_;
|
||||
rate_ = nrate;
|
||||
@ -999,7 +998,7 @@ float FT8::one_strength_known(
|
||||
)
|
||||
{
|
||||
int block = blocksize(rate);
|
||||
assert(syms.size() == 79);
|
||||
// assert(syms.size() == 79);
|
||||
|
||||
int bin0 = round(hz / 6.25);
|
||||
|
||||
@ -1118,7 +1117,7 @@ int FT8::search_time_fine(
|
||||
}
|
||||
|
||||
str = best_sum;
|
||||
assert(best_off >= 0);
|
||||
// assert(best_off >= 0);
|
||||
return off0 + best_off;
|
||||
}
|
||||
|
||||
@ -1181,7 +1180,7 @@ std::vector<Strength> FT8::search_both(
|
||||
int off_win
|
||||
)
|
||||
{
|
||||
assert(hz0 >= 25 - 6.25 / 2 && hz0 <= 25 + 6.25 / 2);
|
||||
// assert(hz0 >= 25 - 6.25 / 2 && hz0 <= 25 + 6.25 / 2);
|
||||
|
||||
std::vector<Strength> strengths;
|
||||
|
||||
@ -1218,7 +1217,7 @@ void FT8::search_both_known(
|
||||
float &off_out
|
||||
)
|
||||
{
|
||||
assert(hz0 >= 0 && hz0 + 50 < rate / 2);
|
||||
// assert(hz0 >= 0 && hz0 + 50 < rate / 2);
|
||||
|
||||
int off0 = round(off_secs0 * (float)rate);
|
||||
|
||||
@ -1976,7 +1975,7 @@ void FT8::soft_decode(const FFTEngine::ffts_t &c79, float ll174[])
|
||||
ll174[lli++] = ll;
|
||||
}
|
||||
}
|
||||
assert(lli == 174);
|
||||
// assert(lli == 174);
|
||||
}
|
||||
|
||||
//
|
||||
@ -2153,7 +2152,7 @@ void FT8::c_soft_decode(const FFTEngine::ffts_t &c79x, float ll174[])
|
||||
ll174[lli++] = ll;
|
||||
}
|
||||
}
|
||||
assert(lli == 174);
|
||||
// assert(lli == 174);
|
||||
}
|
||||
|
||||
//
|
||||
@ -2168,8 +2167,8 @@ void FT8::c_soft_decode(const FFTEngine::ffts_t &c79x, float ll174[])
|
||||
//
|
||||
std::vector<float> FT8::extract_bits(const std::vector<int> &syms, const std::vector<float> str)
|
||||
{
|
||||
assert(syms.size() == 79);
|
||||
assert(str.size() == 79);
|
||||
// assert(syms.size() == 79);
|
||||
// assert(str.size() == 79);
|
||||
|
||||
std::vector<float> bits;
|
||||
for (int si = 0; si < 79; si++)
|
||||
@ -2323,7 +2322,7 @@ void FT8::soft_decode_pairs(
|
||||
ll174[lli++] = ll;
|
||||
}
|
||||
}
|
||||
assert(lli == 174);
|
||||
// assert(lli == 174);
|
||||
}
|
||||
|
||||
void FT8::soft_decode_triples(
|
||||
@ -2485,7 +2484,7 @@ void FT8::soft_decode_triples(
|
||||
ll174[lli++] = ll;
|
||||
}
|
||||
}
|
||||
assert(lli == 174);
|
||||
// assert(lli == 174);
|
||||
}
|
||||
|
||||
//
|
||||
@ -2552,11 +2551,9 @@ std::vector<std::complex<float>> FT8::fbandpass(
|
||||
float high_outer // end of transition
|
||||
)
|
||||
{
|
||||
// assert(low_outer >= 0);
|
||||
assert(low_outer <= low_inner);
|
||||
assert(low_inner <= high_inner);
|
||||
assert(high_inner <= high_outer);
|
||||
// assert(high_outer <= bin_hz * bins0.size());
|
||||
// assert(low_outer <= low_inner);
|
||||
// assert(low_inner <= high_inner);
|
||||
// assert(high_inner <= high_outer);
|
||||
|
||||
int nbins = bins0.size();
|
||||
std::vector<std::complex<float>> bins1(nbins);
|
||||
@ -3449,8 +3446,8 @@ std::vector<int> FT8::recode(int a174[])
|
||||
out79.push_back(sym);
|
||||
}
|
||||
}
|
||||
assert(out79.size() == 79);
|
||||
assert(i174 == 174);
|
||||
// assert(out79.size() == 79);
|
||||
// assert(i174 == 174);
|
||||
return out79;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "arrays.h"
|
||||
|
||||
// float, long float, __float128
|
||||
@ -414,8 +413,9 @@ void gauss_jordan(int rows, int cols, int m[174][2 * 91], int which[91], int *ok
|
||||
{
|
||||
*ok = 0;
|
||||
|
||||
assert(rows == 91);
|
||||
assert(cols == 174);
|
||||
if ((rows != 91) || (cols != 174)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int row = 0; row < rows; row++)
|
||||
{
|
||||
|
@ -19,7 +19,6 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
|
||||
#include "unpack.h"
|
||||
#include "unpack0.h"
|
||||
@ -42,9 +41,12 @@ int Packing::ihashcall(std::string rawcall, int m)
|
||||
{
|
||||
int c = call[i];
|
||||
const char *p = strchr(chars, c);
|
||||
assert(p);
|
||||
int j = p - chars;
|
||||
x = 38 * x + j;
|
||||
|
||||
if (p)
|
||||
{
|
||||
int j = p - chars;
|
||||
x = 38 * x + j;
|
||||
}
|
||||
}
|
||||
|
||||
x = x * 47055833459LL;
|
||||
@ -319,7 +321,10 @@ std::string Packing::unpack_1(int a77[], std::string& call1str, std::string& cal
|
||||
i += 15;
|
||||
int i3 = un64(a77, i, 3);
|
||||
i += 3;
|
||||
assert((i3 == 1 || i3 == 2) && i == 77);
|
||||
|
||||
if (!((i3 == 1 || i3 == 2) && i == 77)) {
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
call1str = trim(unpackcall(call1));
|
||||
call2str = trim(unpackcall(call2));
|
||||
|
@ -32,7 +32,7 @@ boost::multiprecision::int128_t un128(int a77[], int start, int len)
|
||||
{
|
||||
boost::multiprecision::int128_t x = 0;
|
||||
|
||||
assert(len < (int)sizeof(x) * 8 && start >= 0 && start + len <= 77);
|
||||
// assert(len < (int)sizeof(x) * 8 && start >= 0 && start + len <= 77);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
x <<= 1;
|
||||
@ -50,7 +50,7 @@ uint64_t un64(int a77[], int start, int len)
|
||||
{
|
||||
uint64_t x = 0;
|
||||
|
||||
assert(len < (int)sizeof(x) * 8 && start >= 0 && start + len <= 63);
|
||||
// assert(len < (int)sizeof(x) * 8 && start >= 0 && start + len <= 63);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
x <<= 1;
|
||||
|
13
ft8/util.cpp
13
ft8/util.cpp
@ -18,7 +18,6 @@
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <complex>
|
||||
#include <string>
|
||||
@ -175,7 +174,11 @@ std::vector<std::complex<float>> gfsk_c(
|
||||
const std::vector<float> &gwin
|
||||
)
|
||||
{
|
||||
assert((gwin.size() % 2) == 0);
|
||||
if (!((gwin.size() % 2) == 0))
|
||||
{
|
||||
std::vector<std::complex<float>> v(symsamples * symbols.size());
|
||||
return v;
|
||||
}
|
||||
|
||||
// compute frequency for each symbol.
|
||||
// generate a spike in the middle of each symbol time;
|
||||
@ -251,7 +254,11 @@ std::vector<float> gfsk_r(
|
||||
const std::vector<float> &gwin
|
||||
)
|
||||
{
|
||||
assert((gwin.size() % 2) == 0);
|
||||
if (!((gwin.size() % 2) == 0))
|
||||
{
|
||||
std::vector<float> v(symsamples * symbols.size());
|
||||
return v;
|
||||
}
|
||||
|
||||
// compute frequency for each symbol.
|
||||
// generate a spike in the middle of each symbol time;
|
||||
|
Loading…
Reference in New Issue
Block a user