aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_volume.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-18 12:24:41 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-18 12:38:38 +0100
commit9e526213a27f803f9f0d9682489655a1aef0feff (patch)
tree4f53152bde7b083e777681f9fdb9ff11afe2cec5 /libavfilter/af_volume.c
parentaa97223f14a1aad2a54fc87dd196c2c5e6ba6f40 (diff)
downloadffmpeg-9e526213a27f803f9f0d9682489655a1aef0feff.tar.gz
avfilter/af_volume: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/af_volume.c')
-rw-r--r--libavfilter/af_volume.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 9900d22e23..4809ae77dd 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -111,6 +111,11 @@ static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx)
static av_cold int init(AVFilterContext *ctx)
{
VolumeContext *vol = ctx->priv;
+
+ vol->fdsp = avpriv_float_dsp_alloc(0);
+ if (!vol->fdsp)
+ return AVERROR(ENOMEM);
+
return set_expr(&vol->volume_pexpr, vol->volume_expr, ctx);
}
@@ -119,6 +124,7 @@ static av_cold void uninit(AVFilterContext *ctx)
VolumeContext *vol = ctx->priv;
av_expr_free(vol->volume_pexpr);
av_opt_free(vol);
+ av_freep(&vol->fdsp);
}
static int query_formats(AVFilterContext *ctx)
@@ -233,11 +239,9 @@ static av_cold void volume_init(VolumeContext *vol)
vol->scale_samples = scale_samples_s32;
break;
case AV_SAMPLE_FMT_FLT:
- avpriv_float_dsp_init(&vol->fdsp, 0);
vol->samples_align = 4;
break;
case AV_SAMPLE_FMT_DBL:
- avpriv_float_dsp_init(&vol->fdsp, 0);
vol->samples_align = 8;
break;
}
@@ -428,13 +432,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
}
} else if (av_get_packed_sample_fmt(vol->sample_fmt) == AV_SAMPLE_FMT_FLT) {
for (p = 0; p < vol->planes; p++) {
- vol->fdsp.vector_fmul_scalar((float *)out_buf->extended_data[p],
+ vol->fdsp->vector_fmul_scalar((float *)out_buf->extended_data[p],
(const float *)buf->extended_data[p],
vol->volume, plane_samples);
}
} else {
for (p = 0; p < vol->planes; p++) {
- vol->fdsp.vector_dmul_scalar((double *)out_buf->extended_data[p],
+ vol->fdsp->vector_dmul_scalar((double *)out_buf->extended_data[p],
(const double *)buf->extended_data[p],
vol->volume, plane_samples);
}