(almost) One loop to rule all the samples

Avoid looping over and over the samples. One
This commit is contained in:
Geoffrey Merck 2020-04-21 20:38:02 +02:00
parent 87c3b57ae4
commit 8d340cbfba
9 changed files with 78 additions and 43 deletions

View file

@ -109,9 +109,6 @@ uint8_t CFMCTCSSRX::setParams(uint8_t frequency, uint8_t threshold)
bool CFMCTCSSRX::process(q15_t* samples, uint8_t length)
{
//float32_t data[RX_BLOCK_SIZE];
//::arm_q15_to_float(samples, data, length);
for (unsigned int i = 0U; i < length; i++) {
float32_t q2 = m_q1;
m_q1 = m_q0;
@ -121,7 +118,7 @@ bool CFMCTCSSRX::process(q15_t* samples, uint8_t length)
if (m_count == N) {
float32_t value = m_q0 * m_q0 + m_q1 * m_q1 - m_q0 * m_q1 * m_coeff;
m_result = value >= m_threshold;
DEBUG4("CTCSS value / threshold / result", value, m_threshold, m_result);
//DEBUG4("CTCSS value / threshold / result", value, m_threshold, m_result);
m_count = 0U;
m_q0 = 0.0F;
m_q1 = 0.0F;