summaryrefslogtreecommitdiff
path: root/codecs/ilbc/filter.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2008-03-26 17:10:28 +0000
committerKevin P. Fleming <kpfleming@digium.com>2008-03-26 17:10:28 +0000
commit789831ef9abb8cc5cb4668f344f97bd3ae62244d (patch)
treeed528d6e40b53ec5f3c552e8397f98e471c489db /codecs/ilbc/filter.c
parent43d70915bb5e7fdd5fe5afa2c4516c362548e4b9 (diff)
Merged revisions 110880 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r110880 | kpfleming | 2008-03-26 09:42:35 -0700 (Wed, 26 Mar 2008) | 10 lines Merged revisions 110869 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r110869 | kpfleming | 2008-03-26 08:53:46 -0700 (Wed, 26 Mar 2008) | 2 lines due to licensing restrictions, we cannot distribute the source code for iLBC encoding and decoding... so remove it, and add instructions on how the user can obtain it themselves ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@110881 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'codecs/ilbc/filter.c')
-rw-r--r--codecs/ilbc/filter.c168
1 files changed, 0 insertions, 168 deletions
diff --git a/codecs/ilbc/filter.c b/codecs/ilbc/filter.c
deleted file mode 100644
index f4ba63386..000000000
--- a/codecs/ilbc/filter.c
+++ /dev/null
@@ -1,168 +0,0 @@
-
-/******************************************************************
-
- iLBC Speech Coder ANSI-C Source Code
-
- filter.c
-
- Copyright (C) The Internet Society (2004).
- All Rights Reserved.
-
-******************************************************************/
-
-
-
-#include "iLBC_define.h"
-#include "filter.h"
-
-/*----------------------------------------------------------------*
- * all-pole filter
- *---------------------------------------------------------------*/
-
-void AllPoleFilter(
- float *InOut, /* (i/o) on entrance InOut[-orderCoef] to
- InOut[-1] contain the state of the
- filter (delayed samples). InOut[0] to
- InOut[lengthInOut-1] contain the filter
- input, on en exit InOut[-orderCoef] to
- InOut[-1] is unchanged and InOut[0] to
- InOut[lengthInOut-1] contain filtered
- samples */
- float *Coef,/* (i) filter coefficients, Coef[0] is assumed
- to be 1.0 */
- int lengthInOut,/* (i) number of input/output samples */
- int orderCoef /* (i) number of filter coefficients */
-){
- int n,k;
-
- for(n=0;n<lengthInOut;n++){
- for(k=1;k<=orderCoef;k++){
- *InOut -= Coef[k]*InOut[-k];
- }
- InOut++;
- }
-}
-
-/*----------------------------------------------------------------*
- * all-zero filter
- *---------------------------------------------------------------*/
-
-void AllZeroFilter(
- float *In, /* (i) In[0] to In[lengthInOut-1] contain
- filter input samples */
- float *Coef,/* (i) filter coefficients (Coef[0] is assumed
- to be 1.0) */
- int lengthInOut,/* (i) number of input/output samples */
- int orderCoef, /* (i) number of filter coefficients */
- float *Out /* (i/o) on entrance Out[-orderCoef] to Out[-1]
- contain the filter state, on exit Out[0]
- to Out[lengthInOut-1] contain filtered
- samples */
-){
- int n,k;
-
- for(n=0;n<lengthInOut;n++){
- *Out = Coef[0]*In[0];
- for(k=1;k<=orderCoef;k++){
- *Out += Coef[k]*In[-k];
- }
-
-
- Out++;
- In++;
- }
-}
-
-/*----------------------------------------------------------------*
- * pole-zero filter
- *---------------------------------------------------------------*/
-
-void ZeroPoleFilter(
- float *In, /* (i) In[0] to In[lengthInOut-1] contain
- filter input samples In[-orderCoef] to
- In[-1] contain state of all-zero
- section */
- float *ZeroCoef,/* (i) filter coefficients for all-zero
- section (ZeroCoef[0] is assumed to
- be 1.0) */
- float *PoleCoef,/* (i) filter coefficients for all-pole section
- (ZeroCoef[0] is assumed to be 1.0) */
- int lengthInOut,/* (i) number of input/output samples */
- int orderCoef, /* (i) number of filter coefficients */
- float *Out /* (i/o) on entrance Out[-orderCoef] to Out[-1]
- contain state of all-pole section. On
- exit Out[0] to Out[lengthInOut-1]
- contain filtered samples */
-){
- AllZeroFilter(In,ZeroCoef,lengthInOut,orderCoef,Out);
- AllPoleFilter(Out,PoleCoef,lengthInOut,orderCoef);
-}
-
-/*----------------------------------------------------------------*
- * downsample (LP filter and decimation)
- *---------------------------------------------------------------*/
-
-void DownSample (
- float *In, /* (i) input samples */
- float *Coef, /* (i) filter coefficients */
- int lengthIn, /* (i) number of input samples */
- float *state, /* (i) filter state */
- float *Out /* (o) downsampled output */
-){
- float o;
- float *Out_ptr = Out;
- float *Coef_ptr, *In_ptr;
- float *state_ptr;
- int i, j, stop;
-
- /* LP filter and decimate at the same time */
-
- for (i = DELAY_DS; i < lengthIn; i+=FACTOR_DS)
- {
- Coef_ptr = &Coef[0];
- In_ptr = &In[i];
- state_ptr = &state[FILTERORDER_DS-2];
-
-
-
- o = (float)0.0;
-
- stop = (i < FILTERORDER_DS) ? i + 1 : FILTERORDER_DS;
-
- for (j = 0; j < stop; j++)
- {
- o += *Coef_ptr++ * (*In_ptr--);
- }
- for (j = i + 1; j < FILTERORDER_DS; j++)
- {
- o += *Coef_ptr++ * (*state_ptr--);
- }
-
- *Out_ptr++ = o;
- }
-
- /* Get the last part (use zeros as input for the future) */
-
- for (i=(lengthIn+FACTOR_DS); i<(lengthIn+DELAY_DS);
- i+=FACTOR_DS) {
-
- o=(float)0.0;
-
- if (i<lengthIn) {
- Coef_ptr = &Coef[0];
- In_ptr = &In[i];
- for (j=0; j<FILTERORDER_DS; j++) {
- o += *Coef_ptr++ * (*Out_ptr--);
- }
- } else {
- Coef_ptr = &Coef[i-lengthIn];
- In_ptr = &In[lengthIn-1];
- for (j=0; j<FILTERORDER_DS-(i-lengthIn); j++) {
- o += *Coef_ptr++ * (*In_ptr--);
- }
- }
- *Out_ptr++ = o;
- }
-}
-
-