Message ID | 20211126091057.118653-2-jianhua.wu@intel.com |
---|---|
State | Accepted |
Commit | bdfb0e4da414c0ff4c663fa077b15730b44482df |
Headers | show |
Series | [FFmpeg-devel,v4,1/2] avutil/hwcontext_vulkan: fully support customizable validation layers | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
26 Nov 2021, 10:10 by jianhua.wu@intel.com: > This filter flips the input video both horizontally and vertically > in one compute pipeline, and it's no need to use two pipelines for > hflip_vulkan,vflip_vulkan anymore. > > Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> > --- > configure | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vf_flip_vulkan.c | 61 +++++++++++++++++++++++++++++------- > 3 files changed, 51 insertions(+), 12 deletions(-) > I'll push this tonight if there are no further objections to the name.
On 2021-11-26 03:08 pm, Lynne wrote: > 26 Nov 2021, 10:10 by jianhua.wu@intel.com: > >> This filter flips the input video both horizontally and vertically >> in one compute pipeline, and it's no need to use two pipelines for >> hflip_vulkan,vflip_vulkan anymore. >> >> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> >> --- >> configure | 1 + >> libavfilter/allfilters.c | 1 + >> libavfilter/vf_flip_vulkan.c | 61 +++++++++++++++++++++++++++++------- >> 3 files changed, 51 insertions(+), 12 deletions(-) >> > I'll push this tonight if there are no further objections to the name. Will other flip modes be added to this filter? > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
26 Nov 2021, 11:37 by ffmpeg@gyani.pro: > > > On 2021-11-26 03:08 pm, Lynne wrote: > >> 26 Nov 2021, 10:10 by jianhua.wu@intel.com: >> >>> This filter flips the input video both horizontally and vertically >>> in one compute pipeline, and it's no need to use two pipelines for >>> hflip_vulkan,vflip_vulkan anymore. >>> >>> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> >>> --- >>> configure | 1 + >>> libavfilter/allfilters.c | 1 + >>> libavfilter/vf_flip_vulkan.c | 61 +++++++++++++++++++++++++++++------- >>> 3 files changed, 51 insertions(+), 12 deletions(-) >>> >> I'll push this tonight if there are no further objections to the name. >> > > Will other flip modes be added to this filter? > No. Other flip modes are already separate filters, and transposition would be another filter. Our transpose filter doesn't support flipping the image, and to keep options compatible between software and hardware filters, we can't add it. So the most appropriate filter for this is a standalone one. I agree the name isn't perfect. Maybe we can add a note in the description this is equivalent to 180-degree rotation.
On 2021-11-26 04:33 pm, Lynne wrote: > 26 Nov 2021, 11:37 by ffmpeg@gyani.pro: > >> >> On 2021-11-26 03:08 pm, Lynne wrote: >> >>> 26 Nov 2021, 10:10 by jianhua.wu@intel.com: >>> >>>> This filter flips the input video both horizontally and vertically >>>> in one compute pipeline, and it's no need to use two pipelines for >>>> hflip_vulkan,vflip_vulkan anymore. >>>> >>>> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> >>>> --- >>>> configure | 1 + >>>> libavfilter/allfilters.c | 1 + >>>> libavfilter/vf_flip_vulkan.c | 61 +++++++++++++++++++++++++++++------- >>>> 3 files changed, 51 insertions(+), 12 deletions(-) >>>> >>> I'll push this tonight if there are no further objections to the name. >>> >> Will other flip modes be added to this filter? >> > No. Other flip modes are already separate filters, and transposition > would be another filter. Our transpose filter doesn't support flipping > the image, and to keep options compatible between software and > hardware filters, we can't add it. So the most appropriate filter for > this is a standalone one. If modes can be added, you can add them here, and deprecate the single mode variants. Since these filters are very new, there are no legacy users to accommodate and now would be the best time they come become present in a release branch. Regards, Gyan
26 Nov 2021, 12:20 by ffmpeg@gyani.pro: > > > On 2021-11-26 04:33 pm, Lynne wrote: > >> 26 Nov 2021, 11:37 by ffmpeg@gyani.pro: >> >>> >>> On 2021-11-26 03:08 pm, Lynne wrote: >>> >>>> 26 Nov 2021, 10:10 by jianhua.wu@intel.com: >>>> >>>>> This filter flips the input video both horizontally and vertically >>>>> in one compute pipeline, and it's no need to use two pipelines for >>>>> hflip_vulkan,vflip_vulkan anymore. >>>>> >>>>> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> >>>>> --- >>>>> configure | 1 + >>>>> libavfilter/allfilters.c | 1 + >>>>> libavfilter/vf_flip_vulkan.c | 61 +++++++++++++++++++++++++++++------- >>>>> 3 files changed, 51 insertions(+), 12 deletions(-) >>>>> >>>> I'll push this tonight if there are no further objections to the name. >>>> >>> Will other flip modes be added to this filter? >>> >> No. Other flip modes are already separate filters, and transposition >> would be another filter. Our transpose filter doesn't support flipping >> the image, and to keep options compatible between software and >> hardware filters, we can't add it. So the most appropriate filter for >> this is a standalone one. >> > > If modes can be added, you can add them here, and deprecate the single mode variants. > Since these filters are very new, there are no legacy users to accommodate and now would be the best time they come become present in a release branch. > There are no more modes to be added, flipping != transpose != rotate, according to ffmpeg nomenclature, since we have separate filters for each.
Lynne: >>ffmpeg@gyani.pro: >>> On 2021-11-26 04:33 pm, Lynne wrote: >>> >>>> 26 Nov 2021, 11:37 by ffmpeg@gyani.pro: >>>> >>>>> >>>>> On 2021-11-26 03:08 pm, Lynne wrote: >>>>> >>>>>> 26 Nov 2021, 10:10 by jianhua.wu@intel.com: >>>>>> >>>>>> This filter flips the input video both horizontally and vertically >>>>>> in one compute pipeline, and it's no need to use two pipelines for >>>>>> hflip_vulkan,vflip_vulkan anymore. >>>>>> >>>>>> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> >>>>>> --- >>>>>> configure | 1 + >>>>>> libavfilter/allfilters.c | 1 + >>>>>> libavfilter/vf_flip_vulkan.c | 61 +++++++++++++++++++++++++++++------- >>>>>> 3 files changed, 51 insertions(+), 12 deletions(-) >>>>>> >>>>> I'll push this tonight if there are no further objections to the name. >>>>> >>>> Will other flip modes be added to this filter? >>>> Hi Gyan: There are no more flip modes anymore. I add this filter is inspired by OpenCV, which offers three flip modes for horizontal, vertical, and both. When a person specifies hflip, it means that he is desired on horizontal flipping. If the flip is specified without 'v' or 'h', it means there is no desire on specifying the direction. So, I think it may be fine to use flip for both directions then we don't need to construct a new name. Thanks, Jianhua >>> No. Other flip modes are already separate filters, and transposition >>> would be another filter. Our transpose filter doesn't support flipping >>> the image, and to keep options compatible between software and >>> hardware filters, we can't add it. So the most appropriate filter for >>> this is a standalone one. >>> >> >> If modes can be added, you can add them here, and deprecate the single mode variants. >> Since these filters are very new, there are no legacy users to accommodate and now would be the best time they come become present in a release branch. >> > >There are no more modes to be added, flipping != transpose != rotate, >according to ffmpeg nomenclature, since we have separate filters for each. >
Ping. > Wu Jianhua: > Lynne: > >>ffmpeg@gyani.pro: > >>> On 2021-11-26 04:33 pm, Lynne wrote: > >>> > >>>> 26 Nov 2021, 11:37 by ffmpeg@gyani.pro: > >>>> > >>>>> > >>>>> On 2021-11-26 03:08 pm, Lynne wrote: > >>>>> > >>>>>> 26 Nov 2021, 10:10 by jianhua.wu@intel.com: > >>>>>> > >>>>>> This filter flips the input video both horizontally and > >>>>>> vertically in one compute pipeline, and it's no need to use two > >>>>>> pipelines for hflip_vulkan,vflip_vulkan anymore. > >>>>>> > >>>>>> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> > >>>>>> --- > >>>>>> configure | 1 + > >>>>>> libavfilter/allfilters.c | 1 + > >>>>>> libavfilter/vf_flip_vulkan.c | 61 > >>>>>> +++++++++++++++++++++++++++++------- > >>>>>> 3 files changed, 51 insertions(+), 12 deletions(-) > >>>>>> > >>>>> I'll push this tonight if there are no further objections to the name. > >>>>> > >>>> Will other flip modes be added to this filter? > >>>> > > Hi Gyan: > > There are no more flip modes anymore. I add this filter is inspired by OpenCV, > which offers three flip modes for horizontal, vertical, and both. When a > person specifies hflip, it means that he is desired on horizontal flipping. If the > flip is specified without 'v' or 'h', it means there is no desire on specifying the > direction. So, I think it may be fine to use flip for both directions then we > don't need to construct a new name. > > Thanks, > Jianhua > > >>> No. Other flip modes are already separate filters, and transposition > >>> would be another filter. Our transpose filter doesn't support > >>> flipping the image, and to keep options compatible between software > >>> and hardware filters, we can't add it. So the most appropriate > >>> filter for this is a standalone one. > >>> > >> > >> If modes can be added, you can add them here, and deprecate the single > mode variants. > >> Since these filters are very new, there are no legacy users to > accommodate and now would be the best time they come become present > in a release branch. > >> > > > >There are no more modes to be added, flipping != transpose != rotate, > >according to ffmpeg nomenclature, since we have separate filters for each. > > > Hi there, Any update?
2 Dec 2021, 03:18 by jianhua.wu@intel.com: > Ping. > >> Wu Jianhua: >> Lynne: >> >>ffmpeg@gyani.pro: >> >>> On 2021-11-26 04:33 pm, Lynne wrote: >> >>> >> >>>> 26 Nov 2021, 11:37 by ffmpeg@gyani.pro: >> >>>> >> >>>>> >> >>>>> On 2021-11-26 03:08 pm, Lynne wrote: >> >>>>> >> >>>>>> 26 Nov 2021, 10:10 by jianhua.wu@intel.com: >> >>>>>> >> >>>>>> This filter flips the input video both horizontally and >> >>>>>> vertically in one compute pipeline, and it's no need to use two >> >>>>>> pipelines for hflip_vulkan,vflip_vulkan anymore. >> >>>>>> >> >>>>>> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> >> >>>>>> --- >> >>>>>> configure | 1 + >> >>>>>> libavfilter/allfilters.c | 1 + >> >>>>>> libavfilter/vf_flip_vulkan.c | 61 >> >>>>>> +++++++++++++++++++++++++++++------- >> >>>>>> 3 files changed, 51 insertions(+), 12 deletions(-) >> >>>>>> >> >>>>> I'll push this tonight if there are no further objections to the name. >> >>>>> >> >>>> Will other flip modes be added to this filter? >> >>>> >> >> Hi Gyan: >> >> There are no more flip modes anymore. I add this filter is inspired by OpenCV, >> which offers three flip modes for horizontal, vertical, and both. When a >> person specifies hflip, it means that he is desired on horizontal flipping. If the >> flip is specified without 'v' or 'h', it means there is no desire on specifying the >> direction. So, I think it may be fine to use flip for both directions then we >> don't need to construct a new name. >> >> Thanks, >> Jianhua >> >> >>> No. Other flip modes are already separate filters, and transposition >> >>> would be another filter. Our transpose filter doesn't support >> >>> flipping the image, and to keep options compatible between software >> >>> and hardware filters, we can't add it. So the most appropriate >> >>> filter for this is a standalone one. >> >>> >> >> >> >> If modes can be added, you can add them here, and deprecate the single >> mode variants. >> >> Since these filters are very new, there are no legacy users to >> accommodate and now would be the best time they come become present >> in a release branch. >> >> >> > >> >There are no more modes to be added, flipping != transpose != rotate, >> >according to ffmpeg nomenclature, since we have separate filters for each. >> > >> > > Hi there, > > Any update? > Sorry, forgot to push. Applied, thanks.
diff --git a/configure b/configure index d068b11073..7112d830c9 100755 --- a/configure +++ b/configure @@ -3608,6 +3608,7 @@ fftdnoiz_filter_select="fft" find_rect_filter_deps="avcodec avformat gpl" firequalizer_filter_deps="avcodec" firequalizer_filter_select="rdft" +flip_vulkan_filter_deps="vulkan spirv_compiler" flite_filter_deps="libflite" framerate_filter_select="scene_sad" freezedetect_filter_select="scene_sad" diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 4bf17ef292..e014833bea 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -263,6 +263,7 @@ extern const AVFilter ff_vf_fieldmatch; extern const AVFilter ff_vf_fieldorder; extern const AVFilter ff_vf_fillborders; extern const AVFilter ff_vf_find_rect; +extern const AVFilter ff_vf_flip_vulkan; extern const AVFilter ff_vf_floodfill; extern const AVFilter ff_vf_format; extern const AVFilter ff_vf_fps; diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c index e9e04db91b..0223786ef1 100644 --- a/libavfilter/vf_flip_vulkan.c +++ b/libavfilter/vf_flip_vulkan.c @@ -26,7 +26,8 @@ enum FlipType { FLIP_VERTICAL, - FLIP_HORIZONTAL + FLIP_HORIZONTAL, + FLIP_BOTH }; typedef struct FlipVulkanContext { @@ -104,6 +105,9 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType case FLIP_VERTICAL: GLSLF(2, vec4 res = texture(input_image[%i], ivec2(pos.x, size.y - pos.y)); ,i); break; + case FLIP_BOTH: + GLSLF(2, vec4 res = texture(input_image[%i], ivec2(size.xy - pos.xy));, i); + break; default: GLSLF(2, vec4 res = texture(input_image[%i], pos); ,i); break; @@ -226,7 +230,7 @@ fail: return err; } -static int flip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in, enum FlipType type) +static int filter_frame(AVFilterLink *link, AVFrame *in, enum FlipType type) { int err; AVFrame *out = NULL; @@ -259,14 +263,27 @@ fail: static int hflip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) { - return flip_vulkan_filter_frame(link, in, FLIP_HORIZONTAL); + return filter_frame(link, in, FLIP_HORIZONTAL); } static int vflip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) { - return flip_vulkan_filter_frame(link, in, FLIP_VERTICAL); + return filter_frame(link, in, FLIP_VERTICAL); } +static int flip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) +{ + return filter_frame(link, in, FLIP_BOTH); +} + +static const AVFilterPad flip_vulkan_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = &ff_vk_filter_config_output, + } +}; + static const AVOption hflip_vulkan_options[] = { { NULL }, }; @@ -282,14 +299,6 @@ static const AVFilterPad hflip_vulkan_inputs[] = { } }; -static const AVFilterPad flip_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"), @@ -330,3 +339,31 @@ const AVFilter ff_vf_vflip_vulkan = { .priv_class = &vflip_vulkan_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; + +static const AVOption flip_vulkan_options[] = { + { NULL }, +}; + +AVFILTER_DEFINE_CLASS(flip_vulkan); + +static const AVFilterPad flip_vulkan_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .filter_frame = &flip_vulkan_filter_frame, + .config_props = &ff_vk_filter_config_input, + } +}; + +const AVFilter ff_vf_flip_vulkan = { + .name = "flip_vulkan", + .description = NULL_IF_CONFIG_SMALL("Flip both horizontally and vertically"), + .priv_size = sizeof(FlipVulkanContext), + .init = &ff_vk_filter_init, + .uninit = &flip_vulkan_uninit, + FILTER_INPUTS(flip_vulkan_inputs), + FILTER_OUTPUTS(flip_vulkan_outputs), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VULKAN), + .priv_class = &flip_vulkan_class, + .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, +};
This filter flips the input video both horizontally and vertically in one compute pipeline, and it's no need to use two pipelines for hflip_vulkan,vflip_vulkan anymore. Signed-off-by: Wu Jianhua <jianhua.wu@intel.com> --- configure | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_flip_vulkan.c | 61 +++++++++++++++++++++++++++++------- 3 files changed, 51 insertions(+), 12 deletions(-)