Revision 51222d10 libavcodec/acelp_filters.c

View differences:

libavcodec/acelp_filters.c
25 25
#include "avcodec.h"
26 26
#include "acelp_filters.h"
27 27

  
28
const int16_t ff_acelp_interp_filter[61] =
29
{ /* (0.15) */
28
const int16_t ff_acelp_interp_filter[61] = { /* (0.15) */
30 29
  29443, 28346, 25207, 20449, 14701,  8693,
31 30
   3143, -1352, -4402, -5865, -5850, -4673,
32 31
  -2783,  -672,  1211,  2536,  3130,  2991,
......
40 39
      0,
41 40
};
42 41

  
43
void ff_acelp_interpolate(
44
        int16_t* out,
45
        const int16_t* in,
46
        const int16_t* filter_coeffs,
47
        int precision,
48
        int frac_pos,
49
        int filter_length,
50
        int length)
42
void ff_acelp_interpolate(int16_t* out, const int16_t* in,
43
                          const int16_t* filter_coeffs, int precision,
44
                          int frac_pos, int filter_length, int length)
51 45
{
52 46
    int n, i;
53 47

  
54 48
    assert(pitch_delay_frac >= 0 && pitch_delay_frac < precision);
55 49

  
56
    for(n=0; n<length; n++)
57
    {
50
    for (n = 0; n < length; n++) {
58 51
        int idx = 0;
59 52
        int v = 0x4000;
60 53

  
61
        for(i=0; i<filter_length;)
62
        {
54
        for (i = 0; i < filter_length;) {
63 55

  
64 56
            /* The reference G.729 and AMR fixed point code performs clipping after
65 57
               each of the two following accumulations.
......
75 67
            i++;
76 68
            v += in[n - i] * filter_coeffs[idx - frac_pos];
77 69
        }
78
        if(av_clip_int16(v>>15) != (v>>15))
70
        if (av_clip_int16(v >> 15) != (v >> 15))
79 71
            av_log(NULL, AV_LOG_WARNING, "overflow that would need cliping in ff_acelp_interpolate()\n");
80 72
        out[n] = v >> 15;
81 73
    }
82 74
}
83 75

  
84 76

  
85
void ff_acelp_high_pass_filter(
86
        int16_t* out,
87
        int hpf_f[2],
88
        const int16_t* in,
89
        int length)
77
void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2],
78
                               const int16_t* in, int length)
90 79
{
91 80
    int i;
92 81
    int tmp;
93 82

  
94
    for(i=0; i<length; i++)
95
    {
96
        tmp =  (hpf_f[0]* 15836LL)>>13;
97
        tmp += (hpf_f[1]* -7667LL)>>13;
83
    for (i = 0; i < length; i++) {
84
        tmp  = (hpf_f[0]* 15836LL) >> 13;
85
        tmp += (hpf_f[1]* -7667LL) >> 13;
98 86
        tmp += 7699 * (in[i] - 2*in[i-1] + in[i-2]);
99 87

  
100 88
        /* With "+0x800" rounding, clipping is needed

Also available in: Unified diff