aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/ilbc/hpOutput.c
blob: fdc0f6db92b9eb8e7829ce922d3897a2c7a9c966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/******************************************************************

    iLBC Speech Coder ANSI-C Source Code

    hpOutput.c 

    Copyright (C) The Internet Society (2004). 
    All Rights Reserved.



******************************************************************/

#include "constants.h"
#include "hpOutput.h"
/*----------------------------------------------------------------*
 *  Output high-pass filter                          
 *---------------------------------------------------------------*/

void hpOutput(
    float *In,  /* (i) vector to filter */
    int len,/* (i) length of vector to filter */
    float *Out, /* (o) the resulting filtered vector */
    float *mem  /* (i/o) the filter state */
){
    int i;
    float *pi, *po;

    /* all-zero section*/

    pi = &In[0];
    po = &Out[0];
    for (i=0; i<len; i++) {
        *po = hpo_zero_coefsTbl[0] * (*pi);
        *po += hpo_zero_coefsTbl[1] * mem[0];
        *po += hpo_zero_coefsTbl[2] * mem[1];

        mem[1] = mem[0];
        mem[0] = *pi;
        po++;
        pi++;

    }

    /* all-pole section*/

    po = &Out[0];
    for (i=0; i<len; i++) {
        *po -= hpo_pole_coefsTbl[1] * mem[2];
        *po -= hpo_pole_coefsTbl[2] * mem[3];

        mem[3] = mem[2];
        mem[2] = *po;
        po++;
    }
}