mirror of https://git.ffmpeg.org/ffmpeg.git
avfilter/arls_template: use defines for all constants
This commit is contained in:
parent
f66536cc58
commit
47e214245b
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#undef ZERO
|
||||
#undef HALF
|
||||
#undef ONE
|
||||
#undef ftype
|
||||
#undef SAMPLE_FORMAT
|
||||
|
@ -23,10 +25,14 @@
|
|||
#define SAMPLE_FORMAT float
|
||||
#define ftype float
|
||||
#define ONE 1.f
|
||||
#define HALF 0.5f
|
||||
#define ZERO 0.f
|
||||
#else
|
||||
#define SAMPLE_FORMAT double
|
||||
#define ftype double
|
||||
#define ONE 1.0
|
||||
#define HALF 0.5
|
||||
#define ZERO 0.0
|
||||
#endif
|
||||
|
||||
#define fn3(a,b) a##_##b
|
||||
|
@ -92,21 +98,21 @@ static ftype fn(process_sample)(AudioRLSContext *s, ftype input, ftype desired,
|
|||
for (int i = 0, pos = offset; i < order; i++, pos++) {
|
||||
const int ikernel_size = i * kernel_size;
|
||||
|
||||
u[i] = 0.f;
|
||||
u[i] = ZERO;
|
||||
for (int k = 0, pos = offset; k < order; k++, pos++)
|
||||
u[i] += p[ikernel_size + k] * delay[pos];
|
||||
|
||||
g += u[i] * delay[pos];
|
||||
}
|
||||
|
||||
g = 1.f / g;
|
||||
g = ONE / g;
|
||||
|
||||
for (int i = 0; i < order; i++) {
|
||||
const int ikernel_size = i * kernel_size;
|
||||
|
||||
gains[i] = u[i] * g;
|
||||
coeffs[i] = coeffs[order + i] = coeffs[i] + gains[i] * e;
|
||||
tmp[i] = 0.f;
|
||||
tmp[i] = ZERO;
|
||||
for (int k = 0, pos = offset; k < order; k++, pos++)
|
||||
tmp[i] += p[ikernel_size + k] * delay[pos];
|
||||
}
|
||||
|
@ -122,7 +128,7 @@ static ftype fn(process_sample)(AudioRLSContext *s, ftype input, ftype desired,
|
|||
const int ikernel_size = i * kernel_size;
|
||||
|
||||
for (int k = 0; k < order; k++)
|
||||
p[ikernel_size + k] = (p[ikernel_size + k] - (dp[ikernel_size + k] + dp[kernel_size * k + i]) * 0.5f) * lambda;
|
||||
p[ikernel_size + k] = (p[ikernel_size + k] - (dp[ikernel_size + k] + dp[kernel_size * k + i]) * HALF) * lambda;
|
||||
}
|
||||
|
||||
switch (s->output_mode) {
|
||||
|
|
Loading…
Reference in New Issue