[svn-commits] kpfleming: branch linux/kpfleming/echocan_work r6441 - /linux/team/kpfleming/...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Apr 21 19:35:56 CDT 2009
Author: kpfleming
Date: Tue Apr 21 19:35:53 2009
New Revision: 6441
URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6441
Log:
(yes, i reindented this code... sue me <G>)
make the CED detector work in more cases, especially for FAX machines that generate CED/ANS without polarity reversals
Modified:
linux/team/kpfleming/echocan_work/drivers/dahdi/ecdis.h
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/ecdis.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/ecdis.h?view=diff&rev=6441&r1=6440&r2=6441
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/ecdis.h (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/ecdis.h Tue Apr 21 19:35:53 2009
@@ -53,10 +53,10 @@
/*- End of function --------------------------------------------------------*/
static inline int echo_can_disable_detector_update (echo_can_disable_detector_state_t *det,
- int16_t amp)
+ int16_t amp)
{
- int16_t notched;
-
+ int16_t notched;
+
notched = biquad2 (&det->notch, amp);
/* Estimate the overall energy in the channel, and the energy in
the notch (i.e. overall channel energy - tone energy => noise).
@@ -66,40 +66,38 @@
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 >= 70)
- {
- /* 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;
+ if (det->channel_level >= 70) {
+ /* There is adequate energy in the channel. Is it mostly at 2100Hz? */
+ if (det->notch_level*6 < det->channel_level) {
+ det->tone_cycle_duration++;
+ /* 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))) {
+ /* It's ANS/PR (CED with polarity reversals), so wait
+ for at least three cycles before returning a hit. */
+ det->good_cycles++;
+ if (det->good_cycles > 2)
+ det->hit = TRUE;
+ }
+ det->tone_cycle_duration = 0;
+ det->tone_present = TRUE;
+ } else if (det->tone_cycle_duration >= 600 * 8) {
+ /* It's ANS (CED without polarity reversals)
+ so return a hit. */
+ det->hit = TRUE;
+ }
+ } else {
+ det->tone_present = FALSE;
}
- det->tone_present = TRUE;
- }
- else
- {
+ } else {
det->tone_present = FALSE;
- }
- det->tone_cycle_duration++;
+ det->tone_cycle_duration = 0;
+ det->good_cycles = 0;
}
- else
- {
- det->tone_present = FALSE;
- det->tone_cycle_duration = 0;
- det->good_cycles = 0;
- }
- return det->hit;
+
+ return det->hit;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
More information about the svn-commits
mailing list