1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #undef ZERO
20 #undef ONE
21 #undef ftype
22 #undef SAMPLE_FORMAT
23 #if DEPTH == 32
24 #define SAMPLE_FORMAT float
25 #define ftype float
26 #define ONE 1.f
27 #define ZERO 0.f
28 #else
29 #define SAMPLE_FORMAT double
33 #endif
34
35 #define fn3(a,b) a##_##b
36 #define fn2(a,b) fn3(a,b)
37 #define fn(a) fn2(a, SAMPLE_FORMAT)
38
41 {
42 const int order =
s->order;
44
46
48 #if DEPTH == 32
49 output =
s->fdsp->scalarproduct_float(delay,
tmp,
s->kernel_size);
50 #else
51 output =
s->fdsp->scalarproduct_double(delay,
tmp,
s->kernel_size);
52 #endif
53
56
58 }
59
61 {
62 for (
int i = 0;
i <=
N;
i++)
64
65 for (
int i = 0;
i <
N;
i++) {
68
69 for (
int k =
i; k <
N; k++) {
71 if (absA > maxA) {
72 maxA = absA;
73 imax = k;
74 }
75 }
76
77 if (maxA < tol)
78 return 0;
79
84 }
85
86 for (
int j =
i + 1; j <
N; j++) {
88
89 for (
int k =
i + 1; k <
N; k++)
90 MA[j][k] -= MA[j][
i] * MA[
i][k];
91 }
92 }
93
94 return 1;
95 }
96
98 {
99 for (
int j = 0; j <
N; j++) {
100 for (
int i = 0;
i <
N;
i++) {
102
103 for (
int k = 0; k <
i; k++)
104 IA[
i][j] -= MA[
i][k] *
IA[k][j];
105 }
106
107 for (
int i =
N - 1;
i >= 0;
i--) {
108 for (
int k =
i + 1; k <
N; k++)
109 IA[
i][j] -= MA[
i][k] *
IA[k][j];
110
111 IA[
i][j] /= MA[
i][
i];
112 }
113 }
114 }
115
117 {
118 ftype *dcoeffs = (
ftype *)
s->dcoeffs->extended_data[ch];
119 ftype *coeffs = (
ftype *)
s->coeffs->extended_data[ch];
120 ftype *delay = (
ftype *)
s->delay->extended_data[ch];
121 ftype **itmpmp = (
ftype **)&
s->itmpmp[
s->projection * ch];
122 ftype **tmpmp = (
ftype **)&
s->tmpmp[
s->projection * ch];
128 int *p = (
int *)
s->p->extended_data[ch];
129 int *
offset = (
int *)
s->offset->extended_data[ch];
130 const int projection =
s->projection;
132 const int order =
s->order;
133 const int length = projection + order;
135 const ftype tol = 0.00001f;
137
140
143
144 for (
int i = 0;
i < projection;
i++) {
145 const int iprojection =
i * projection;
146
147 for (
int j =
i; j < projection; j++) {
149 for (int k = 0; k < order; k++)
151 tmpm[iprojection + j] = sum;
153 tmpm[j * projection +
i] = sum;
154 }
155
156 tmpm[iprojection +
i] +=
delta;
157 }
158
161
162 for (
int i = 0;
i < projection;
i++) {
164 for (int j = 0; j < projection; j++)
165 sum += itmpmp[
i][j] * e[j +
offset[1]];
167 }
168
169 for (
int i = 0;
i < order;
i++) {
171 for (int j = 0; j < projection; j++)
174 }
175
176 for (
int i = 0;
i < order;
i++)
177 coeffs[
i] = coeffs[
i + order] = coeffs[
i] + mu * dcoeffs[
i];
178
180 offset[1] = projection - 1;
181
184
185 switch (
s->output_mode) {
191 }
193 }
194
196 {
199 const int start = (
out->ch_layout.nb_channels * jobnr) / nb_jobs;
200 const int end = (
out->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
201
202 for (
int c = start;
c < end;
c++) {
204 const ftype *desired = (
const ftype *)
s->frame[1]->extended_data[
c];
206
207 for (
int n = 0; n <
out->nb_samples; n++) {
209 if (
ctx->is_disabled)
211 }
212 }
213
214 return 0;
215 }