comparison acelp_filters.c @ 10463:9f35b262d3f0 libavcodec

Commit some functions that are used by both SIPR and AMR. Based on AMR SoC code by Robert Swain and Colin McQuillan.
author vitor
date Tue, 27 Oct 2009 23:53:18 +0000
parents cfb009484d2d
children 7f9d077af2e4
comparison
equal deleted inserted replaced
10462:dd97c2418d4e 10463:9f35b262d3f0
71 av_log(NULL, AV_LOG_WARNING, "overflow that would need cliping in ff_acelp_interpolate()\n"); 71 av_log(NULL, AV_LOG_WARNING, "overflow that would need cliping in ff_acelp_interpolate()\n");
72 out[n] = v >> 15; 72 out[n] = v >> 15;
73 } 73 }
74 } 74 }
75 75
76 void ff_acelp_interpolatef(float *out, const float *in,
77 const float *filter_coeffs, int precision,
78 int frac_pos, int filter_length, int length)
79 {
80 int n, i;
81
82 for (n = 0; n < length; n++) {
83 int idx = 0;
84 float v = 0;
85
86 for (i = 0; i < filter_length;) {
87 v += in[n + i] * filter_coeffs[idx + frac_pos];
88 idx += precision;
89 i++;
90 v += in[n - i] * filter_coeffs[idx - frac_pos];
91 }
92 out[n] = v;
93 }
94 }
95
76 96
77 void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2], 97 void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2],
78 const int16_t* in, int length) 98 const int16_t* in, int length)
79 { 99 {
80 int i; 100 int i;
108 128
109 mem[1] = mem[0]; 129 mem[1] = mem[0];
110 mem[0] = tmp; 130 mem[0] = tmp;
111 } 131 }
112 } 132 }
133
134 void ff_tilt_compensation(float *mem, float tilt, float *samples, int size)
135 {
136 float new_tilt_mem = samples[size - 1];
137 int i;
138
139 for (i = size - 1; i > 0; i--)
140 samples[i] -= tilt * samples[i - 1];
141
142 samples[0] -= tilt * *mem;
143 *mem = new_tilt_mem;
144 }
145