mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-25 15:29:37 -05:00
Add AM processor decim_2.
This commit is contained in:
parent
279e5c775d
commit
1915ff980f
@ -102,6 +102,7 @@ void AnalogAudioModel::configure_am() {
|
|||||||
const AMConfigureMessage message {
|
const AMConfigureMessage message {
|
||||||
taps_6k0_decim_0,
|
taps_6k0_decim_0,
|
||||||
taps_6k0_decim_1,
|
taps_6k0_decim_1,
|
||||||
|
taps_6k0_decim_2,
|
||||||
taps_6k0_channel,
|
taps_6k0_channel,
|
||||||
audio_12k_hpf_300hz_config
|
audio_12k_hpf_300hz_config
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,8 @@ void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) {
|
|||||||
|
|
||||||
const auto decim_0_out = decim_0.execute(buffer, dst_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);
|
const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer);
|
||||||
const auto channel_out = channel_filter.execute(decim_1_out, dst_buffer);
|
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);
|
||||||
|
|
||||||
// TODO: Feed channel_stats post-decimation data?
|
// TODO: Feed channel_stats post-decimation data?
|
||||||
feed_channel_stats(channel_out);
|
feed_channel_stats(channel_out);
|
||||||
@ -65,11 +66,15 @@ void NarrowbandAMAudio::configure(const AMConfigureMessage& message) {
|
|||||||
constexpr size_t decim_1_input_fs = decim_0_output_fs;
|
constexpr size_t decim_1_input_fs = decim_0_output_fs;
|
||||||
constexpr size_t decim_1_output_fs = decim_1_input_fs / decim_1.decimation_factor;
|
constexpr size_t decim_1_output_fs = decim_1_input_fs / decim_1.decimation_factor;
|
||||||
|
|
||||||
constexpr size_t channel_filter_input_fs = decim_1_output_fs;
|
constexpr size_t decim_2_input_fs = decim_1_output_fs;
|
||||||
|
constexpr size_t decim_2_output_fs = decim_2_input_fs / decim_2_decimation_factor;
|
||||||
|
|
||||||
|
constexpr size_t channel_filter_input_fs = decim_2_output_fs;
|
||||||
const size_t channel_filter_output_fs = channel_filter_input_fs / channel_filter_decimation_factor;
|
const size_t channel_filter_output_fs = channel_filter_input_fs / channel_filter_decimation_factor;
|
||||||
|
|
||||||
decim_0.configure(message.decim_0_filter.taps, 33554432);
|
decim_0.configure(message.decim_0_filter.taps, 33554432);
|
||||||
decim_1.configure(message.decim_1_filter.taps, 131072);
|
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.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_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_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs;
|
||||||
|
@ -56,6 +56,7 @@ private:
|
|||||||
|
|
||||||
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
||||||
dsp::decimate::FIRC16xR16x32Decim8 decim_1;
|
dsp::decimate::FIRC16xR16x32Decim8 decim_1;
|
||||||
|
dsp::decimate::FIRAndDecimateComplex decim_2;
|
||||||
dsp::decimate::FIRAndDecimateComplex channel_filter;
|
dsp::decimate::FIRAndDecimateComplex channel_filter;
|
||||||
uint32_t channel_filter_pass_f = 0;
|
uint32_t channel_filter_pass_f = 0;
|
||||||
uint32_t channel_filter_stop_f = 0;
|
uint32_t channel_filter_stop_f = 0;
|
||||||
|
@ -178,7 +178,7 @@ constexpr fir_taps_real<32> taps_6k0_decim_1 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Channel filter: fs=48000, pass=3000, stop=6700, decim=1, fout=48000
|
// Channel filter: fs=48000, pass=3000, stop=6700, decim=1, fout=48000
|
||||||
constexpr fir_taps_real<32> taps_6k0_channel {
|
constexpr fir_taps_real<32> taps_6k0_decim_2 {
|
||||||
.pass_frequency_normalized = 3000.0f / 48000.0f,
|
.pass_frequency_normalized = 3000.0f / 48000.0f,
|
||||||
.stop_frequency_normalized = 6700.0f / 48000.0f,
|
.stop_frequency_normalized = 6700.0f / 48000.0f,
|
||||||
.taps = { {
|
.taps = { {
|
||||||
|
@ -376,11 +376,13 @@ public:
|
|||||||
constexpr AMConfigureMessage(
|
constexpr AMConfigureMessage(
|
||||||
const fir_taps_real<24> decim_0_filter,
|
const fir_taps_real<24> decim_0_filter,
|
||||||
const fir_taps_real<32> decim_1_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_real<32> channel_filter,
|
||||||
const iir_biquad_config_t audio_hpf_config
|
const iir_biquad_config_t audio_hpf_config
|
||||||
) : Message { ID::AMConfigure },
|
) : Message { ID::AMConfigure },
|
||||||
decim_0_filter(decim_0_filter),
|
decim_0_filter(decim_0_filter),
|
||||||
decim_1_filter(decim_1_filter),
|
decim_1_filter(decim_1_filter),
|
||||||
|
decim_2_filter(decim_2_filter),
|
||||||
channel_filter(channel_filter),
|
channel_filter(channel_filter),
|
||||||
audio_hpf_config { audio_hpf_config }
|
audio_hpf_config { audio_hpf_config }
|
||||||
{
|
{
|
||||||
@ -388,6 +390,7 @@ public:
|
|||||||
|
|
||||||
const fir_taps_real<24> decim_0_filter;
|
const fir_taps_real<24> decim_0_filter;
|
||||||
const fir_taps_real<32> decim_1_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_real<32> channel_filter;
|
||||||
const iir_biquad_config_t audio_hpf_config;
|
const iir_biquad_config_t audio_hpf_config;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user