[FFmpeg-devel] [PATCH] Select cubic and lanczos as alternative where super-sampling is not supported

Moritz Barsnick barsnick at gmx.net
Sun Sep 11 20:55:49 EEST 2016


Moin Sven,

On Fri, Sep 09, 2016 at 11:13:55 +0100, Sven C. Dack wrote:

I may be missing something, but my excuse is that I can't test, but just
inspect by looking at it:

> +       if (s->interp_algo == NPPI_INTER_SUPER &&
> +           (out_width > in_width && out_height > in_height)) {
> +           s->interp_algo = NPPI_INTER_LANCZOS;
> +           av_log(ctx, AV_LOG_WARNING, "super-sampling not supported for output dimensions, using lanczos instead.\n");
> +       }
> +       if (s->interp_algo == NPPI_INTER_SUPER &&
> +           !(out_width < in_width && out_height < in_height)) {
> +           s->interp_algo = NPPI_INTER_CUBIC;
> +           av_log(ctx, AV_LOG_WARNING, "super-sampling not supported for output dimensions, using cubic instead.\n");
> +       }
> +    }

Let's assume s->interp_algo=NPPI_INTER_SUPER, out_width>in_width,
out_height>in_height:

if (true && (true && true)) {  }
if (true && !(false && false) {  }

Both blocks will be entered! Didn't you see both messages when testing?

Your commit message says ffmpeg needs to choose a different algo if
both dimensions aren't smaller, that's the second if(), which should be
the top-level decider:

> +       if (s->interp_algo == NPPI_INTER_SUPER &&
> +           !(out_width < in_width && out_height < in_height)) {

Then you seem to choose lanczos only if both are greater, so let me do
this as such:
> +           if (out_width > in_width && out_height > in_height) {
> +               s->interp_algo = NPPI_INTER_LANCZOS;
> +               av_log(ctx, AV_LOG_WARNING, "super-sampling not supported for output dimensions, using lanczos instead.\n");
> +           }
then the rest (i.e. one larger or equal, one smaller) would be cubic:
> +           else {
> +               s->interp_algo = NPPI_INTER_CUBIC;
> +               av_log(ctx, AV_LOG_WARNING, "super-sampling not supported for output dimensions, using cubic instead.\n");
> +           }
> +       }

Was that the intent?

Gruß,
Moritz


More information about the ffmpeg-devel mailing list