[FFmpeg-cvslog] dsputil: add vector_fmac_scalar()

Mans Rullgard git at videolan.org
Thu Sep 29 01:19:13 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Wed Sep 28 14:33:21 2011 +0100| [fcca826a63c79168f82a48c2620312630a83080a] | committer: Mans Rullgard

dsputil: add vector_fmac_scalar()

Signed-off-by: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcca826a63c79168f82a48c2620312630a83080a
---

 libavcodec/dsputil.c |    9 +++++++++
 libavcodec/dsputil.h |   11 +++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 039cf0b..967406e 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2455,6 +2455,14 @@ static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
         dst[i] = src[i] * mul;
 }
 
+static void vector_fmac_scalar_c(float *dst, const float *src, float mul,
+                                 int len)
+{
+    int i;
+    for (i = 0; i < len; i++)
+        dst[i] += src[i] * mul;
+}
+
 static void butterflies_float_c(float *restrict v1, float *restrict v2,
                                 int len)
 {
@@ -2994,6 +3002,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
     c->scalarproduct_float = scalarproduct_float_c;
     c->butterflies_float = butterflies_float_c;
     c->vector_fmul_scalar = vector_fmul_scalar_c;
+    c->vector_fmac_scalar = vector_fmac_scalar_c;
 
     c->shrink[0]= av_image_copy_plane;
     c->shrink[1]= ff_shrink22;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 4d783cf..73830f8 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -424,6 +424,17 @@ typedef struct DSPContext {
     void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
                                int len);
     /**
+     * Multiply a vector of floats by a scalar float and add to
+     * destination vector.  Source and destination vectors must
+     * overlap exactly or not at all.
+     * @param dst result vector, 16-byte aligned
+     * @param src input vector, 16-byte aligned
+     * @param mul scalar value
+     * @param len length of vector, multiple of 4
+     */
+    void (*vector_fmac_scalar)(float *dst, const float *src, float mul,
+                               int len);
+    /**
      * Calculate the scalar product of two vectors of floats.
      * @param v1  first vector, 16-byte aligned
      * @param v2  second vector, 16-byte aligned



More information about the ffmpeg-cvslog mailing list