[xiph-commits] r10228 - in trunk/speex: include/speex libspeex

jm at svn.xiph.org jm at svn.xiph.org
Fri Oct 21 23:12:51 PDT 2005


Author: jm
Date: 2005-10-21 23:12:48 -0700 (Fri, 21 Oct 2005)
New Revision: 10228

Modified:
   trunk/speex/include/speex/speex_preprocess.h
   trunk/speex/libspeex/preprocess.c
Log:
Merged:
02_configurable-VAD.dpatch by A. Maitland Bottoms <bottoms at debian.org>


Modified: trunk/speex/include/speex/speex_preprocess.h
===================================================================
--- trunk/speex/include/speex/speex_preprocess.h	2005-10-22 06:02:43 UTC (rev 10227)
+++ trunk/speex/include/speex/speex_preprocess.h	2005-10-22 06:12:48 UTC (rev 10228)
@@ -57,6 +57,8 @@
    int    dereverb_enabled;
    float  reverb_decay;
    float  reverb_level;
+   float  speech_prob_start;
+   float  speech_prob_continue;
    
    float *frame;             /**< Processing frame (2*ps_size) */
    float *ps;                /**< Current power spectrum */
@@ -156,6 +158,12 @@
 /** Get preprocessor dereverb decay */
 #define SPEEX_PREPROCESS_GET_DEREVERB_DECAY 13
 
+#define SPEEX_PREPROCESS_SET_PROB_START 14
+#define SPEEX_PREPROCESS_GET_PROB_START 15
+
+#define SPEEX_PREPROCESS_SET_PROB_CONTINUE 16
+#define SPEEX_PREPROCESS_GET_PROB_CONTINUE 17
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c	2005-10-22 06:02:43 UTC (rev 10227)
+++ trunk/speex/libspeex/preprocess.c	2005-10-22 06:12:48 UTC (rev 10228)
@@ -52,6 +52,9 @@
 
 #define NB_BANDS 8
 
+#define SPEEX_PROB_START_DEFAULT    0.35f
+#define SPEEX_PROB_CONTINUE_DEFAULT 0.20f
+
 #define ZMIN .1
 #define ZMAX .316
 #define ZMIN_1 10
@@ -157,6 +160,9 @@
    st->reverb_decay = .5;
    st->reverb_level = .2;
 
+   st->speech_prob_start = SPEEX_PROB_START_DEFAULT;
+   st->speech_prob_continue = SPEEX_PROB_CONTINUE_DEFAULT;
+
    st->frame = (float*)speex_alloc(2*N*sizeof(float));
    st->ps = (float*)speex_alloc(N*sizeof(float));
    st->gain2 = (float*)speex_alloc(N*sizeof(float));
@@ -451,7 +457,8 @@
       st->speech_prob = p0/(1e-25f+p1+p0);
       /*fprintf (stderr, "%f %f %f ", tot_loudness, st->loudness2, st->speech_prob);*/
 
-      if (st->speech_prob>.35 || (st->last_speech < 20 && st->speech_prob>.1))
+      if (st->speech_prob > st->speech_prob_start
+         || (st->last_speech < 20 && st->speech_prob > st->speech_prob_continue))
       {
          is_speech = 1;
          st->last_speech = 0;
@@ -993,6 +1000,24 @@
       (*(float*)ptr) = st->reverb_decay;
       break;
 
+   case SPEEX_PREPROCESS_SET_PROB_START:
+      st->speech_prob_start = (*(int*)ptr) / 100.0;
+      if ( st->speech_prob_start > 1 || st->speech_prob_start < 0 )
+         st->speech_prob_start = SPEEX_PROB_START_DEFAULT;
+      break;
+   case SPEEX_PREPROCESS_GET_PROB_START:
+      (*(int*)ptr) = st->speech_prob_start * 100;
+      break;
+
+   case SPEEX_PREPROCESS_SET_PROB_CONTINUE:
+      st->speech_prob_continue = (*(int*)ptr) / 100.0;
+      if ( st->speech_prob_continue > 1 || st->speech_prob_continue < 0 )
+         st->speech_prob_continue = SPEEX_PROB_CONTINUE_DEFAULT;
+      break;
+   case SPEEX_PREPROCESS_GET_PROB_CONTINUE:
+      (*(int*)ptr) = st->speech_prob_continue * 100;
+      break;
+
       default:
       speex_warning_int("Unknown speex_preprocess_ctl request: ", request);
       return -1;



More information about the commits mailing list