[xiph-commits] r14495 - in trunk/speex: include/speex libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Wed Feb 13 02:11:41 PST 2008
Author: jm
Date: 2008-02-13 02:11:41 -0800 (Wed, 13 Feb 2008)
New Revision: 14495
Modified:
trunk/speex/include/speex/speex_preprocess.h
trunk/speex/libspeex/preprocess.c
Log:
Thorvald Natvig: Patch to query noise and signal info from preprocessor
Modified: trunk/speex/include/speex/speex_preprocess.h
===================================================================
--- trunk/speex/include/speex/speex_preprocess.h 2008-02-13 10:11:24 UTC (rev 14494)
+++ trunk/speex/include/speex/speex_preprocess.h 2008-02-13 10:11:41 UTC (rev 14495)
@@ -186,6 +186,22 @@
/** Get current gain (int32 percent) */
#define SPEEX_PREPROCESS_GET_AGC_GAIN 35
+/* Can't set spectrum size */
+/** Get spectrum size for power spectrum (int32) */
+#define SPEEX_PREPROCESS_GET_PSD_SIZE 37
+
+/* Can't set power spectrum */
+/** Get power spectrum (int32[] of squared values) */
+#define SPEEX_PREPROCESS_GET_PSD 39
+
+/* Can't set noise size */
+/** Get spectrum size for noise estimate (int32) */
+#define SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE 41
+
+/* Can't set noise estimate */
+/** Get noise estimate (int32[] of squared values) */
+#define SPEEX_PREPROCESS_GET_NOISE_PSD 43
+
#ifdef __cplusplus
}
#endif
Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c 2008-02-13 10:11:24 UTC (rev 14494)
+++ trunk/speex/libspeex/preprocess.c 2008-02-13 10:11:41 UTC (rev 14495)
@@ -1179,7 +1179,18 @@
(*(spx_int32_t*)ptr) = (spx_int32_t) (st->agc_gain * 100.f);
break;
#endif
-
+ case SPEEX_PREPROCESS_GET_PSD_SIZE:
+ case SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE:
+ (*(spx_int32_t*)ptr) = st->ps_size;
+ break;
+ case SPEEX_PREPROCESS_GET_PSD:
+ for(i=0;i<st->ps_size;i++)
+ ((spx_int32_t *)ptr)[i] = (spx_int32_t) st->ps[i];
+ break;
+ case SPEEX_PREPROCESS_GET_NOISE_PSD:
+ for(i=0;i<st->ps_size;i++)
+ ((spx_int32_t *)ptr)[i] = (spx_int32_t) PSHR32(st->noise[i], NOISE_SHIFT);
+ break;
default:
speex_warning_int("Unknown speex_preprocess_ctl request: ", request);
return -1;
More information about the commits
mailing list