[Asterisk-code-review] dsp.c: Fix erroneous fax tone detection. (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Tue Jul 26 12:16:01 CDT 2016


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/3336

Change subject: dsp.c: Fix erroneous fax tone detection.
......................................................................

dsp.c: Fix erroneous fax tone detection.

The Goertzel calculations get less accurate the lower the signal level
being worked with becomes because there is less resolution remaining.
If it is too low we can erroneously detect a tone where none really
exists.  The searched for fax frequencies not only need to be so much
stronger than the background noise they must also be a minimum strength.

* Add needed minimum threshold test to tone_detect().

* Set TONE_THRESHOLD to allow low volume frequency spread detection.

ASTERISK-26237 #close
Reported by: Richard Mudgett

Change-Id: I84dbba7f7628fa13720add6a88eae3b129e066fc
---
M main/dsp.c
1 file changed, 3 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/3336/1

diff --git a/main/dsp.c b/main/dsp.c
index 0874163..18f2a22 100644
--- a/main/dsp.c
+++ b/main/dsp.c
@@ -171,8 +171,7 @@
  */
 
 #define DTMF_THRESHOLD		8.0e7
-#define FAX_THRESHOLD		8.0e7
-#define FAX_2ND_HARMONIC	2.0     /* 4dB */
+#define TONE_THRESHOLD		7.8e7
 
 #define DEF_DTMF_NORMAL_TWIST		6.31	 /* 8.0dB */
 #define DEF_RELAX_DTMF_NORMAL_TWIST	6.31	 /* 8.0dB */
@@ -187,8 +186,6 @@
 
 #define DTMF_RELATIVE_PEAK_ROW	6.3     /* 8dB */
 #define DTMF_RELATIVE_PEAK_COL	6.3     /* 8dB */
-#define DTMF_2ND_HARMONIC_ROW       (relax ? 1.7 : 2.5)     /* 4dB normal */
-#define DTMF_2ND_HARMONIC_COL	63.1    /* 18dB */
 #define DTMF_TO_TOTAL_ENERGY	42.0
 
 #define BELL_MF_THRESHOLD	1.6e9
@@ -583,7 +580,8 @@
 
 		ast_debug(10, "tone %d, Ew=%.2E, Et=%.2E, s/n=%10.2f\n", s->freq, tone_energy, s->energy, tone_energy / (s->energy - tone_energy));
 		hit = 0;
-		if (tone_energy > s->energy * s->threshold) {
+		if (TONE_THRESHOLD <= tone_energy
+			&& tone_energy > s->energy * s->threshold) {
 			ast_debug(10, "Hit! count=%d\n", s->hit_count);
 			hit = 1;
 		}

-- 
To view, visit https://gerrit.asterisk.org/3336
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I84dbba7f7628fa13720add6a88eae3b129e066fc
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list