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

jm at svn.xiph.org jm at svn.xiph.org
Wed Feb 13 02:11:57 PST 2008


Author: jm
Date: 2008-02-13 02:11:57 -0800 (Wed, 13 Feb 2008)
New Revision: 14496

Modified:
   trunk/speex/include/speex/speex_preprocess.h
   trunk/speex/libspeex/preprocess.c
Log:
Thorvald Natvig: Patch to query the current probability of speech


Modified: trunk/speex/include/speex/speex_preprocess.h
===================================================================
--- trunk/speex/include/speex/speex_preprocess.h	2008-02-13 10:11:41 UTC (rev 14495)
+++ trunk/speex/include/speex/speex_preprocess.h	2008-02-13 10:11:57 UTC (rev 14496)
@@ -202,6 +202,10 @@
 /** Get noise estimate (int32[] of squared values) */
 #define SPEEX_PREPROCESS_GET_NOISE_PSD 43
 
+/* Can't set speech probability */
+/** Get speech probability in last frame (int32).  */
+#define SPEEX_PREPROCESS_GET_PROB 45
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c	2008-02-13 10:11:41 UTC (rev 14495)
+++ trunk/speex/libspeex/preprocess.c	2008-02-13 10:11:57 UTC (rev 14496)
@@ -199,6 +199,8 @@
    int    echo_suppress_active;
    SpeexEchoState *echo_state;
    
+   spx_word16_t	speech_prob;  /**< Probability last frame was speech */
+
    /* DSP-related arrays */
    spx_word16_t *frame;      /**< Processing frame (2*ps_size) */
    spx_word16_t *ft;         /**< Processing frame in freq domain (2*ps_size) */
@@ -994,9 +996,10 @@
       st->outbuf[i] = st->frame[st->frame_size+i];
 
    /* FIXME: This VAD is a kludge */
+   st->speech_prob = Pframe;
    if (st->vad_enabled)
    {
-      if (Pframe > st->speech_prob_start || (st->was_speech && Pframe > st->speech_prob_continue))
+      if (st->speech_prob > st->speech_prob_start || (st->was_speech && st->speech_prob > st->speech_prob_continue))
       {
          st->was_speech=1;
          return 1;
@@ -1191,6 +1194,9 @@
       for(i=0;i<st->ps_size;i++)
       	((spx_int32_t *)ptr)[i] = (spx_int32_t) PSHR32(st->noise[i], NOISE_SHIFT);
       break;
+   case SPEEX_PREPROCESS_GET_PROB:
+      (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob, 100);
+      break;
    default:
       speex_warning_int("Unknown speex_preprocess_ctl request: ", request);
       return -1;



More information about the commits mailing list