[FFmpeg-devel] [PATCH 1/2] Add vector_fmul_step_scalar for WMA
Mans Rullgard
mans
Thu Oct 1 00:16:21 CEST 2009
---
libavcodec/dsputil.c | 16 ++++++++++++++++
libavcodec/dsputil.h | 3 +++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 894e592..d55f889 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -4074,6 +4074,21 @@ static void vector_fmul_add_c(float *dst, const float *src0, const float *src1,
dst[i] = src0[i] * src1[i] + src2[i];
}
+static void vector_fmul_step_scalar_c(float *dst, const float *src0,
+ const float *src1, float src2,
+ int shift, int len)
+{
+ int i;
+ if (shift >= 0) {
+ for (i = 0; i < len; i++)
+ dst[i] = src0[i] * src1[i<<shift] * src2;
+ } else {
+ shift = -shift;
+ for (i = 0; i < len; i++)
+ dst[i] = src0[i] * src1[i>>shift] * src2;
+ }
+}
+
void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len){
int i,j;
dst += len;
@@ -4799,6 +4814,7 @@ 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_fmul_step_scalar = vector_fmul_step_scalar_c;
c->vector_fmul_sv_scalar[0] = vector_fmul_sv_scalar_2_c;
c->vector_fmul_sv_scalar[1] = vector_fmul_sv_scalar_4_c;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index dd7b22d..e3a18e2 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -392,6 +392,9 @@ typedef struct DSPContext {
void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len);
/* assume len is a multiple of 4, and arrays are 16-byte aligned */
void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len);
+ void (*vector_fmul_step_scalar)(float *dst, const float *src0,
+ const float *src1, float src2,
+ int shift, int len);
/* assume len is a multiple of 8, and arrays are 16-byte aligned */
void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len);
void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
--
1.6.4.4
More information about the ffmpeg-devel
mailing list