diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2008-07-06 06:06:55 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2008-07-06 06:06:55 +0000 |
commit | 88c0536a4217e3d88feddd91b74e7db6f752d301 (patch) | |
tree | d41b12c0d5dd841e3c9c80f4576b244cdbef622a /libavcodec/dsputil.c | |
parent | fcc402b1c93c35f8958d53270990640ad684cfe7 (diff) | |
download | ffmpeg-streaming-88c0536a4217e3d88feddd91b74e7db6f752d301.zip ffmpeg-streaming-88c0536a4217e3d88feddd91b74e7db6f752d301.tar.gz |
Add several vector functions used by Monkey's Audio decoder to dsputil
Originally committed as revision 14081 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r-- | libavcodec/dsputil.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 80efd07..4c07f7e 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3944,6 +3944,28 @@ void ff_float_to_int16_c(int16_t *dst, const float *src, int len){ } } +static void add_int16_c(int16_t * v1, int16_t * v2, int order) +{ + while (order--) + *v1++ += *v2++; +} + +static void sub_int16_c(int16_t * v1, int16_t * v2, int order) +{ + while (order--) + *v1++ -= *v2++; +} + +static int32_t scalarproduct_int16_c(int16_t * v1, int16_t * v2, int order, int shift) +{ + int res = 0; + + while (order--) + res += (*v1++ * *v2++) >> shift; + + return res; +} + #define W0 2048 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ @@ -4429,6 +4451,9 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->vector_fmul_reverse = vector_fmul_reverse_c; c->vector_fmul_add_add = ff_vector_fmul_add_add_c; c->float_to_int16 = ff_float_to_int16_c; + c->add_int16 = add_int16_c; + c->sub_int16 = sub_int16_c; + c->scalarproduct_int16 = scalarproduct_int16_c; c->shrink[0]= ff_img_copy_plane; c->shrink[1]= ff_shrink22; |