[FFmpeg-devel] [PATCH] avfilter: add scale2ref_npp video filter

Roman Arzumanyan rarzumanyan at nvidia.com
Mon Oct 4 17:59:22 EEST 2021


Please find revised patch attached.

>Use the init-callback instead of the init_dict and remove the unused options completely.
Did that.

>This has lots of duplication with the ordinary scale filter
There are some leftovers copy-pasted from scale2ref filter to make scale2ref_npp parameters syntax similar. Their amount was trimmed to possible minimum.

________________________________
От: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> от имени Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
Отправлено: 4 октября 2021 г. 11:59
Кому: ffmpeg-devel at ffmpeg.org <ffmpeg-devel at ffmpeg.org>
Тема: Re: [FFmpeg-devel] [PATCH] avfilter: add scale2ref_npp video filter

External email: Use caution opening links or attachments


Roman Arzumanyan:
> Thanks for the review, Timo.
>
> Please find revised patch attached.
> Docstring was added, trailing spaces removed, commit message brushed up. Avfilter minor version bump added.

This has lots of duplication with the ordinary scale filter: var_names,
enum var_name and enum eval_mode are identical; check_exprs and
scale_pars_expr are basically the same. You are even copying bugs from
the original scale filter: Its handling of the AVDictionary is buggy,
because it is supposed to return an AVDictionary with all the
unrecognized/unsupported options instead of just taking all the options.
Given that your filter simply ignores the options your handling of it is
worse, but also more easily fixable: Use the init-callback instead of
the init_dict and remove the unused options completely.

>
> @@ -366,8 +715,8 @@ static int nppscale_config_props(AVFilterLink *outlink)
>             inlink->w, inlink->h, outlink->w, outlink->h);
>
>      if (inlink->sample_aspect_ratio.num)
> -        outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h*inlink->w,
> -                                                             outlink->w*inlink->h},
> +        outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * inlink->w,
> +                                                             outlink->w * inlink->h},
>                                                  inlink->sample_aspect_ratio);
>      else
>          outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;

Cosmetic change; should not be in a functional commit.

>
> @@ -148,7 +483,9 @@ static int nppscale_query_formats(AVFilterContext *ctx)
>      static const enum AVPixelFormat pixel_formats[] = {
>          AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE,
>      };
> -    return ff_set_common_formats_from_list(ctx, pixel_formats);
> +    AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats);
> +
> +    return ff_set_common_formats(ctx, pix_fmts);
>  }

ff_set_common_formats_from_list(ctx, pixel_formats) is a shortcut for
ff_set_common_formats(ctx, ff_make_format_list(pixel_formats)), so this
is not a functional change; it just adds more code duplication.

- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel at ffmpeg.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fffmpeg.org%2Fmailman%2Flistinfo%2Fffmpeg-devel&data=04%7C01%7Crarzumanyan%40nvidia.com%7C2d27e43ba73646720eb408d9871549ad%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637689348213495919%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=lcu8tWfQOz0ROcat8ipL9kYqp%2FJc5iw8EldqrG6EjdA%3D&reserved=0

To unsubscribe, visit link above, or email
ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libavfilter-scale_npp-scale2ref_npp-filter-added.patch
Type: text/x-patch
Size: 20943 bytes
Desc: 0001-libavfilter-scale_npp-scale2ref_npp-filter-added.patch
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20211004/f07476fa/attachment.bin>


More information about the ffmpeg-devel mailing list