From 4dc2dd80dc78f4abb19052682bfb68d64a7a96d6 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Mon, 10 Apr 2017 11:31:11 +0200 Subject: [PATCH] avutil/float_dsp: add vector_dmac_scalar() Signed-off-by: Paul B Mahol --- libavutil/float_dsp.c | 9 +++++++++ libavutil/float_dsp.h | 16 ++++++++++++++++ libavutil/version.h | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c index c85daffc6a..1d4911d815 100644 --- a/libavutil/float_dsp.c +++ b/libavutil/float_dsp.c @@ -40,6 +40,14 @@ static void vector_fmac_scalar_c(float *dst, const float *src, float mul, dst[i] += src[i] * mul; } +static void vector_dmac_scalar_c(double *dst, const double *src, double mul, + int len) +{ + int i; + for (i = 0; i < len; i++) + dst[i] += src[i] * mul; +} + static void vector_fmul_scalar_c(float *dst, const float *src, float mul, int len) { @@ -125,6 +133,7 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact) fdsp->vector_fmul = vector_fmul_c; fdsp->vector_fmac_scalar = vector_fmac_scalar_c; fdsp->vector_fmul_scalar = vector_fmul_scalar_c; + fdsp->vector_dmac_scalar = vector_dmac_scalar_c; fdsp->vector_dmul_scalar = vector_dmul_scalar_c; fdsp->vector_fmul_window = vector_fmul_window_c; fdsp->vector_fmul_add = vector_fmul_add_c; diff --git a/libavutil/float_dsp.h b/libavutil/float_dsp.h index d1be38f947..2c24d93471 100644 --- a/libavutil/float_dsp.h +++ b/libavutil/float_dsp.h @@ -54,6 +54,22 @@ typedef struct AVFloatDSPContext { void (*vector_fmac_scalar)(float *dst, const float *src, float mul, int len); + /** + * Multiply a vector of doubles by a scalar double and add to + * destination vector. Source and destination vectors must + * overlap exactly or not at all. + * + * @param dst result vector + * constraints: 32-byte aligned + * @param src input vector + * constraints: 32-byte aligned + * @param mul scalar value + * @param len length of vector + * constraints: multiple of 16 + */ + void (*vector_dmac_scalar)(double *dst, const double *src, double mul, + int len); + /** * Multiply a vector of floats by a scalar float. Source and * destination vectors must overlap exactly or not at all. diff --git a/libavutil/version.h b/libavutil/version.h index 95e1e929f3..f4d0930689 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -80,7 +80,7 @@ #define LIBAVUTIL_VERSION_MAJOR 55 #define LIBAVUTIL_VERSION_MINOR 60 -#define LIBAVUTIL_VERSION_MICRO 100 +#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \