[FFmpeg-devel] [PATCH] lavfi: add dctdnoiz filter

Derek Buitenhuis derek.buitenhuis at gmail.com
Sat May 4 22:25:48 CEST 2013


On 2013-05-04 3:48 PM, Clément Bœsch wrote:
> + at section dctdnoiz

Perhaps some more explanation as to what it actually is. I kind of doubt
most users who want to denoise have enough in-depth knowledge to know
what a 'dct denoiser' is (though many seem to understand to understand
what frequency-domain filtering is, weirdly...)

Personally, I'm interested in seeing some before/after examples not from
the paper, since they seem kinda 'fake' to me. ;)

> +#define OFFSET(x) offsetof(DCTdnoizContext, x)

This still has to be done on a per-filter basis?

> *line *= x == 0 ? 1. / sqrt(BSIZE) : sqrt(2. / BSIZE);

This is uh, fairly unreadable at best. Same for future
incantations.

> +    if (s->pr_width != inlink->w)
> +        av_log(ctx, AV_LOG_WARNING, "The last %d horizontal pixels won't be denoised\n",
> +               inlink->w - s->pr_width);
> +    if (s->pr_height != inlink->h)
> +        av_log(ctx, AV_LOG_WARNING, "The last %d vertical pixels won't be denoised\n",
> +               inlink->h - s->pr_height);

Is it not feasible to extend the buffer (with black) to support this, or
will that break the denoising entirely?

> +        s->cbuf[i][0] = av_malloc(linesize * s->pr_height * sizeof(*s->cbuf[i][0]));
> +        s->cbuf[i][1] = av_malloc(linesize * s->pr_height * sizeof(*s->cbuf[i][1]));
> +        s->cbuf[i][2] = av_malloc(linesize * s->pr_height * sizeof(*s->cbuf[i][2]));
> +        if (!s->cbuf[i][0] || !s->cbuf[i][1] || !s->cbuf[i][2])
> +            return AVERROR(ENOMEM);

Won't this leak memory? Same for other such multiple-malloc checks.

- Derek


More information about the ffmpeg-devel mailing list