mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 14:59:24 -05:00
Add ChannelDecimator decimate by 2 and no-shift options.
This commit is contained in:
parent
ccd64f3cd9
commit
060da5d227
@ -39,14 +39,10 @@ buffer_c16_t ChannelDecimator::execute_decimation(buffer_c8_t buffer) {
|
||||
* -> gain of 256
|
||||
* -> decimation by 2
|
||||
* -> 1.544MHz complex<int16_t>[1024], [-32768, 32512] */
|
||||
const auto stage_0_out = translate.execute(buffer, work_baseband_buffer);
|
||||
|
||||
//if( fs_over_4_downconvert ) {
|
||||
// // TODO:
|
||||
//} else {
|
||||
// Won't work until cic_0 will accept input type of buffer_c8_t.
|
||||
// stage_0_out = cic_0.execute(buffer, work_baseband_buffer);
|
||||
//}
|
||||
auto stage_0_out = execute_stage_0(buffer, work_baseband_buffer);
|
||||
if( decimation_factor == DecimationFactor::By2 ) {
|
||||
return stage_0_out;
|
||||
}
|
||||
|
||||
/* 1.536MHz complex<int16_t>[1024], [-32768, 32512]
|
||||
* -> 3rd order CIC: -0.1dB @ 0.028fs, -1dB @ 0.088fs, -60dB @ 0.468fs
|
||||
@ -82,3 +78,14 @@ buffer_c16_t ChannelDecimator::execute_decimation(buffer_c8_t buffer) {
|
||||
|
||||
return cic_4_out;
|
||||
}
|
||||
|
||||
buffer_c16_t ChannelDecimator::execute_stage_0(
|
||||
buffer_c8_t buffer,
|
||||
buffer_c16_t work_baseband_buffer
|
||||
) {
|
||||
if( fs_over_4_downconvert ) {
|
||||
return translate.execute(buffer, work_baseband_buffer);
|
||||
} else {
|
||||
return cic_0.execute(buffer, work_baseband_buffer);
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
class ChannelDecimator {
|
||||
public:
|
||||
enum class DecimationFactor {
|
||||
By2,
|
||||
By4,
|
||||
By8,
|
||||
By16,
|
||||
@ -39,13 +40,16 @@ public:
|
||||
};
|
||||
|
||||
constexpr ChannelDecimator(
|
||||
) : decimation_factor { DecimationFactor::By32 }
|
||||
) : decimation_factor { DecimationFactor::By32 },
|
||||
fs_over_4_downconvert { true }
|
||||
{
|
||||
}
|
||||
|
||||
constexpr ChannelDecimator(
|
||||
const DecimationFactor decimation_factor
|
||||
) : decimation_factor { decimation_factor }
|
||||
const DecimationFactor decimation_factor,
|
||||
const bool fs_over_4_downconvert = true
|
||||
) : decimation_factor { decimation_factor },
|
||||
fs_over_4_downconvert { fs_over_4_downconvert }
|
||||
{
|
||||
}
|
||||
|
||||
@ -62,18 +66,22 @@ public:
|
||||
private:
|
||||
std::array<complex16_t, 1024> work_baseband;
|
||||
|
||||
//const bool fs_over_4_downconvert = true;
|
||||
|
||||
dsp::decimate::TranslateByFSOver4AndDecimateBy2CIC3 translate;
|
||||
//dsp::decimate::DecimateBy2CIC3 cic_0;
|
||||
dsp::decimate::Complex8DecimateBy2CIC3 cic_0;
|
||||
dsp::decimate::DecimateBy2CIC3 cic_1;
|
||||
dsp::decimate::DecimateBy2CIC3 cic_2;
|
||||
dsp::decimate::DecimateBy2CIC3 cic_3;
|
||||
dsp::decimate::DecimateBy2CIC3 cic_4;
|
||||
|
||||
DecimationFactor decimation_factor;
|
||||
const bool fs_over_4_downconvert;
|
||||
|
||||
buffer_c16_t execute_decimation(buffer_c8_t buffer);
|
||||
|
||||
buffer_c16_t execute_stage_0(
|
||||
buffer_c8_t buffer,
|
||||
buffer_c16_t work_baseband_buffer
|
||||
);
|
||||
};
|
||||
|
||||
#endif/*__CHANNEL_DECIMATOR_H__*/
|
||||
|
Loading…
Reference in New Issue
Block a user