[xiph-commits] r14611 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Thu Mar 20 02:00:04 PDT 2008
Author: jm
Date: 2008-03-20 02:00:03 -0700 (Thu, 20 Mar 2008)
New Revision: 14611
Modified:
trunk/speex/libspeex/preprocess.c
trunk/speex/libspeex/testdenoise.c
Log:
Thorvald Natvig: The attached patch fixes an inconsistancy in my earlier patch.
Whereas the rest of the AGC ctls are in dB, GET_AGC_GAIN was linear. This patch
fixes that. It also changes the API for _GET and _SET_AGC_LEVEL to use an
int32 instead of a float, meaning we don't need to do a API change when we get
a fixed point AGC.
Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c 2008-03-19 20:32:11 UTC (rev 14610)
+++ trunk/speex/libspeex/preprocess.c 2008-03-20 09:00:03 UTC (rev 14611)
@@ -1067,14 +1067,14 @@
break;
#ifndef DISABLE_FLOAT_API
case SPEEX_PREPROCESS_SET_AGC_LEVEL:
- st->agc_level = (*(float*)ptr);
+ st->agc_level = (*(spx_int32_t*)ptr);
if (st->agc_level<1)
st->agc_level=1;
if (st->agc_level>32768)
st->agc_level=32768;
break;
case SPEEX_PREPROCESS_GET_AGC_LEVEL:
- (*(float*)ptr) = st->agc_level;
+ (*(spx_int32_t*)ptr) = st->agc_level;
break;
#endif /* #ifndef DISABLE_FLOAT_API */
case SPEEX_PREPROCESS_SET_AGC_INCREMENT:
@@ -1176,7 +1176,7 @@
(*(spx_int32_t*)ptr) = pow(st->loudness, 1.0/LOUDNESS_EXP);
break;
case SPEEX_PREPROCESS_GET_AGC_GAIN:
- (*(spx_int32_t*)ptr) = (spx_int32_t) (st->agc_gain * 100.f);
+ (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->agc_gain));
break;
#endif
case SPEEX_PREPROCESS_GET_PSD_SIZE:
Modified: trunk/speex/libspeex/testdenoise.c
===================================================================
--- trunk/speex/libspeex/testdenoise.c 2008-03-19 20:32:11 UTC (rev 14610)
+++ trunk/speex/libspeex/testdenoise.c 2008-03-20 09:00:03 UTC (rev 14611)
@@ -20,8 +20,8 @@
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i);
i=0;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i);
- f=8000;
- speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &f);
+ i=8000;
+ speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &i);
i=0;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB, &i);
f=.0;
More information about the commits
mailing list