[Asterisk-Dev] Re: [Asterisk-cvs] asterisk/codecs codec_speex.c, 1.17, 1.18 slin_speex_ex.h, 1.1, 1.2

SteveK stevek at stevek.com
Fri Aug 26 20:07:05 MST 2005


Just wanted to add my 2c here -- I would have in mantis, but once the  
issue is closed, you can't comment on it anymore..

The speex preprocessor is indeed used in iaxclient, and it's really  
pretty good.  But, I think that while it's useful to put it in the  
speex codec driver, it really isn't the right place for this..

The preprocessor is completely codec-independent.  It's a filter  
which works on PCM samples, and is applicable to speech processing  
whether you're using speex, another codec, or no codec at all.  It  
provides frequency domain VAD, Noise Reduction, AGC, and  
Dereverberation.

It happens to come with libspeex, but the code is actually independent.

So, there's nothing _wrong_ about putting it in the speex codec  
driver, but if people find it useful when using the speex codec, it  
would be equally useful with other (ahem, lesser) codecs as well.

-SteveK

On Aug 26, 2005, at 5:12 PM, kpfleming at lists.digium.com wrote:

> Update of /usr/cvsroot/asterisk/codecs
> In directory mongoose.digium.com:/tmp/cvs-serv8835/codecs
>
> Modified Files:
>     codec_speex.c slin_speex_ex.h
> Log Message:
> update to use Speex 1.1.x features and doc cleanups (issue #4755)
>
>
> Index: codec_speex.c
> ===================================================================
> RCS file: /usr/cvsroot/asterisk/codecs/codec_speex.c,v
> retrieving revision 1.17
> retrieving revision 1.18
> diff -u -d -r1.17 -r1.18
> --- codec_speex.c    12 Jul 2005 22:20:16 -0000    1.17
> +++ codec_speex.c    26 Aug 2005 20:14:06 -0000    1.18
> @@ -22,15 +22,30 @@
>  #include <stdio.h>
>  #include <speex.h>
>
> -static int quality = 8;
> +/* We require a post 1.1.8 version of Speex to enable preprocessing
> +   and better type handling */
> +#ifdef _SPEEX_TYPES_H
> +#include <speex/speex_preprocess.h>
> +#endif
>

[...]

> +static int preproc = 0;
> +static int pp_vad = 0;
> +static int pp_agc = 0;
> +static float pp_agc_level = 8000;
> +static int pp_denoise = 0;
> +static int pp_dereverb = 0;
> +static float pp_dereverb_decay = 0.4;
> +static float pp_dereverb_level = 0.3;
> +

[...]

> +#ifdef _SPEEX_TYPES_H
> +        /* Preprocess audio */
> +        if(preproc)
> +            is_speech = speex_preprocess(tmp->pp, tmp->buf, NULL);
> +        /* Encode a frame of data */
> +        if (is_speech) {
> +            /* If DTX enabled speex_encode returns 0 during  
> silence */
> +            is_speech = speex_encode_int(tmp->speex, tmp->buf,  
> &tmp->bits) || !dtx;
> +        } else {
> +            /* 5 zeros interpreted by Speex as silence (submode 0) */
> +            speex_bits_pack(&tmp->bits, 0, 5);
> +        }

[...]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20050826/445123b9/attachment.htm


More information about the asterisk-dev mailing list