[FFmpeg-devel] [PATCH] avfilter: add declick and declip audio filters

James Almer jamrial at gmail.com
Fri May 18 03:57:31 EEST 2018


On 5/17/2018 2:19 PM, Paul B Mahol wrote:
> +static int config_input(AVFilterLink *inlink)
> +{
> +    AVFilterContext *ctx = inlink->dst;
> +    DeclickContext *s = ctx->priv;
> +    int i;
> +
> +    s->pts = AV_NOPTS_VALUE;
> +    s->window_size = inlink->sample_rate * s->w / 1000.;
> +    if (s->window_size < 100)
> +        return AVERROR(EINVAL);
> +    s->ar_order = FFMAX(s->window_size * s->ar / 100., 1);
> +    s->nb_burst_samples = s->window_size * s->burst / 1000.;
> +    s->hop_size = s->window_size * (1. - (s->overlap / 100.));
> +    if (s->hop_size < 1)
> +        return AVERROR(EINVAL);
> +
> +    s->fifo = av_audio_fifo_alloc(inlink->format, inlink->channels, s->window_size);
> +    if (!s->fifo)
> +        return AVERROR(ENOMEM);
> +
> +    s->window_func_lut = av_realloc_f(s->window_func_lut, s->window_size,
> +                                      sizeof(*s->window_func_lut));

av_malloc_array()


More information about the ffmpeg-devel mailing list