From a4636d7872cbc9c4d0b1cfc83268db293d92a3ac Mon Sep 17 00:00:00 2001 From: Brumi-2021 <86470699+Brumi-2021@users.noreply.github.com> Date: Fri, 18 Aug 2023 14:49:22 +0200 Subject: [PATCH] Finalise all low bit rate Capture App with x64 (#1386) * Finalise all low bit rate Capture App with x64 * Adding back also 25k BW option --- firmware/application/freqman_db.cpp | 1 + firmware/application/ui_record_view.cpp | 11 +++++------ firmware/baseband/proc_capture.cpp | 16 +++++++++++++--- firmware/common/oversample.hpp | 7 +++---- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/firmware/application/freqman_db.cpp b/firmware/application/freqman_db.cpp index 5d2d0bf2..22075160 100644 --- a/firmware/application/freqman_db.cpp +++ b/firmware/application/freqman_db.cpp @@ -77,6 +77,7 @@ options_t freqman_bandwidths[4] = { {"12k5", 12500}, {"16k", 16000}, {"25k", 25000}, + {"32k", 32000}, {"50k", 50000}, {"75k", 75000}, {"100k", 100000}, diff --git a/firmware/application/ui_record_view.cpp b/firmware/application/ui_record_view.cpp index b5dbc0f9..3d1f143b 100644 --- a/firmware/application/ui_record_view.cpp +++ b/firmware/application/ui_record_view.cpp @@ -113,8 +113,7 @@ uint32_t RecordView::set_sampling_rate(uint32_t new_sampling_rate) { * They are ok as recorded spectrum indication, but they should not be used by Replay app. (the voice speed will be accelerated) * We keep original black background in all the correct IQ .C16 files BW's Options. */ - if ((actual_sampling_rate > 8'000'000) || ((actual_sampling_rate <= 1'600'000) && (oversample_rate > OversampleRate::x8))) { // yellow REC button means not ok for REC, BW >1Mhz , BW <= 100khz due to NG aliasing. - // to be updated or removed in the next PR's, according the achieved extended BW's with good quality bandwith REC limits . + if (actual_sampling_rate > 8'000'000) { // yellow REC button means not ok for REC, BW >1Mhz (BW from 12k5 till 1Mhz OK for REC and Replay) button_record.set_background(ui::Color::yellow()); } else { button_record.set_background(ui::Color::black()); @@ -145,11 +144,11 @@ OversampleRate RecordView::get_oversample_rate(uint32_t sample_rate) { auto rate = ::get_oversample_rate(sample_rate); - // Currently proc_capture only supports x8, x16, x32 for decimation. - if (rate < OversampleRate::x8) // clipping while x4 is not implemented yet. + // Currently proc_capture only supports /8, /16, /32 for decimation. + if (rate < OversampleRate::x8) // clipping while /4 is not implemented yet (it will be used >1Mhz onwards when available) rate = OversampleRate::x8; - else if (rate > OversampleRate::x32) // clipping while x64 is not implemented yet . - rate = OversampleRate::x32; + else if (rate > OversampleRate::x64) // clipping while /128 is not implemented yet , (but it is not necessary for 12k5) + rate = OversampleRate::x64; return rate; } diff --git a/firmware/baseband/proc_capture.cpp b/firmware/baseband/proc_capture.cpp index 20bee010..72008094 100644 --- a/firmware/baseband/proc_capture.cpp +++ b/firmware/baseband/proc_capture.cpp @@ -120,7 +120,11 @@ void CaptureProcessor::sample_rate_config(const SampleRateConfigMessage& message break; case OversampleRate::x32: - decim_1_factor = 2 * decim_1_8.decimation_factor; // /x32 = /4x8 (we applied additional *2 correction to speed up waterfall, no effect to scale spectrum) + decim_1_factor = 2 * decim_1_8.decimation_factor; // /32 = /4x8 (we applied additional *2 correction to speed up waterfall, no effect to scale spectrum) + break; + + case OversampleRate::x64: + decim_1_factor = 8 * decim_1_8.decimation_factor; // /64 = /8x8 (we applied additional *8 correction to speed up waterfall, no effect to scale spectrum) break; default: @@ -167,6 +171,9 @@ buffer_c16_t CaptureProcessor::decim_0_execute(const buffer_c8_t& src, const buf case OversampleRate::x32: return decim_0_4.execute(src, dst); // decim_0 , /4 with double decim stage + case OversampleRate::x64: + return decim_0_8.execute(src, dst); // decim_0 , /8 with double decim stage + default: chDbgPanic("Unhandled OversampleRate"); return {}; @@ -183,10 +190,13 @@ buffer_c16_t CaptureProcessor::decim_1_execute(const buffer_c16_t& src, const bu } case OversampleRate::x16: - return decim_1_2.execute(src, dst); // total decim /16 = /8x2, applied to 150khz + return decim_1_2.execute(src, dst); // total decim /16 = /8x2, applied to 100khz and 150khz case OversampleRate::x32: - return decim_1_8.execute(src, dst); // total decim /32 = /4x8, appled to <= 100khz , 75k with margin ,(50k, 25k, 12k5 now also) ... + return decim_1_8.execute(src, dst); // total decim /32 = /4x8, appled to 75k , 50k, 32k + + case OversampleRate::x64: + return decim_1_8.execute(src, dst); // total decim /64 = /8x8, appled to 16k and 12k5 default: chDbgPanic("Unhandled OversampleRate"); diff --git a/firmware/common/oversample.hpp b/firmware/common/oversample.hpp index afe1e927..45186f72 100644 --- a/firmware/common/oversample.hpp +++ b/firmware/common/oversample.hpp @@ -57,10 +57,9 @@ * The oversample rate is used to increase the sample rate to improve SNR and quality. * This is also used as the interpolation rate when replaying captures. */ inline OversampleRate get_oversample_rate(uint32_t sample_rate) { - if (sample_rate < 50'000) return OversampleRate::x128; // 25k..12k5, prepared for future, OVS ok, but decim. x128 still not implemented. - if (sample_rate < 100'000) return OversampleRate::x64; // 50k, prepared for future, OVS ok, but decim. x64 still not implemented. - if (sample_rate < 150'000) return OversampleRate::x32; // 100k needs x32 - if (sample_rate < 250'000) return OversampleRate::x16; // 150k needs x16 + if (sample_rate < 30'000) return OversampleRate::x64; // 25k, 16k, 12k5. + if (sample_rate < 80'000) return OversampleRate::x32; // 75k, 50k, 32k. + if (sample_rate < 250'000) return OversampleRate::x16; // 100k and 150k. return OversampleRate::x8; // 250k .. 1Mhz, that decim x8 , is already applied.(OVerSampling and decim OK) }