mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-30 10:09:25 -04:00
Move baseband FIR filter defs to common file.
They will likely be shared with multiple decimators/demodulators. Also added normalized filter pass/stop values to each set of taps.
This commit is contained in:
parent
3db0820b54
commit
7de80edcd3
3 changed files with 132 additions and 230 deletions
|
@ -21,31 +21,6 @@
|
|||
|
||||
#include "proc_am_audio.hpp"
|
||||
|
||||
// DSB AM 6K00A3E emission type ///////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=3000, stop=339000, decim=8, fout=384000
|
||||
static constexpr std::array<int16_t, 24> taps_6k0_decim_0 { {
|
||||
39, 104, 224, 412, 674, 1008, 1400, 1821,
|
||||
2234, 2594, 2863, 3006, 3006, 2863, 2594, 2234,
|
||||
1821, 1400, 1008, 674, 412, 224, 104, 39,
|
||||
} };
|
||||
|
||||
// IFIR prototype filter: fs=384000, pass=3000, stop=45000, decim=8, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_6k0_decim_1 { {
|
||||
-26, -63, -123, -195, -263, -295, -253, -99,
|
||||
199, 651, 1242, 1927, 2633, 3273, 3760, 4023,
|
||||
4023, 3760, 3273, 2633, 1927, 1242, 651, 199,
|
||||
-99, -253, -295, -263, -195, -123, -63, -26,
|
||||
} };
|
||||
|
||||
// Channel filter: fs=48000, pass=3000, stop=6700, decim=1, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_6k0_channel { {
|
||||
95, 178, 247, 208, -21, -474, -1080, -1640,
|
||||
-1857, -1411, -83, 2134, 4978, 7946, 10413, 11815,
|
||||
11815, 10413, 7946, 4978, 2134, -83, -1411, -1857,
|
||||
-1640, -1080, -474, -21, 208, 247, 178, 95,
|
||||
} };
|
||||
|
||||
NarrowbandAMAudio::NarrowbandAMAudio() {
|
||||
constexpr size_t baseband_fs = 3072000;
|
||||
|
||||
|
@ -61,11 +36,11 @@ NarrowbandAMAudio::NarrowbandAMAudio() {
|
|||
constexpr size_t channel_filter_decimation_factor = 1;
|
||||
constexpr size_t channel_filter_output_fs = channel_filter_input_fs / channel_filter_decimation_factor;
|
||||
|
||||
decim_0.configure(taps_6k0_decim_0, 33554432);
|
||||
decim_1.configure(taps_6k0_decim_1, 131072);
|
||||
channel_filter.configure(taps_6k0_channel, 1);
|
||||
channel_filter_pass_f = 3000;
|
||||
channel_filter_stop_f = 6700;
|
||||
decim_0.configure(taps_6k0_decim_0.taps, 33554432);
|
||||
decim_1.configure(taps_6k0_decim_1.taps, 131072);
|
||||
channel_filter.configure(taps_6k0_channel.taps, 1);
|
||||
channel_filter_pass_f = taps_6k0_channel.pass_frequency_normalized * channel_filter_input_fs;
|
||||
channel_filter_stop_f = taps_6k0_channel.stop_frequency_normalized * channel_filter_input_fs;
|
||||
|
||||
channel_spectrum.set_decimation_factor(std::floor((channel_filter_output_fs / 2) / ((channel_filter_pass_f + channel_filter_stop_f) / 2)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue