diff --git a/ft8/ft4.cpp b/ft8/ft4.cpp index ec32153f8..5ef13941a 100644 --- a/ft8/ft4.cpp +++ b/ft8/ft4.cpp @@ -70,7 +70,7 @@ FT4::FT4( float min_hz, float max_hz, int start, - int rate, + float rate, const int hints1[], const int hints2[], double deadline, @@ -227,7 +227,7 @@ float FT4::one_coarse_strength(const FFTEngine::ffts_t &bins, int bi0, int si0) // return symbol length in samples at the given rate. // insist on integer symbol lengths so that we can // use whole FFT bins. -int FT4::blocksize(int rate) const +int FT4::blocksize(float rate) const { // FT4 symbol length is 576 at 12000 samples/second. int xblock = (576*rate) / 12000; @@ -389,7 +389,7 @@ void FT4::go(int npasses) { if (0) { - fprintf(stderr, "go: %.0f .. %.0f, %.0f, rate=%d\n", + fprintf(stderr, "go: %.0f .. %.0f, %.0f, rate=%.0f\n", min_hz_, max_hz_, max_hz_ - min_hz_, rate_); } @@ -417,9 +417,10 @@ void FT4::go(int npasses) // can we reduce the sample rate? int nrate = -1; + int irate = round(rate_); for (int xrate = 100; xrate < rate_; xrate += 100) { - if (xrate < rate_ && (params.oddrate || (rate_ % xrate) == 0)) + if (xrate < rate_ && (params.oddrate || (irate % xrate) == 0)) { if (((max_hz_ - min_hz_) + 93.6 + 2 * params.go_extra) < params.nyquist * (xrate / 2)) { @@ -450,7 +451,7 @@ void FT4::go(int npasses) if (t1 - t0 > 0.1) { - fprintf(stderr, "reduce oops, size %d -> %d, rate %d -> %d, took %.2f\n", + fprintf(stderr, "reduce oops, size %d -> %d, rate %.0f -> %d, took %.2f\n", osize, (int)samples_.size(), rate_, @@ -460,10 +461,14 @@ void FT4::go(int npasses) if (0) { - fprintf(stderr, "%.0f..%.0f, range %.0f, rate %d -> %d, delta hz %.0f, %.6f sec\n", - min_hz_, max_hz_, + fprintf(stderr, "%.0f..%.0f, range %.0f, rate %.0f -> %d, delta hz %.0f, %.6f sec\n", + min_hz_, + max_hz_, max_hz_ - min_hz_, - rate_, nrate, delta_hz, t1 - t0); + rate_, + nrate, + delta_hz, + t1 - t0); } if (delta_hz > 0) @@ -494,8 +499,9 @@ void FT4::go(int npasses) int need = start_ + params.tplus * rate_ + 103 * block - samples_.size(); // round up to a whole second, to ease fft plan caching. - if ((need % rate_) != 0) { - need += rate_ - (need % rate_); + int irate = round(rate_); + if ((need % irate) != 0) { + need += irate - (need % irate); } std::default_random_engine generator; @@ -718,7 +724,7 @@ float FT4::one_strength(const std::vector &samples200, float hz, int off) // float FT4::one_strength_known( const std::vector &samples, - int rate, + float rate, const std::vector &syms, float hz, int off @@ -831,7 +837,7 @@ int FT4::search_time_fine( int FT4::search_time_fine_known( const std::vector> &bins, - int rate, + float rate, const std::vector &syms, int off0, int offN, @@ -928,7 +934,7 @@ std::vector FT4::search_both( void FT4::search_both_known( const std::vector &samples, - int rate, + float rate, const std::vector &syms, float hz0, float off_secs0, // seconds @@ -936,7 +942,7 @@ void FT4::search_both_known( float &off_out ) { - int off0 = round(off_secs0 * (float)rate); + int off0 = round(off_secs0 * rate); int off_win = params.third_off_win * blocksize(rate_); if (off_win < 1) { @@ -997,7 +1003,7 @@ void FT4::search_both_known( if (got_best) { hz_out = best_hz; - off_out = best_off / (float)rate; + off_out = best_off / rate; } } @@ -1011,7 +1017,7 @@ std::vector FT4::fft_shift( const std::vector &samples, int off, int len, - int rate, + float rate, float hz ) { @@ -1046,7 +1052,7 @@ std::vector FT4::fft_shift( // std::vector FT4::fft_shift_f( const std::vector> &bins, - int rate, + float rate, float hz ) { @@ -3429,7 +3435,7 @@ void FT4Decoder::entry( const float xsamples[], int nsamples, int start, - int rate, + float rate, float min_hz, float max_hz, const int hints1[], diff --git a/ft8/ft4.h b/ft8/ft4.h index 9f391fc0d..5c522fae7 100644 --- a/ft8/ft4.h +++ b/ft8/ft4.h @@ -42,7 +42,7 @@ public: float min_hz, float max_hz, int start, - int rate, + float rate, const int hints1[], const int hints2[], double deadline, @@ -62,7 +62,7 @@ public: // return symbol length in samples at the given rate. // insist on integer symbol lengths so that we can // use whole FFT bins. - int blocksize(int rate) const; + int blocksize(float rate) const; // // look for potential signals by searching FFT bins for Costas symbol // blocks. returns a vector of candidate positions. @@ -111,7 +111,7 @@ private: // float one_strength_known( const std::vector &samples, - int rate, + float rate, const std::vector &syms, float hz, int off @@ -126,7 +126,7 @@ private: ); int search_time_fine_known( const std::vector> &bins, - int rate, + float rate, const std::vector &syms, int off0, int offN, @@ -150,7 +150,7 @@ private: ); void search_both_known( const std::vector &samples, - int rate, + float rate, const std::vector &syms, float hz0, float off_secs0, // seconds @@ -167,7 +167,7 @@ private: const std::vector &samples, int off, int len, - int rate, + float rate, float hz ); // @@ -175,7 +175,7 @@ private: // std::vector fft_shift_f( const std::vector> &bins, - int rate, + float rate, float hz ); // shift the frequency by a fraction of 23.4, @@ -395,7 +395,7 @@ private: std::vector nsamples_; // subtract from here int start_; // sample number of 0.5 seconds into samples[] - int rate_; // samples/second + float rate_; // samples/second double deadline_; // start time + budget double final_deadline_; // keep going this long if no decodes std::vector hints1_; @@ -426,7 +426,7 @@ public: const float xsamples[], int nsamples, int start, - int rate, + float rate, float min_hz, float max_hz, const int hints1[], diff --git a/plugins/channelrx/demodft8/ft8demodsettingsdialog.cpp b/plugins/channelrx/demodft8/ft8demodsettingsdialog.cpp index 7ddb20da3..6c757684c 100644 --- a/plugins/channelrx/demodft8/ft8demodsettingsdialog.cpp +++ b/plugins/channelrx/demodft8/ft8demodsettingsdialog.cpp @@ -27,7 +27,9 @@ FT8DemodSettingsDialog::FT8DemodSettingsDialog(FT8DemodSettings& settings, QStri m_settingsKeys(settingsKeys) { ui->setupUi(this); + ui->decoderMode->blockSignals(true); ui->decoderMode->setCurrentIndex(m_settings.m_decoderMode); + ui->decoderMode->blockSignals(false); ui->decoderNbThreads->setValue(m_settings.m_nbDecoderThreads); ui->decoderTimeBudget->setValue(m_settings.m_decoderTimeBudget); ui->osdEnable->setChecked(m_settings.m_useOSD);