mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-31 18:49:15 -04:00
POCSAG Processor Rewrite (#1437)
* WIP Refactoring * WordExtractor building * Fix buffer sizes and squelch execute * Move impls to cpp file * Baud indicator * WIP new bit extractor * New approach for bit extraction. * Code fit and finish * Fix case on button * Cleanup * Adjust rate miss threshold * Fix count bits error calculation.
This commit is contained in:
parent
9525738118
commit
31e8019642
13 changed files with 648 additions and 534 deletions
|
@ -29,20 +29,19 @@ bool FMSquelch::execute(const buffer_f32_t& audio) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// TODO: No hard-coded array size.
|
||||
std::array<float, N> squelch_energy_buffer;
|
||||
const buffer_f32_t squelch_energy{
|
||||
squelch_energy_buffer.data(),
|
||||
squelch_energy_buffer.size()};
|
||||
// TODO: alloca temp buffer, assert audio.count
|
||||
std::array<float, 32> squelch_energy_buffer;
|
||||
const buffer_f32_t squelch_energy{squelch_energy_buffer.data(), audio.count};
|
||||
non_audio_hpf.execute(audio, squelch_energy);
|
||||
|
||||
// "Non-audio" implies "noise" here. Find the loudest noise sample.
|
||||
float non_audio_max_squared = 0;
|
||||
for (const auto sample : squelch_energy_buffer) {
|
||||
const float sample_squared = sample * sample;
|
||||
if (sample_squared > non_audio_max_squared) {
|
||||
for (size_t i = 0; i < squelch_energy.count; ++i) {
|
||||
auto sample = squelch_energy.p[i];
|
||||
float sample_squared = sample * sample;
|
||||
|
||||
if (sample_squared > non_audio_max_squared)
|
||||
non_audio_max_squared = sample_squared;
|
||||
}
|
||||
}
|
||||
|
||||
// Is the noise less than the threshold?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue