struct ec_disable_detector_state { struct biquad2_state notch; int notch_level; int channel_level; int tone_present; int tone_cycle_duration; int good_cycles; int hit;
};
#defineFALSE0 #defineTRUE (!FALSE)
staticinlinevoid
echo_can_disable_detector_init(struct ec_disable_detector_state *det)
{ /* Elliptic notch */ /* This is actually centred at 2095Hz, but gets the balance we want, due
to the asymmetric walls of the notch */
biquad2_init(&det->notch,
(int32_t)(-0.7600000 * 32768.0),
(int32_t)(-0.1183852 * 32768.0),
(int32_t)(-0.5104039 * 32768.0),
(int32_t)(0.1567596 * 32768.0),
(int32_t)(1.0000000 * 32768.0));
det->channel_level = 0;
det->notch_level = 0;
det->tone_present = FALSE;
det->tone_cycle_duration = 0;
det->good_cycles = 0;
det->hit = 0;
} /*- End of function --------------------------------------------------------*/
notched = biquad2(&det->notch, amp); /* Estimate the overall energy in the channel, and the energy in thenotch(i.e.overallchannelenergy-toneenergy=>noise). Useabsinsteadofmultiplyforspeed(isitreallyfaster?). Damptheoverallenergyalittlemoreforastableresult. Dampthenotchenergyalittleless,sowedon'tdampoutthe
blip every time the phase reverses */
det->channel_level += ((abs(amp) - det->channel_level) >> 5);
det->notch_level += ((abs(notched) - det->notch_level) >> 4); if (det->channel_level > 280) { /* There is adequate energy in the channel.
Is it mostly at 2100Hz? */ if (det->notch_level * 6 < det->channel_level) { /* The notch says yes, so we have the tone. */ if (!det->tone_present) { /* Do we get a kick every 450+-25ms? */ if (det->tone_cycle_duration >= 425 * 8
&& det->tone_cycle_duration <= 475 * 8) {
det->good_cycles++; if (det->good_cycles > 2)
det->hit = TRUE;
}
det->tone_cycle_duration = 0;
}
det->tone_present = TRUE;
} else
det->tone_present = FALSE;
det->tone_cycle_duration++;
} else {
det->tone_present = FALSE;
det->tone_cycle_duration = 0;
det->good_cycles = 0;
} return det->hit;
} /*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.