diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-03-20 13:31:36 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-03-22 21:08:30 -0400 |
commit | e6e9823488b4cf42778411f1239592f0787e121e (patch) | |
tree | dcdb0a902e921957a3e0b912c56a73d7fb67422d /libavcodec/dsputil.c | |
parent | e971d81364e93feae8c399075a3be2643192e031 (diff) | |
download | ffmpeg-e6e9823488b4cf42778411f1239592f0787e121e.tar.gz |
Add apply_window_int16() to DSPContext with x86-optimized versions and use it
in the ac3_fixed encoder.
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r-- | libavcodec/dsputil.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 1627262c22..15925f656b 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3890,6 +3890,19 @@ static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2, co return res; } +static void apply_window_int16_c(int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len) +{ + int i; + int len2 = len >> 1; + + for (i = 0; i < len2; i++) { + int16_t w = window[i]; + output[i] = (MUL16(input[i], w) + (1 << 14)) >> 15; + output[len-i-1] = (MUL16(input[len-i-1], w) + (1 << 14)) >> 15; + } +} + #define W0 2048 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ @@ -4364,6 +4377,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->vector_clipf = vector_clipf_c; c->scalarproduct_int16 = scalarproduct_int16_c; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; + c->apply_window_int16 = apply_window_int16_c; c->scalarproduct_float = scalarproduct_float_c; c->butterflies_float = butterflies_float_c; c->vector_fmul_scalar = vector_fmul_scalar_c; |