Message ID | 20240529145955.32189-2-remi@remlab.net |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/4] lavu/float_dsp: add double-precision scalar product | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Rémi Denis-Courmont: > --- > libavfilter/aap_template.c | 14 +------------- > libavfilter/anlms_template.c | 16 ++-------------- > libavfilter/arls_template.c | 14 +------------- > 3 files changed, 4 insertions(+), 40 deletions(-) > > diff --git a/libavfilter/aap_template.c b/libavfilter/aap_template.c > index ea9c815a89..0e0580fb32 100644 > --- a/libavfilter/aap_template.c > +++ b/libavfilter/aap_template.c > @@ -36,18 +36,6 @@ > #define fn2(a,b) fn3(a,b) > #define fn(a) fn2(a, SAMPLE_FORMAT) > > -#if DEPTH == 64 > -static double scalarproduct_double(const double *v1, const double *v2, int len) > -{ > - double p = 0.0; > - > - for (int i = 0; i < len; i++) > - p += v1[i] * v2[i]; > - > - return p; > -} > -#endif > - > static ftype fn(fir_sample)(AudioAPContext *s, ftype sample, ftype *delay, > ftype *coeffs, ftype *tmp, int *offset) > { > @@ -60,7 +48,7 @@ static ftype fn(fir_sample)(AudioAPContext *s, ftype sample, ftype *delay, > #if DEPTH == 32 > output = s->fdsp->scalarproduct_float(delay, tmp, s->kernel_size); > #else > - output = scalarproduct_double(delay, tmp, s->kernel_size); > + output = s->fdsp->scalarproduct_double(delay, tmp, s->kernel_size); > #endif > > if (--(*offset) < 0) > diff --git a/libavfilter/anlms_template.c b/libavfilter/anlms_template.c > index b25df4fa18..a8d1dbfe0f 100644 > --- a/libavfilter/anlms_template.c > +++ b/libavfilter/anlms_template.c > @@ -33,18 +33,6 @@ > #define fn2(a,b) fn3(a,b) > #define fn(a) fn2(a, SAMPLE_FORMAT) > > -#if DEPTH == 64 > -static double scalarproduct_double(const double *v1, const double *v2, int len) > -{ > - double p = 0.0; > - > - for (int i = 0; i < len; i++) > - p += v1[i] * v2[i]; > - > - return p; > -} > -#endif > - > static ftype fn(fir_sample)(AudioNLMSContext *s, ftype sample, ftype *delay, > ftype *coeffs, ftype *tmp, int *offset) > { > @@ -58,7 +46,7 @@ static ftype fn(fir_sample)(AudioNLMSContext *s, ftype sample, ftype *delay, > #if DEPTH == 32 > output = s->fdsp->scalarproduct_float(delay, tmp, s->kernel_size); > #else > - output = scalarproduct_double(delay, tmp, s->kernel_size); > + output = s->fdsp->scalarproduct_double(delay, tmp, s->kernel_size); > #endif > > if (--(*offset) < 0) > @@ -85,7 +73,7 @@ static ftype fn(process_sample)(AudioNLMSContext *s, ftype input, ftype desired, > #if DEPTH == 32 > sum = s->fdsp->scalarproduct_float(delay, delay, s->kernel_size); > #else > - sum = scalarproduct_double(delay, delay, s->kernel_size); > + sum = s->fdsp->scalarproduct_double(delay, delay, s->kernel_size); > #endif > norm = s->eps + sum; > b = mu * e / norm; > diff --git a/libavfilter/arls_template.c b/libavfilter/arls_template.c > index d8b19d89a5..c67b48cf6f 100644 > --- a/libavfilter/arls_template.c > +++ b/libavfilter/arls_template.c > @@ -39,18 +39,6 @@ > #define fn2(a,b) fn3(a,b) > #define fn(a) fn2(a, SAMPLE_FORMAT) > > -#if DEPTH == 64 > -static double scalarproduct_double(const double *v1, const double *v2, int len) > -{ > - double p = 0.0; > - > - for (int i = 0; i < len; i++) > - p += v1[i] * v2[i]; > - > - return p; > -} > -#endif > - > static ftype fn(fir_sample)(AudioRLSContext *s, ftype sample, ftype *delay, > ftype *coeffs, ftype *tmp, int *offset) > { > @@ -64,7 +52,7 @@ static ftype fn(fir_sample)(AudioRLSContext *s, ftype sample, ftype *delay, > #if DEPTH == 32 > output = s->fdsp->scalarproduct_float(delay, tmp, s->kernel_size); > #else > - output = scalarproduct_double(delay, tmp, s->kernel_size); > + output = s->fdsp->scalarproduct_double(delay, tmp, s->kernel_size); > #endif > > if (--(*offset) < 0) 1. lavf is libavformat; libavfilter is lavfi. 2. Do you intend to use this outside of lavfi? - Andreas
Le keskiviikkona 29. toukokuuta 2024, 18.46.05 EEST Andreas Rheinhardt a écrit
:
> 2. Do you intend to use this outside of lavfi?
Yes.
diff --git a/libavfilter/aap_template.c b/libavfilter/aap_template.c index ea9c815a89..0e0580fb32 100644 --- a/libavfilter/aap_template.c +++ b/libavfilter/aap_template.c @@ -36,18 +36,6 @@ #define fn2(a,b) fn3(a,b) #define fn(a) fn2(a, SAMPLE_FORMAT) -#if DEPTH == 64 -static double scalarproduct_double(const double *v1, const double *v2, int len) -{ - double p = 0.0; - - for (int i = 0; i < len; i++) - p += v1[i] * v2[i]; - - return p; -} -#endif - static ftype fn(fir_sample)(AudioAPContext *s, ftype sample, ftype *delay, ftype *coeffs, ftype *tmp, int *offset) { @@ -60,7 +48,7 @@ static ftype fn(fir_sample)(AudioAPContext *s, ftype sample, ftype *delay, #if DEPTH == 32 output = s->fdsp->scalarproduct_float(delay, tmp, s->kernel_size); #else - output = scalarproduct_double(delay, tmp, s->kernel_size); + output = s->fdsp->scalarproduct_double(delay, tmp, s->kernel_size); #endif if (--(*offset) < 0) diff --git a/libavfilter/anlms_template.c b/libavfilter/anlms_template.c index b25df4fa18..a8d1dbfe0f 100644 --- a/libavfilter/anlms_template.c +++ b/libavfilter/anlms_template.c @@ -33,18 +33,6 @@ #define fn2(a,b) fn3(a,b) #define fn(a) fn2(a, SAMPLE_FORMAT) -#if DEPTH == 64 -static double scalarproduct_double(const double *v1, const double *v2, int len) -{ - double p = 0.0; - - for (int i = 0; i < len; i++) - p += v1[i] * v2[i]; - - return p; -} -#endif - static ftype fn(fir_sample)(AudioNLMSContext *s, ftype sample, ftype *delay, ftype *coeffs, ftype *tmp, int *offset) { @@ -58,7 +46,7 @@ static ftype fn(fir_sample)(AudioNLMSContext *s, ftype sample, ftype *delay, #if DEPTH == 32 output = s->fdsp->scalarproduct_float(delay, tmp, s->kernel_size); #else - output = scalarproduct_double(delay, tmp, s->kernel_size); + output = s->fdsp->scalarproduct_double(delay, tmp, s->kernel_size); #endif if (--(*offset) < 0) @@ -85,7 +73,7 @@ static ftype fn(process_sample)(AudioNLMSContext *s, ftype input, ftype desired, #if DEPTH == 32 sum = s->fdsp->scalarproduct_float(delay, delay, s->kernel_size); #else - sum = scalarproduct_double(delay, delay, s->kernel_size); + sum = s->fdsp->scalarproduct_double(delay, delay, s->kernel_size); #endif norm = s->eps + sum; b = mu * e / norm; diff --git a/libavfilter/arls_template.c b/libavfilter/arls_template.c index d8b19d89a5..c67b48cf6f 100644 --- a/libavfilter/arls_template.c +++ b/libavfilter/arls_template.c @@ -39,18 +39,6 @@ #define fn2(a,b) fn3(a,b) #define fn(a) fn2(a, SAMPLE_FORMAT) -#if DEPTH == 64 -static double scalarproduct_double(const double *v1, const double *v2, int len) -{ - double p = 0.0; - - for (int i = 0; i < len; i++) - p += v1[i] * v2[i]; - - return p; -} -#endif - static ftype fn(fir_sample)(AudioRLSContext *s, ftype sample, ftype *delay, ftype *coeffs, ftype *tmp, int *offset) { @@ -64,7 +52,7 @@ static ftype fn(fir_sample)(AudioRLSContext *s, ftype sample, ftype *delay, #if DEPTH == 32 output = s->fdsp->scalarproduct_float(delay, tmp, s->kernel_size); #else - output = scalarproduct_double(delay, tmp, s->kernel_size); + output = s->fdsp->scalarproduct_double(delay, tmp, s->kernel_size); #endif if (--(*offset) < 0)