From: "Rémi Denis-Courmont" <remi@remlab.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 1/4] lavu/float_dsp: add double-precision scalar product
Date: Wed, 29 May 2024 17:59:52 +0300
Message-ID: <20240529145955.32189-1-remi@remlab.net> (raw)
The function pointer is appended to the structure for backward binary
compatibility. Fortunately, this is allocated by libavutil, not by the
user, so increasing the structure size is safe.
---
doc/APIchanges | 3 +++
libavutil/float_dsp.c | 12 ++++++++++++
libavutil/float_dsp.h | 14 ++++++++++++++
libavutil/version.h | 2 +-
4 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 60f056b863..50c51c664f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
+2024-05-29 - xxxxxxxxxx - lavu 59.21.100 - float_dsp.h
+ Add AVFloatDSPContext.scalarproduct_double.
+
2024-05-23 - xxxxxxxxxx - lavu 59.20.100 - channel_layout.h
Add av_channel_layout_ambisonic_order().
diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c
index e9fb023466..1c5bb05636 100644
--- a/libavutil/float_dsp.c
+++ b/libavutil/float_dsp.c
@@ -132,6 +132,17 @@ float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
return p;
}
+static double ff_scalarproduct_double_c(const double *v1, const double *v2,
+ size_t len)
+{
+ double p = 0.0;
+
+ for (size_t i = 0; i < len; i++)
+ p += v1[i] * v2[i];
+
+ return p;
+}
+
av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
{
AVFloatDSPContext *fdsp = av_mallocz(sizeof(AVFloatDSPContext));
@@ -149,6 +160,7 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
fdsp->vector_fmul_reverse = vector_fmul_reverse_c;
fdsp->butterflies_float = butterflies_float_c;
fdsp->scalarproduct_float = avpriv_scalarproduct_float_c;
+ fdsp->scalarproduct_double = ff_scalarproduct_double_c;
#if ARCH_AARCH64
ff_float_dsp_init_aarch64(fdsp);
diff --git a/libavutil/float_dsp.h b/libavutil/float_dsp.h
index 342a8715c5..b6b5b0a3b3 100644
--- a/libavutil/float_dsp.h
+++ b/libavutil/float_dsp.h
@@ -19,6 +19,8 @@
#ifndef AVUTIL_FLOAT_DSP_H
#define AVUTIL_FLOAT_DSP_H
+#include <stddef.h>
+
typedef struct AVFloatDSPContext {
/**
* Calculate the entry wise product of two vectors of floats and store the result in
@@ -187,6 +189,18 @@ typedef struct AVFloatDSPContext {
*/
void (*vector_dmul)(double *dst, const double *src0, const double *src1,
int len);
+
+ /**
+ * Calculate the scalar product of two vectors of doubles.
+ *
+ * @param v1 first vector
+ * @param v2 second vector
+ * @param len length of vectors
+ *
+ * @return inner product of the vectors
+ */
+ double (*scalarproduct_double)(const double *v1, const double *v2,
+ size_t len);
} AVFloatDSPContext;
/**
diff --git a/libavutil/version.h b/libavutil/version.h
index 9c7146c228..9d08d56884 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 59
-#define LIBAVUTIL_VERSION_MINOR 20
+#define LIBAVUTIL_VERSION_MINOR 21
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
--
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 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 Rémi Denis-Courmont [this message]
2024-05-29 14:59 ` [FFmpeg-devel] [PATCH 2/4] lavf: get rid of bespoke double scalar products Rémi Denis-Courmont
2024-05-29 15:46 ` 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-1-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