[FFmpeg-devel] [PATCH] avfilter: add median filter

Moritz Barsnick barsnick at gmx.net
Mon Oct 28 15:05:17 EET 2019


On Sat, Oct 26, 2019 at 21:44:02 +0200, Paul B Mahol wrote:
> +Pick median pixel from certain rectangle defined by radius.

Is radius the correct term within a rectangle? (Just wondering, I do
understand the intent.)

> +        memset(coarse, 0, sizeof(coarse));
> +        memset(fine, 0, sizeof(fine));
> +        memset(luc, 0, sizeof(luc));

Shouldn't this be
    memset(arrayptr, 0, sizeof(*arrayptr));
?

> +    MedianContext *s = ctx->priv;
> +
> +    for (int i = 0; i < s->nb_threads && s->coarse && s->fine; i++) {
> +        av_freep(&s->coarse[i]);
> +        av_freep(&s->fine[i]);
> +    }

s->coarse and s->fine are constant in this scope. Instead of checking
them on each iteration, you could just exit early of they are (or
either is) NULL. Not that performance matters here at all.

I don't understand the rest functionally, looks fine to me.

Cheers,
Moritz


More information about the ffmpeg-devel mailing list