diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-06-08 22:34:30 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-06-18 18:01:14 -0400 |
commit | f0ece49e74bf4443b91a98c228da8b645a8c5173 (patch) | |
tree | bf0a347c00771aa29a7151fe656ca249b63a75ac | |
parent | 82b2df979069063beb14be340350501c8340f9cd (diff) | |
download | ffmpeg-f0ece49e74bf4443b91a98c228da8b645a8c5173.tar.gz |
af_amix: use AVFloatDSPContext.vector_fmac_scalar()
-rw-r--r-- | libavfilter/af_amix.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 003a8e8e62..44549801ae 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -32,6 +32,7 @@ #include "libavutil/audio_fifo.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" +#include "libavutil/float_dsp.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" #include "libavutil/samplefmt.h" @@ -152,6 +153,7 @@ static int frame_list_add_frame(FrameList *frame_list, int nb_samples, int64_t p typedef struct MixContext { const AVClass *class; /**< class for AVOptions */ + AVFloatDSPContext fdsp; int nb_inputs; /**< number of inputs */ int active_inputs; /**< number of input currently active */ @@ -263,14 +265,6 @@ static int config_output(AVFilterLink *outlink) return 0; } -/* TODO: move optimized version from DSPContext to libavutil */ -static void vector_fmac_scalar(float *dst, const float *src, float mul, int len) -{ - int i; - for (i = 0; i < len; i++) - dst[i] += src[i] * mul; -} - /** * Read samples from the input FIFOs, mix, and write to the output link. */ @@ -295,9 +289,10 @@ static int output_frame(AVFilterLink *outlink, int nb_samples) if (s->input_state[i] == INPUT_ON) { av_audio_fifo_read(s->fifos[i], (void **)in_buf->extended_data, nb_samples); - vector_fmac_scalar((float *)out_buf->extended_data[0], - (float *) in_buf->extended_data[0], - s->input_scale[i], nb_samples * s->nb_channels); + s->fdsp.vector_fmac_scalar((float *)out_buf->extended_data[0], + (float *) in_buf->extended_data[0], + s->input_scale[i], + FFALIGN(nb_samples * s->nb_channels, 16)); } } avfilter_unref_buffer(in_buf); @@ -500,6 +495,8 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque) ff_insert_inpad(ctx, i, &pad); } + avpriv_float_dsp_init(&s->fdsp, 0); + return 0; } |