From f2dff168205f375949ecd4f574a056b11b306450 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sat, 30 Jan 2016 17:30:54 -0800 Subject: [PATCH] Use complex channel filter taps for AM/SSB. --- firmware/application/analog_audio_app.cpp | 2 +- firmware/baseband/dsp_decimate.cpp | 12 ------------ firmware/baseband/dsp_decimate.hpp | 11 +++++++++-- firmware/common/message.hpp | 6 +++--- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/firmware/application/analog_audio_app.cpp b/firmware/application/analog_audio_app.cpp index 60eaca4e..082dbae4 100644 --- a/firmware/application/analog_audio_app.cpp +++ b/firmware/application/analog_audio_app.cpp @@ -103,7 +103,7 @@ void AnalogAudioModel::configure_am() { taps_6k0_decim_0, taps_6k0_decim_1, taps_6k0_decim_2, - taps_6k0_channel, + taps_2k8_usb_channel, audio_12k_hpf_300hz_config }; shared_memory.baseband_queue.push(message); diff --git a/firmware/baseband/dsp_decimate.cpp b/firmware/baseband/dsp_decimate.cpp index af5f12e3..abd8e7d0 100644 --- a/firmware/baseband/dsp_decimate.cpp +++ b/firmware/baseband/dsp_decimate.cpp @@ -645,18 +645,6 @@ buffer_s16_t FIR64AndDecimateBy2Real::execute( return { dst.p, src.count / 2, src.sampling_rate / 2 }; } -void FIRAndDecimateComplex::configure( - const int16_t* const taps, - const size_t taps_count, - const size_t decimation_factor -) { - samples_ = std::make_unique(taps_count); - taps_reversed_ = std::make_unique(taps_count); - taps_count_ = taps_count; - decimation_factor_ = decimation_factor; - std::reverse_copy(&taps[0], &taps[taps_count], &taps_reversed_[0]); -} - buffer_c16_t FIRAndDecimateComplex::execute( const buffer_c16_t& src, const buffer_c16_t& dst diff --git a/firmware/baseband/dsp_decimate.hpp b/firmware/baseband/dsp_decimate.hpp index 0f4ca845..1a9bf303 100644 --- a/firmware/baseband/dsp_decimate.hpp +++ b/firmware/baseband/dsp_decimate.hpp @@ -235,11 +235,18 @@ private: size_t taps_count_; size_t decimation_factor_; + template void configure( - const int16_t* const taps, + const T* const taps, const size_t taps_count, const size_t decimation_factor - ); + ) { + samples_ = std::make_unique(taps_count); + taps_reversed_ = std::make_unique(taps_count); + taps_count_ = taps_count; + decimation_factor_ = decimation_factor; + std::reverse_copy(&taps[0], &taps[taps_count], &taps_reversed_[0]); + } }; class DecimateBy2CIC4Real { diff --git a/firmware/common/message.hpp b/firmware/common/message.hpp index dc3385ea..79e51267 100644 --- a/firmware/common/message.hpp +++ b/firmware/common/message.hpp @@ -39,7 +39,7 @@ class Message { public: - static constexpr size_t MAX_SIZE = 288; + static constexpr size_t MAX_SIZE = 512; enum class ID : uint32_t { /* Assign consecutive IDs. IDs are used to index array. */ @@ -377,7 +377,7 @@ public: const fir_taps_real<24> decim_0_filter, const fir_taps_real<32> decim_1_filter, const fir_taps_real<32> decim_2_filter, - const fir_taps_real<32> channel_filter, + const fir_taps_complex<64> channel_filter, const iir_biquad_config_t audio_hpf_config ) : Message { ID::AMConfigure }, decim_0_filter(decim_0_filter), @@ -391,7 +391,7 @@ public: const fir_taps_real<24> decim_0_filter; const fir_taps_real<32> decim_1_filter; const fir_taps_real<32> decim_2_filter; - const fir_taps_real<32> channel_filter; + const fir_taps_complex<64> channel_filter; const iir_biquad_config_t audio_hpf_config; };