[FFmpeg-devel] [PATCH v2 1/2] avfilter: add a hflip_vulkan filter

Paul B Mahol onemda at gmail.com
Thu Nov 18 12:24:26 EET 2021


On Thu, Nov 18, 2021 at 6:27 AM Andreas Rheinhardt <
andreas.rheinhardt at outlook.com> wrote:

> Wu, Jianhua:
> > Andreas Rheinhardt wrote:
> >> Wu Jianhua:
> >>> The following command is on how to apply hflip_vulkan filter:
> >>>
> >>> ffmpeg -init_hw_device vulkan -i input.264 -vf
> >>>
> >> hwupload=extra_hw_frames=16,hflip_vulkan,hwdownload,format=yuv420p
> >>> output.264
> >>>
> >>> Signed-off-by: Wu Jianhua <jianhua.wu at intel.com>
> >>> ---
> >>>  configure                     |   1 +
> >>>  libavfilter/Makefile          |   1 +
> >>>  libavfilter/allfilters.c      |   1 +
> >>>  libavfilter/vf_hflip_vulkan.c | 276
> >>> ++++++++++++++++++++++++++++++++++
> >>>  4 files changed, 279 insertions(+)
> >>>  create mode 100644 libavfilter/vf_hflip_vulkan.c
> >>>
> >>
> >>> +
> >>> +static const AVOption hflip_vulkan_options[] = {
> >>> +    { NULL },
> >>> +};
> >>> +
> >>> +AVFILTER_DEFINE_CLASS(hflip_vulkan);
> >>> +
> >>
> >> What is the point of this class with its empty options?
> >
> > The AVFILTER_DEFINE_CLASS needs the hflip_vulkan_options and the reason
> why it's NULL
> > is that the most other filters do it like that.
> >
>
> And why do you add an AVClass at all?
> (The reason that there are some filters with AVClass and empty options
> is a bug in avfilter_init_str() which errors out when given options for
> a filter without AVClass, although it is perfectly fine to set options
> on a filter without AVClass, namely generic AVFilter options (this is
> important for e.g. framesync filters, but not for this filter here).)
>

There are abandoned patches of yours that resolved this.

>
> >>
> >>> +static const AVFilterPad hflip_vulkan_inputs[] = {
> >>> +    {
> >>> +        .name         = "default",
> >>> +        .type         = AVMEDIA_TYPE_VIDEO,
> >>> +        .filter_frame = &hflip_vulkan_filter_frame,
> >>> +        .config_props = &ff_vk_filter_config_input,
> >>> +    }
> >>> +};
> >>> +
> >>> +static const AVFilterPad hflip_vulkan_outputs[] = {
> >>> +    {
> >>> +        .name         = "default",
> >>> +        .type         = AVMEDIA_TYPE_VIDEO,
> >>> +        .config_props = &ff_vk_filter_config_output,
> >>> +    }
> >>> +};
> >>> +
> >>> +const AVFilter ff_vf_hflip_vulkan = {
> >>> +    .name           = "hflip_vulkan",
> >>> +    .description    = NULL_IF_CONFIG_SMALL("Horizontally flip the
> input
> >> video in Vulkan"),
> >>> +    .priv_size      = sizeof(HFlipVulkanContext),
> >>> +    .init           = &ff_vk_filter_init,
> >>> +    .uninit         = &hflip_vulkan_uninit,
> >>> +    FILTER_INPUTS(hflip_vulkan_inputs),
> >>> +    FILTER_OUTPUTS(hflip_vulkan_outputs),
> >>> +    FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VULKAN),
> >>> +    .priv_class     = &hflip_vulkan_class,
> >>> +    .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, };
> >>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list