]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 30 Nov 2007 23:30:36 +0000 (23:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 30 Nov 2007 23:30:36 +0000 (23:30 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@353 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/libteletone_detect.c

index c695d7e7b22e4c26e9b793b03686670fd29c8c24..004aac3e587a51e7e887fb6d5dca240117ac042b 100644 (file)
@@ -231,7 +231,7 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
                        
                        mt->energy += famp*famp;
 
-                       for(x = 0; x < mt->tone_count; x++) {
+                       for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) {
                                v1 = mt->gs[x].v2;
                                mt->gs[x].v2 = mt->gs[x].v3;
                                mt->gs[x].v3 = (float)(mt->gs[x].fac * mt->gs[x].v2 - v1 + famp);
@@ -248,13 +248,13 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
                }
 
                eng_sum = 0;
-               for(x = 0; x < mt->tone_count; x++) {
+               for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) {
                        eng_all[x] = (float)(teletone_goertzel_result (&mt->gs[x]));
                        eng_sum += eng_all[x];
                }
 
                gtest = 0;
-               for(x = 0; x < mt->tone_count; x++) {
+               for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) {
                        gtest += teletone_goertzel_result (&mt->gs2[x]) < eng_all[x] ? 1 : 0;
                }
 
@@ -282,7 +282,7 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
                }
 
                /* Reinitialise the detector for the next block */
-               for(x = 0; x < mt->tone_count; x++) {
+               for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) {
                        goertzel_init (&mt->gs[x], &mt->tdd[x]);
                        goertzel_init (&mt->gs2[x], &mt->tdd[x]);
                }