X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavfilter%2Faf_volume.c;fp=ffmpeg%2Flibavfilter%2Faf_volume.c;h=4809ae77ddc9ba6428319f7e945c43be5aa1e996;hp=9900d22e2306f0d8b8dd40d00bf4e726ad787979;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavfilter/af_volume.c b/ffmpeg/libavfilter/af_volume.c index 9900d22..4809ae7 100644 --- a/ffmpeg/libavfilter/af_volume.c +++ b/ffmpeg/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); }