Implemented correct display of the filter indicator on the waterfall

This commit is contained in:
Белоусов Олег 2020-12-23 18:00:51 +03:00
parent 608c8c3597
commit 63f6a885d8
17 changed files with 153 additions and 73 deletions

View File

@ -94,13 +94,16 @@ void FrequencyScale::set_spectrum_sampling_rate(const int new_sampling_rate) {
}
void FrequencyScale::set_channel_filter(
const int pass_frequency,
const int stop_frequency
const int low_frequency,
const int high_frequency,
const int transition
) {
if( (channel_filter_pass_frequency != pass_frequency) ||
(channel_filter_stop_frequency != stop_frequency) ) {
channel_filter_pass_frequency = pass_frequency;
channel_filter_stop_frequency = stop_frequency;
if( (channel_filter_low_frequency != low_frequency) ||
(channel_filter_high_frequency != high_frequency) ||
(channel_filter_transition != transition) ) {
channel_filter_low_frequency = low_frequency;
channel_filter_high_frequency = high_frequency;
channel_filter_transition = transition;
set_dirty();
}
}
@ -184,41 +187,28 @@ void FrequencyScale::draw_frequency_ticks(Painter& painter, const Rect r) {
}
void FrequencyScale::draw_filter_ranges(Painter& painter, const Rect r) {
if( channel_filter_pass_frequency ) {
if( channel_filter_low_frequency != channel_filter_high_frequency ) {
const auto x_center = r.width() / 2;
const auto pass_offset = channel_filter_pass_frequency * spectrum_bins / spectrum_sampling_rate;
const auto stop_offset = channel_filter_stop_frequency * spectrum_bins / spectrum_sampling_rate;
const auto x_low = x_center + channel_filter_low_frequency * spectrum_bins / spectrum_sampling_rate;
const auto x_high = x_center + channel_filter_high_frequency * spectrum_bins / spectrum_sampling_rate;
const auto pass_x_lo = x_center - pass_offset;
const auto pass_x_hi = x_center + pass_offset;
if( channel_filter_transition ) {
const auto trans = channel_filter_transition * spectrum_bins / spectrum_sampling_rate;
if( channel_filter_stop_frequency ) {
const auto stop_x_lo = x_center - stop_offset;
const auto stop_x_hi = x_center + stop_offset;
const Rect r_stop_lo {
r.left() + stop_x_lo, r.bottom() - filter_band_height,
pass_x_lo - stop_x_lo, filter_band_height
const Rect r_all {
r.left() + x_low - trans, r.bottom() - filter_band_height,
x_high - x_low + trans*2, filter_band_height
};
painter.fill_rectangle(
r_stop_lo,
Color::yellow()
);
const Rect r_stop_hi {
r.left() + pass_x_hi, r.bottom() - filter_band_height,
stop_x_hi - pass_x_hi, filter_band_height
};
painter.fill_rectangle(
r_stop_hi,
r_all,
Color::yellow()
);
}
const Rect r_pass {
r.left() + pass_x_lo, r.bottom() - filter_band_height,
pass_x_hi - pass_x_lo, filter_band_height
r.left() + x_low, r.bottom() - filter_band_height,
x_high - x_low, filter_band_height
};
painter.fill_rectangle(
r_pass,
@ -390,8 +380,9 @@ void WaterfallWidget::on_channel_spectrum(const ChannelSpectrum& spectrum) {
sampling_rate = spectrum.sampling_rate;
frequency_scale.set_spectrum_sampling_rate(sampling_rate);
frequency_scale.set_channel_filter(
spectrum.channel_filter_pass_frequency,
spectrum.channel_filter_stop_frequency
spectrum.channel_filter_low_frequency,
spectrum.channel_filter_high_frequency,
spectrum.channel_filter_transition
);
}

View File

@ -82,7 +82,7 @@ public:
bool on_key(const KeyEvent key) override;
void set_spectrum_sampling_rate(const int new_sampling_rate);
void set_channel_filter(const int pass_frequency, const int stop_frequency);
void set_channel_filter(const int low_frequency, const int high_frequency, const int transition);
void paint(Painter& painter) override;
@ -96,8 +96,9 @@ private:
SignalToken signal_token_tick_second { };
int spectrum_sampling_rate { 0 };
const int spectrum_bins = std::tuple_size<decltype(ChannelSpectrum::db)>::value;
int channel_filter_pass_frequency { 0 };
int channel_filter_stop_frequency { 0 };
int channel_filter_low_frequency { 0 };
int channel_filter_high_frequency { 0 };
int channel_filter_transition { 0 };
void clear();
void clear_background(Painter& painter, const Rect r);

View File

@ -35,7 +35,7 @@ void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) {
const auto decim_0_out = decim_0.execute(buffer, dst_buffer);
const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer);
channel_spectrum.feed(decim_1_out, channel_filter_pass_f, channel_filter_stop_f);
channel_spectrum.feed(decim_1_out, channel_filter_low_f, channel_filter_high_f, channel_filter_transition);
const auto decim_2_out = decim_2.execute(decim_1_out, dst_buffer);
const auto channel_out = channel_filter.execute(decim_2_out, dst_buffer);
@ -93,8 +93,9 @@ void NarrowbandAMAudio::configure(const AMConfigureMessage& message) {
decim_1.configure(message.decim_1_filter.taps, 131072);
decim_2.configure(message.decim_2_filter.taps, decim_2_decimation_factor);
channel_filter.configure(message.channel_filter.taps, channel_filter_decimation_factor);
channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs;
channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs;
channel_filter_low_f = message.channel_filter.low_frequency_normalized * channel_filter_input_fs;
channel_filter_high_f = message.channel_filter.high_frequency_normalized * channel_filter_input_fs;
channel_filter_transition = message.channel_filter.transition_normalized * channel_filter_input_fs;
channel_spectrum.set_decimation_factor(1.0f);
modulation_ssb = (message.modulation == AMConfigureMessage::Modulation::SSB);
audio_output.configure(message.audio_hpf_config);

View File

@ -64,8 +64,9 @@ private:
dsp::decimate::FIRC16xR16x32Decim8 decim_1 { };
dsp::decimate::FIRAndDecimateComplex decim_2 { };
dsp::decimate::FIRAndDecimateComplex channel_filter { };
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
int32_t channel_filter_low_f = 0;
int32_t channel_filter_high_f = 0;
int32_t channel_filter_transition = 0;
bool modulation_ssb = false;
dsp::demodulate::AM demod_am { };

View File

@ -52,7 +52,7 @@ void CaptureProcessor::execute(const buffer_c8_t& buffer) {
spectrum_samples += channel.count;
if( spectrum_samples >= spectrum_interval_samples ) {
spectrum_samples -= spectrum_interval_samples;
channel_spectrum.feed(channel, channel_filter_pass_f, channel_filter_stop_f);
channel_spectrum.feed(channel, channel_filter_low_f, channel_filter_high_f, channel_filter_transition);
}
}
@ -85,8 +85,9 @@ void CaptureProcessor::samplerate_config(const SamplerateConfigMessage& message)
size_t decim_1_input_fs = decim_0_output_fs;
size_t decim_1_output_fs = decim_1_input_fs / decim_1.decimation_factor;
channel_filter_pass_f = taps_200k_decim_1.pass_frequency_normalized * decim_1_input_fs; // 162760.416666667
channel_filter_stop_f = taps_200k_decim_1.stop_frequency_normalized * decim_1_input_fs; // 337239.583333333
channel_filter_low_f = taps_200k_decim_1.low_frequency_normalized * decim_1_input_fs;
channel_filter_high_f = taps_200k_decim_1.high_frequency_normalized * decim_1_input_fs;
channel_filter_transition = taps_200k_decim_1.transition_normalized * decim_1_input_fs;
spectrum_interval_samples = decim_1_output_fs / spectrum_rate_hz;
spectrum_samples = 0;

View File

@ -60,8 +60,9 @@ private:
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { };
dsp::decimate::FIRC16xR16x16Decim2 decim_1 { };
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
int32_t channel_filter_low_f = 0;
int32_t channel_filter_high_f = 0;
int32_t channel_filter_transition = 0;
std::unique_ptr<StreamInput> stream { };

View File

@ -39,7 +39,7 @@ void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) {
const auto decim_0_out = decim_0.execute(buffer, dst_buffer);
const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer);
channel_spectrum.feed(decim_1_out, channel_filter_pass_f, channel_filter_stop_f);
channel_spectrum.feed(decim_1_out, channel_filter_low_f, channel_filter_high_f, channel_filter_transition);
const auto channel_out = channel_filter.execute(decim_1_out, dst_buffer);
@ -145,8 +145,9 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& message) {
decim_1.configure(message.decim_1_filter.taps, 131072);
channel_filter.configure(message.channel_filter.taps, message.channel_decimation);
demod.configure(demod_input_fs, message.deviation);
channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs;
channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs;
channel_filter_low_f = message.channel_filter.low_frequency_normalized * channel_filter_input_fs;
channel_filter_high_f = message.channel_filter.high_frequency_normalized * channel_filter_input_fs;
channel_filter_transition = message.channel_filter.transition_normalized * channel_filter_input_fs;
channel_spectrum.set_decimation_factor(1.0f);
audio_output.configure(message.audio_hpf_config, message.audio_deemph_config, (float)message.squelch_level / 100.0);

View File

@ -73,8 +73,9 @@ private:
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0 { };
dsp::decimate::FIRC16xR16x32Decim8 decim_1 { };
dsp::decimate::FIRAndDecimateComplex channel_filter { };
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
int32_t channel_filter_low_f = 0;
int32_t channel_filter_high_f = 0;
int32_t channel_filter_transition = 0;
// For CTCSS decoding
dsp::decimate::FIR64AndDecimateBy2Real ctcss_filter { };

View File

@ -29,8 +29,9 @@
#include "utility.hpp"
ReplayProcessor::ReplayProcessor() {
channel_filter_pass_f = taps_200k_decim_1.pass_frequency_normalized * 1000000; // 162760.416666667
channel_filter_stop_f = taps_200k_decim_1.stop_frequency_normalized * 1000000; // 337239.583333333
channel_filter_low_f = taps_200k_decim_1.low_frequency_normalized * 1000000;
channel_filter_high_f = taps_200k_decim_1.high_frequency_normalized * 1000000;
channel_filter_transition = taps_200k_decim_1.transition_normalized * 1000000;
spectrum_samples = 0;
@ -70,7 +71,7 @@ void ReplayProcessor::execute(const buffer_c8_t& buffer) {
spectrum_samples += buffer.count;
if( spectrum_samples >= spectrum_interval_samples ) {
spectrum_samples -= spectrum_interval_samples;
channel_spectrum.feed(iq_buffer, channel_filter_pass_f, channel_filter_stop_f);
channel_spectrum.feed(iq_buffer, channel_filter_low_f, channel_filter_high_f, channel_filter_transition);
txprogress_message.progress = bytes_read; // Inform UI about progress
txprogress_message.done = false;

View File

@ -54,8 +54,9 @@ private:
baseband_fs / 8
};
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
int32_t channel_filter_low_f = 0;
int32_t channel_filter_high_f = 0;
int32_t channel_filter_transition = 0;
std::unique_ptr<StreamOutput> stream { };

View File

@ -43,7 +43,7 @@ void WidebandFMAudio::execute(const buffer_c8_t& buffer) {
spectrum_samples += channel.count;
if( spectrum_samples >= spectrum_interval_samples ) {
spectrum_samples -= spectrum_interval_samples;
channel_spectrum.feed(channel, channel_filter_pass_f, channel_filter_stop_f);
channel_spectrum.feed(channel, channel_filter_low_f, channel_filter_high_f, channel_filter_transition);
}
/* 384kHz complex<int16_t>[256]
@ -169,8 +169,9 @@ void WidebandFMAudio::configure(const WFMConfigureMessage& message) {
decim_0.configure(message.decim_0_filter.taps, 33554432);
decim_1.configure(message.decim_1_filter.taps, 131072);
channel_filter_pass_f = message.decim_1_filter.pass_frequency_normalized * decim_1_input_fs;
channel_filter_stop_f = message.decim_1_filter.stop_frequency_normalized * decim_1_input_fs;
channel_filter_low_f = message.decim_1_filter.low_frequency_normalized * decim_1_input_fs;
channel_filter_high_f = message.decim_1_filter.high_frequency_normalized * decim_1_input_fs;
channel_filter_transition = message.decim_1_filter.transition_normalized * decim_1_input_fs;
demod.configure(demod_input_fs, message.deviation);
audio_filter.configure(message.audio_filter.taps);
audio_output.configure(message.audio_hpf_config, message.audio_deemph_config);

View File

@ -67,8 +67,9 @@ private:
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { };
dsp::decimate::FIRC16xR16x16Decim2 decim_1 { };
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
int32_t channel_filter_low_f = 0;
int32_t channel_filter_high_f = 0;
int32_t channel_filter_transition = 0;
dsp::demodulate::FM demod { };
dsp::decimate::DecimateBy2CIC4Real audio_dec_1 { };

View File

@ -53,7 +53,7 @@ void WidebandSpectrum::execute(const buffer_c8_t& buffer) {
};
channel_spectrum.feed(
buffer_c16,
0, 0
0, 0, 0
);
phase = 0;
} else {

View File

@ -78,12 +78,14 @@ void SpectrumCollector::set_decimation_factor(
void SpectrumCollector::feed(
const buffer_c16_t& channel,
const uint32_t filter_pass_frequency,
const uint32_t filter_stop_frequency
const int32_t filter_low_frequency,
const int32_t filter_high_frequency,
const int32_t filter_transition
) {
// Called from baseband processing thread.
channel_filter_pass_frequency = filter_pass_frequency;
channel_filter_stop_frequency = filter_stop_frequency;
channel_filter_low_frequency = filter_low_frequency;
channel_filter_high_frequency = filter_high_frequency;
channel_filter_transition = filter_transition;
channel_spectrum_decimator.feed(
channel,
@ -136,8 +138,9 @@ void SpectrumCollector::update() {
ChannelSpectrum spectrum;
spectrum.sampling_rate = channel_spectrum_sampling_rate;
spectrum.channel_filter_pass_frequency = channel_filter_pass_frequency;
spectrum.channel_filter_stop_frequency = channel_filter_stop_frequency;
spectrum.channel_filter_low_frequency = channel_filter_low_frequency;
spectrum.channel_filter_high_frequency = channel_filter_high_frequency;
spectrum.channel_filter_transition = channel_filter_transition;
for(size_t i=0; i<spectrum.db.size(); i++) {
const auto corrected_sample = spectrum_window_hamming_3(channel_spectrum, i);
const auto mag2 = magnitude_squared(corrected_sample * (1.0f / 32768.0f));

View File

@ -40,8 +40,9 @@ public:
void feed(
const buffer_c16_t& channel,
const uint32_t filter_pass_frequency,
const uint32_t filter_stop_frequency
const int32_t filter_low_frequency,
const int32_t filter_high_frequency,
const int32_t filter_transition
);
private:
@ -53,8 +54,9 @@ private:
bool streaming { false };
std::array<std::complex<float>, 256> channel_spectrum { };
uint32_t channel_spectrum_sampling_rate { 0 };
uint32_t channel_filter_pass_frequency { 0 };
uint32_t channel_filter_stop_frequency { 0 };
int32_t channel_filter_low_frequency { 0 };
int32_t channel_filter_high_frequency { 0 };
int32_t channel_filter_transition { 0 };
void post_message(const buffer_c16_t& data);

View File

@ -32,6 +32,9 @@ template<size_t N>
struct fir_taps_real {
float pass_frequency_normalized;
float stop_frequency_normalized;
float low_frequency_normalized;
float high_frequency_normalized;
float transition_normalized;
std::array<int16_t, N> taps;
};
@ -39,6 +42,9 @@ template<size_t N>
struct fir_taps_complex {
float pass_frequency_normalized;
float stop_frequency_normalized;
float low_frequency_normalized;
float high_frequency_normalized;
float transition_normalized;
std::array<complex16_t, N> taps;
};
@ -48,6 +54,9 @@ struct fir_taps_complex {
constexpr fir_taps_real<24> taps_16k0_decim_0 {
.pass_frequency_normalized = 8000.0f / 3072000.0f,
.stop_frequency_normalized = 344000.0f / 3072000.0f,
.low_frequency_normalized = -8000.0f / 3072000.0f,
.high_frequency_normalized = 8000.0f / 3072000.0f,
.transition_normalized = 336000.0f / 3072000.0f,
.taps = { {
1, 67, 165, 340, 599, 944, 1361, 1820,
2278, 2684, 2988, 3152, 3152, 2988, 2684, 2278,
@ -59,6 +68,9 @@ constexpr fir_taps_real<24> taps_16k0_decim_0 {
constexpr fir_taps_real<32> taps_16k0_decim_1 {
.pass_frequency_normalized = 8000.0f / 384000.0f,
.stop_frequency_normalized = 40000.0f / 384000.0f,
.low_frequency_normalized = -8000.0f / 384000.0f,
.high_frequency_normalized = 8000.0f / 384000.0f,
.transition_normalized = 32000.0f / 384000.0f,
.taps = { {
-26, -125, -180, -275, -342, -359, -286, -90,
250, 733, 1337, 2011, 2688, 3289, 3740, 3982,
@ -71,6 +83,9 @@ constexpr fir_taps_real<32> taps_16k0_decim_1 {
constexpr fir_taps_real<32> taps_16k0_channel {
.pass_frequency_normalized = 8000.0f / 48000.0f,
.stop_frequency_normalized = 12400.0f / 48000.0f,
.low_frequency_normalized = -8000.0f / 48000.0f,
.high_frequency_normalized = 8000.0f / 48000.0f,
.transition_normalized = 4400.0f / 48000.0f,
.taps = { {
-73, -285, -376, -8, 609, 538, -584, -1387,
-148, 2173, 1959, -2146, -5267, -297, 12915, 24737,
@ -85,6 +100,9 @@ constexpr fir_taps_real<32> taps_16k0_channel {
constexpr fir_taps_real<24> taps_11k0_decim_0 {
.pass_frequency_normalized = 5500.0f / 3072000.0f,
.stop_frequency_normalized = 341500.0f / 3072000.0f,
.low_frequency_normalized = -5500.0f / 3072000.0f,
.high_frequency_normalized = 5500.0f / 3072000.0f,
.transition_normalized = 336000.0f / 3072000.0f,
.taps = { {
38, 102, 220, 406, 668, 1004, 1397, 1822,
2238, 2603, 2875, 3020, 3020, 2875, 2603, 2238,
@ -96,6 +114,9 @@ constexpr fir_taps_real<24> taps_11k0_decim_0 {
constexpr fir_taps_real<32> taps_11k0_decim_1 {
.pass_frequency_normalized = 5500.0f / 384000.0f,
.stop_frequency_normalized = 42500.0f / 384000.0f,
.low_frequency_normalized = -5500.0f / 384000.0f,
.high_frequency_normalized = 5500.0f / 384000.0f,
.transition_normalized = 37000.0f / 384000.0f,
.taps = { {
-42, -87, -157, -234, -298, -318, -255, -75,
246, 713, 1306, 1976, 2656, 3265, 3724, 3971,
@ -108,6 +129,9 @@ constexpr fir_taps_real<32> taps_11k0_decim_1 {
constexpr fir_taps_real<32> taps_11k0_channel {
.pass_frequency_normalized = 5500.0f / 48000.0f,
.stop_frequency_normalized = 8900.0f / 48000.0f,
.low_frequency_normalized = -5500.0f / 48000.0f,
.high_frequency_normalized = 5500.0f / 48000.0f,
.transition_normalized = 3400.0f / 48000.0f,
.taps = { {
-68, -345, -675, -867, -582, 247, 1222, 1562,
634, -1379, -3219, -3068, 310, 6510, 13331, 17795,
@ -122,6 +146,9 @@ constexpr fir_taps_real<32> taps_11k0_channel {
constexpr fir_taps_real<24> taps_4k25_decim_0 {
.pass_frequency_normalized = 4250.0f / 3072000.0f,
.stop_frequency_normalized = 340250.0f / 3072000.0f,
.low_frequency_normalized = -4250.0f / 3072000.0f,
.high_frequency_normalized = 4250.0f / 3072000.0f,
.transition_normalized = 33600.0f / 3072000.0f,
.taps = { {
38, 103, 222, 409, 671, 1006, 1399, 1821,
2236, 2599, 2868, 3012, 3012, 2868, 2599, 2236,
@ -133,6 +160,9 @@ constexpr fir_taps_real<24> taps_4k25_decim_0 {
constexpr fir_taps_real<32> taps_4k25_decim_1 {
.pass_frequency_normalized = 4250.0f / 384000.0f,
.stop_frequency_normalized = 43750.0f / 384000.0f,
.low_frequency_normalized = -4250.0f / 384000.0f,
.high_frequency_normalized = 4250.0f / 384000.0f,
.transition_normalized = 39500.0f / 384000.0f,
.taps = { {
-33, -74, -139, -214, -280, -306, -254, -87,
222, 682, 1274, 1951, 2644, 3268, 3741, 3996,
@ -145,6 +175,9 @@ constexpr fir_taps_real<32> taps_4k25_decim_1 {
constexpr fir_taps_real<32> taps_4k25_channel {
.pass_frequency_normalized = 4250.0f / 48000.0f,
.stop_frequency_normalized = 7900.0f / 48000.0f,
.low_frequency_normalized = -4250.0f / 48000.0f,
.high_frequency_normalized = 4250.0f / 48000.0f,
.transition_normalized = 3650.0f / 48000.0f,
.taps = { {
-58, -14, 153, 484, 871, 1063, 770, -141,
-1440, -2488, -2435, -614, 3035, 7771, 12226, 14927,
@ -185,6 +218,9 @@ constexpr fir_taps_real<32> taps_4k25_channel {
constexpr fir_taps_real<64> taps_64_lp_025_025 {
.pass_frequency_normalized = 0.0125f,
.stop_frequency_normalized = 0.0125f,
.low_frequency_normalized = 0,
.high_frequency_normalized = 0,
.transition_normalized = 0,
.taps = { {
0, 0, 2, 6, 12, 20, 32, 46,
64, 85, 110, 138, 169, 204, 241, 281,
@ -203,6 +239,9 @@ constexpr fir_taps_real<64> taps_64_lp_025_025 {
constexpr fir_taps_real<24> taps_6k0_decim_0 {
.pass_frequency_normalized = 3000.0f / 3072000.0f,
.stop_frequency_normalized = 339000.0f / 3072000.0f,
.low_frequency_normalized = -3000.0f / 3072000.0f,
.high_frequency_normalized = 3000.0f / 3072000.0f,
.transition_normalized = 336000.0f / 3072000.0f,
.taps = { {
39, 104, 224, 412, 674, 1008, 1400, 1821,
2234, 2594, 2863, 3006, 3006, 2863, 2594, 2234,
@ -214,6 +253,9 @@ constexpr fir_taps_real<24> taps_6k0_decim_0 {
constexpr fir_taps_real<32> taps_6k0_decim_1 {
.pass_frequency_normalized = 3000.0f / 384000.0f,
.stop_frequency_normalized = 45000.0f / 384000.0f,
.low_frequency_normalized = -3000.0f / 384000.0f,
.high_frequency_normalized = 3000.0f / 384000.0f,
.transition_normalized = 43000.0f / 384000.0f,
.taps = { {
-26, -63, -123, -195, -263, -295, -253, -99,
199, 651, 1242, 1927, 2633, 3273, 3760, 4023,
@ -226,6 +268,9 @@ constexpr fir_taps_real<32> taps_6k0_decim_1 {
constexpr fir_taps_real<32> taps_6k0_decim_2 {
.pass_frequency_normalized = 3000.0f / 48000.0f,
.stop_frequency_normalized = 6700.0f / 48000.0f,
.low_frequency_normalized = -3000.0f / 48000.0f,
.high_frequency_normalized = 3000.0f / 48000.0f,
.transition_normalized = 3700.0f / 48000.0f,
.taps = { {
95, 178, 247, 208, -21, -474, -1080, -1640,
-1857, -1411, -83, 2134, 4978, 7946, 10413, 11815,
@ -241,6 +286,9 @@ constexpr fir_taps_real<32> taps_6k0_decim_2 {
constexpr fir_taps_complex<64> taps_6k0_dsb_channel {
.pass_frequency_normalized = 3000.0f / 12000.0f,
.stop_frequency_normalized = 3300.0f / 12000.0f,
.low_frequency_normalized = -3000.0f / 12000.0f,
.high_frequency_normalized = 3000.0f / 12000.0f,
.transition_normalized = 300.0f / 12000.0f,
.taps = { {
{ -69, 0 }, { -140, 0 }, { 119, 0 }, { 89, 0 },
{ -132, 0 }, { -134, 0 }, { 197, 0 }, { 167, 0 },
@ -267,6 +315,9 @@ constexpr fir_taps_complex<64> taps_6k0_dsb_channel {
constexpr fir_taps_complex<64> taps_2k8_usb_channel {
.pass_frequency_normalized = 3000.0f / 12000.0f,
.stop_frequency_normalized = 3300.0f / 12000.0f,
.low_frequency_normalized = 0,
.high_frequency_normalized = 3000.0f / 12000.0f,
.transition_normalized = 300.0f / 12000.0f,
.taps = { {
{ -146, 0 }, { -41, -45 }, { -1, 10 }, { -95, 69 },
{ -194, -41 }, { -91, -158 }, { 14, -43 }, { -150, 67 },
@ -293,6 +344,9 @@ constexpr fir_taps_complex<64> taps_2k8_usb_channel {
constexpr fir_taps_complex<64> taps_2k8_lsb_channel {
.pass_frequency_normalized = 3000.0f / 12000.0f,
.stop_frequency_normalized = 3300.0f / 12000.0f,
.low_frequency_normalized = -3000.0f / 12000.0f,
.high_frequency_normalized = 0,
.transition_normalized = 300.0f / 12000.0f,
.taps = { {
{ -146, 0 }, { -41, 45 }, { -1, -10 }, { -95, -69 },
{ -194, 41 }, { -91, 158 }, { 14, 43 }, { -150, -67 },
@ -318,6 +372,9 @@ constexpr fir_taps_complex<64> taps_2k8_lsb_channel {
constexpr fir_taps_complex<64> taps_0k7_usb_channel {
.pass_frequency_normalized = 3000.0f / 12000.0f,
.stop_frequency_normalized = 3300.0f / 12000.0f,
.low_frequency_normalized = 600.0f / 12000.0f,
.high_frequency_normalized = 800.0f / 12000.0f,
.transition_normalized = 200.0f / 12000.0f,
.taps = { {
{ 531, 0 }, { 192, 73 }, { 181, 163 }, { 129, 254 },
{ 34, 328 }, { -97, 364 }, { -251, 345 }, { -403, 261 },
@ -344,6 +401,9 @@ constexpr fir_taps_complex<64> taps_0k7_usb_channel {
constexpr fir_taps_real<24> taps_200k_wfm_decim_0 = {
.pass_frequency_normalized = 100000.0f / 3072000.0f,
.stop_frequency_normalized = 484000.0f / 3072000.0f,
.low_frequency_normalized = -100000.0f / 3072000.0f,
.high_frequency_normalized = 100000.0f / 3072000.0f,
.transition_normalized = 384000.0f / 3072000.0f,
.taps = { {
48, -18, -151, -364, -557, -548, -139, 789,
2187, 3800, 5230, 6071, 6071, 5230, 3800, 2187,
@ -355,6 +415,9 @@ constexpr fir_taps_real<24> taps_200k_wfm_decim_0 = {
constexpr fir_taps_real<16> taps_200k_wfm_decim_1 = {
.pass_frequency_normalized = 100000.0f / 768000.0f,
.stop_frequency_normalized = 284000.0f / 768000.0f,
.low_frequency_normalized = -100000.0f / 768000.0f,
.high_frequency_normalized = 100000.0f / 768000.0f,
.transition_normalized = 184000.0f / 768000.0f,
.taps = { {
-67, -123, 388, 622, -1342, -2185, 4599, 14486,
14486, 4599, -2185, -1342, 622, 388, -123, -67,
@ -371,6 +434,9 @@ constexpr fir_taps_real<16> taps_200k_wfm_decim_1 = {
constexpr fir_taps_real<64> taps_64_lp_156_198 {
.pass_frequency_normalized = 0.156f,
.stop_frequency_normalized = 0.196f,
.low_frequency_normalized = -0.156f,
.high_frequency_normalized = 0.156f,
.transition_normalized = 0.04f,
.taps = { {
-27, 166, 104, -36, -174, -129, 109, 287,
148, -232, -430, -130, 427, 597, 49, -716,
@ -389,6 +455,9 @@ constexpr fir_taps_real<64> taps_64_lp_156_198 {
static constexpr fir_taps_real<24> taps_200k_decim_0 = {
.pass_frequency_normalized = 100000.0f / 2457600.0f,
.stop_frequency_normalized = 407200.0f / 2457600.0f,
.low_frequency_normalized = -100000.0f / 2457600.0f,
.high_frequency_normalized = 100000.0f / 2457600.0f,
.transition_normalized = 307200.0f / 2457600.0f,
.taps = { {
90, 94, 4, -240, -570, -776, -563, 309,
1861, 3808, 5618, 6710, 6710, 5618, 3808, 1861,
@ -400,6 +469,9 @@ static constexpr fir_taps_real<24> taps_200k_decim_0 = {
static constexpr fir_taps_real<16> taps_200k_decim_1 = {
.pass_frequency_normalized = 100000.0f / 614400.0f,
.stop_frequency_normalized = 207200.0f / 614400.0f,
.low_frequency_normalized = -100000.0f / 614400.0f,
.high_frequency_normalized = 100000.0f / 614400.0f,
.transition_normalized = 107200.0f / 614400.0f,
.taps = { {
-132, -256, 545, 834, -1507, -2401, 4666, 14583,
14583, 4666, -2401, -1507, 834, 545, -256, -132,

View File

@ -298,8 +298,9 @@ public:
struct ChannelSpectrum {
std::array<uint8_t, 256> db { { 0 } };
uint32_t sampling_rate { 0 };
uint32_t channel_filter_pass_frequency { 0 };
uint32_t channel_filter_stop_frequency { 0 };
int32_t channel_filter_low_frequency { 0 };
int32_t channel_filter_high_frequency { 0 };
int32_t channel_filter_transition { 0 };
};
using ChannelSpectrumFIFO = FIFO<ChannelSpectrum>;