From: "Rémi Denis-Courmont" <remi@remlab.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 2/4] lavf: get rid of bespoke double scalar products
Date: Wed, 29 May 2024 17:59:53 +0300
Message-ID: <20240529145955.32189-2-remi@remlab.net> (raw)
In-Reply-To: <20240529145955.32189-1-remi@remlab.net>
---
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)
--
2.45.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-05-29 15:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 14:59 [FFmpeg-devel] [PATCH 1/4] lavu/float_dsp: add double-precision scalar product Rémi Denis-Courmont
2024-05-29 14:59 ` Rémi Denis-Courmont [this message]
2024-05-29 15:46 ` [FFmpeg-devel] [PATCH 2/4] lavf: get rid of bespoke double scalar products Andreas Rheinhardt
2024-05-29 15:52 ` Rémi Denis-Courmont
2024-05-29 14:59 ` [FFmpeg-devel] [PATCH 3/4] checkasm/float_dsp: add double-precision scalar product Rémi Denis-Courmont
2024-05-29 14:59 ` [FFmpeg-devel] [PATCH 4/4] lavc/float_dsp: R-V V scalarproduct_double Rémi Denis-Courmont
2024-05-29 15:42 ` Andreas Rheinhardt
2024-05-29 15:44 ` [FFmpeg-devel] [PATCH 1/4] lavu/float_dsp: add double-precision scalar product Andreas Rheinhardt
2024-05-29 15:51 ` Rémi Denis-Courmont
2024-05-29 16:04 ` James Almer
2024-06-02 10:04 ` Alexander Strasser via ffmpeg-devel
2024-06-02 10:30 ` Rémi Denis-Courmont
2024-06-02 10:34 ` Rémi Denis-Courmont
2024-06-02 10:43 ` Alexander Strasser via ffmpeg-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240529145955.32189-2-remi@remlab.net \
--to=remi@remlab.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git