mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-01 12:29:04 +00:00
Add AM spectrum ZOOM x3/x4 with optimized x4 decimation (#3304)
* Add AM spectrum zoom x3 and x4 * Optimize AM spectrum zoom x4 processing * Fix AM spectrum zoom formatting * Fix AM spectrum zoom header formatting
This commit is contained in:
@@ -337,6 +337,59 @@ buffer_c16_t FIRC16xR16x16Decim2::execute(
|
||||
src.sampling_rate / decimation_factor};
|
||||
}
|
||||
|
||||
// FIRC16xR16x32Decim4 ////////////////////////////////////////////////////
|
||||
|
||||
void FIRC16xR16x32Decim4::configure(
|
||||
const std::array<tap_t, taps_count>& taps,
|
||||
const int32_t scale) {
|
||||
std::copy(taps.cbegin(), taps.cend(), taps_.begin());
|
||||
output_scale = scale;
|
||||
z_.fill({});
|
||||
}
|
||||
|
||||
buffer_c16_t FIRC16xR16x32Decim4::execute(
|
||||
const buffer_c16_t& src,
|
||||
const buffer_c16_t& dst) {
|
||||
vec2_s16* const z = static_cast<vec2_s16*>(__builtin_assume_aligned(z_.data(), 4));
|
||||
const vec2_s16* const t = static_cast<vec2_s16*>(__builtin_assume_aligned(taps_.data(), 4));
|
||||
uint32_t* const d = static_cast<uint32_t*>(__builtin_assume_aligned(dst.p, 4));
|
||||
|
||||
const auto k = output_scale;
|
||||
const size_t count = src.count / decimation_factor;
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
const vec2_s16* const in = static_cast<const vec2_s16*>(__builtin_assume_aligned(&src.p[i * decimation_factor], 4));
|
||||
|
||||
complex32_t accum;
|
||||
|
||||
accum = mac_shift(z, t, 0, accum);
|
||||
accum = mac_shift(z, t, 1, accum);
|
||||
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 0, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 1, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 2, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 3, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 4, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 5, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 6, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 7, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 8, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 9, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 10, accum);
|
||||
accum = mac_shift_and_store(z, t, decimation_factor, 11, accum);
|
||||
|
||||
accum = mac_shift_and_store_new_c16_samples(z, t, in, decimation_factor, 0, taps_count, accum);
|
||||
accum = mac_shift_and_store_new_c16_samples(z, t, in, decimation_factor, 1, taps_count, accum);
|
||||
|
||||
d[i] = scale_round_and_pack(accum, k);
|
||||
}
|
||||
|
||||
return {
|
||||
dst.p,
|
||||
count,
|
||||
src.sampling_rate / decimation_factor};
|
||||
}
|
||||
|
||||
// FIRC16xR16x63HalfbandDecim2 ////////////////////////////////////////////
|
||||
|
||||
void FIRC16xR16x63HalfbandDecim2::configure(
|
||||
|
||||
Reference in New Issue
Block a user