diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-05-14 10:28:49 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-05-15 13:34:50 +0200 |
commit | 163e737c1793eeea9c2df15298253ffc04906afe (patch) | |
tree | b9adcc5b238908c6ad6f69ea951a42b7e9b3db89 /libavfilter/af_afirdsp.h | |
parent | e6f0cec88041449475f37b82b76699d2f7b5b124 (diff) | |
download | ffmpeg-163e737c1793eeea9c2df15298253ffc04906afe.tar.gz |
avfilter/af_afir: add support for double sample format
Diffstat (limited to 'libavfilter/af_afirdsp.h')
-rw-r--r-- | libavfilter/af_afirdsp.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h index 05182bebb4..bf7d1d6f0f 100644 --- a/libavfilter/af_afirdsp.h +++ b/libavfilter/af_afirdsp.h @@ -29,6 +29,8 @@ typedef struct AudioFIRDSPContext { void (*fcmul_add)(float *sum, const float *t, const float *c, ptrdiff_t len); + void (*dcmul_add)(double *sum, const double *t, const double *c, + ptrdiff_t len); } AudioFIRDSPContext; void ff_afir_init_x86(AudioFIRDSPContext *s); @@ -50,9 +52,27 @@ static void fcmul_add_c(float *sum, const float *t, const float *c, ptrdiff_t le sum[2 * n] += t[2 * n] * c[2 * n]; } +static void dcmul_add_c(double *sum, const double *t, const double *c, ptrdiff_t len) +{ + int n; + + for (n = 0; n < len; n++) { + const double cre = c[2 * n ]; + const double cim = c[2 * n + 1]; + const double tre = t[2 * n ]; + const double tim = t[2 * n + 1]; + + sum[2 * n ] += tre * cre - tim * cim; + sum[2 * n + 1] += tre * cim + tim * cre; + } + + sum[2 * n] += t[2 * n] * c[2 * n]; +} + static av_unused void ff_afir_init(AudioFIRDSPContext *dsp) { dsp->fcmul_add = fcmul_add_c; + dsp->dcmul_add = dcmul_add_c; if (ARCH_X86) ff_afir_init_x86(dsp); |