37 memset(fc_out, 0,
len *
sizeof(int16_t));
41 for (
i = 0;
i <
len;
i++) {
43 for (k = 0; k <
i; k++)
44 fc_out[k] += (fc_in[
i] *
filter[
len + k -
i]) >> 15;
46 for (k =
i; k <
len; k++)
47 fc_out[k] += (fc_in[
i] *
filter[ k -
i]) >> 15;
53 const float *lagged,
int lag,
float fac,
int n)
56 for (k = 0; k < lag; k++)
57 out[k] = in[k] + fac * lagged[n + k - lag];
59 out[k] = in[k] + fac * lagged[ k - lag];
63 const int16_t *in,
int buffer_length,
64 int filter_length,
int stop_on_overflow,
65 int shift,
int rounder)
69 for (n = 0; n < buffer_length; n++) {
70 int sum = rounder, sum1;
71 for (
i = 1;
i <= filter_length;
i++)
72 sum -= (
unsigned)(filter_coeffs[
i-1] *
out[n-
i]);
74 sum1 = ((sum >> 12) + in[n]) >>
shift;
77 if (stop_on_overflow && sum != sum1)
87 const float* in,
int buffer_length,
93 for (n = 0; n < buffer_length; n++) {
95 for (
i = 1;
i <= filter_length;
i++)
96 out[n] -= filter_coeffs[
i-1] *
out[n-
i];
99 float out0, out1, out2, out3;
100 float old_out0, old_out1, old_out2, old_out3;
103 a = filter_coeffs[0];
104 b = filter_coeffs[1];
105 c = filter_coeffs[2];
106 b -= filter_coeffs[0] * filter_coeffs[0];
107 c -= filter_coeffs[1] * filter_coeffs[0];
108 c -= filter_coeffs[0] *
b;
110 av_assert2((filter_length&1)==0 && filter_length>=4);
116 for (n = 0; n <= buffer_length - 4; n+=4) {
117 float tmp0,tmp1,tmp2;
125 out0 -= filter_coeffs[2] * old_out1;
126 out1 -= filter_coeffs[2] * old_out2;
127 out2 -= filter_coeffs[2] * old_out3;
129 out0 -= filter_coeffs[1] * old_out2;
130 out1 -= filter_coeffs[1] * old_out3;
132 out0 -= filter_coeffs[0] * old_out3;
134 val = filter_coeffs[3];
136 out0 -=
val * old_out0;
137 out1 -=
val * old_out1;
138 out2 -=
val * old_out2;
139 out3 -=
val * old_out3;
141 for (
i = 5;
i < filter_length;
i += 2) {
143 val = filter_coeffs[
i-1];
145 out0 -=
val * old_out3;
146 out1 -=
val * old_out0;
147 out2 -=
val * old_out1;
148 out3 -=
val * old_out2;
150 old_out2 =
out[-
i-1];
152 val = filter_coeffs[
i];
154 out0 -=
val * old_out2;
155 out1 -=
val * old_out3;
156 out2 -=
val * old_out0;
157 out3 -=
val * old_out1;
159 FFSWAP(
float, old_out0, old_out2);
193 for (; n < buffer_length; n++) {
195 for (
i = 1;
i <= filter_length;
i++)
196 out[n] -= filter_coeffs[
i-1] *
out[n-
i];
202 const float *in,
int buffer_length,
207 for (n = 0; n < buffer_length; n++) {
209 for (
i = 1;
i <= filter_length;
i++)
210 out[n] += filter_coeffs[
i-1] * in[n-
i];
static double val(void *priv, double ch)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
void ff_celp_convolve_circ(int16_t *fc_out, const int16_t *fc_in, const int16_t *filter, int len)
Circularly convolve fixed vector with a phase dispersion impulse response filter (D....
void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, const float *in, int buffer_length, int filter_length)
LP synthesis filter.
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs, const int16_t *in, int buffer_length, int filter_length, int stop_on_overflow, int shift, int rounder)
LP synthesis filter.
void ff_celp_circ_addf(float *out, const float *in, const float *lagged, int lag, float fac, int n)
Add an array to a rotated array.
void av_cold ff_celp_filter_init(CELPFContext *c)
Initialize CELPFContext.
void ff_celp_lp_zero_synthesis_filterf(float *out, const float *filter_coeffs, const float *in, int buffer_length, int filter_length)
LP zero synthesis filter.
void ff_celp_filter_init_mips(CELPFContext *c)
common internal and external API header
static int shift(int a, int b)
Macro definitions for various function/variable attributes.
#define FFSWAP(type, a, b)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)