Message ID | 20211125090842.4067876-2-jianhua.wu@intel.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v3,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 |
25 Nov 2021, 10:22 by ffmpeg@gyani.pro: > > > On 2021-11-25 02:38 pm, Wu Jianhua wrote: > >> 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. >> > > bflip is not an intuitive name. > > Either hvflip, or since h+v flip == 180 deg rotation, maybe rotate180 or rot180 > > Regards, > Gyan > I think I'd prefer if it was called 'transpose_vulkan', with the same options as the regular transpose filter, but with only a single direction currently supported. That way, we'd have a template to which we could implement more modes later on.
Lynne: > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of > Lynne > Sent: Thursday, November 25, 2021 5:33 PM > To: FFmpeg development discussions and patches <ffmpeg- > devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] avfilter: add a bflip_vulkan filter > > 25 Nov 2021, 10:22 by ffmpeg@gyani.pro: > > > > > > > On 2021-11-25 02:38 pm, Wu Jianhua wrote: > > > >> 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. > >> > > > > bflip is not an intuitive name. > > > > Either hvflip, or since h+v flip == 180 deg rotation, maybe rotate180 > > or rot180 > > > > Regards, > > Gyan > > > > I think I'd prefer if it was called 'transpose_vulkan', with the same options as > the regular transpose filter, but with only a single direction currently > supported. > That way, we'd have a template to which we could implement more modes > later on. > Does transpose only indicate switches the row and column indices? Ummm..I'm not sure. Maybe rotate 180 is more better. Thanks, Jianhua
25 Nov 2021, 10:39 by jianhua.wu@intel.com: > Lynne: > >> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of >> Lynne >> Sent: Thursday, November 25, 2021 5:33 PM >> To: FFmpeg development discussions and patches <ffmpeg- >> devel@ffmpeg.org> >> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] avfilter: add a bflip_vulkan filter >> >> 25 Nov 2021, 10:22 by ffmpeg@gyani.pro: >> >> > >> > >> > On 2021-11-25 02:38 pm, Wu Jianhua wrote: >> > >> >> 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. >> >> >> > >> > bflip is not an intuitive name. >> > >> > Either hvflip, or since h+v flip == 180 deg rotation, maybe rotate180 >> > or rot180 >> > >> > Regards, >> > Gyan >> > >> >> I think I'd prefer if it was called 'transpose_vulkan', with the same options as >> the regular transpose filter, but with only a single direction currently >> supported. >> That way, we'd have a template to which we could implement more modes >> later on. >> > > Does transpose only indicate switches the row and column indices? Ummm..I'm not sure. > Maybe rotate 180 is more better. > You're right, transpose only does flips by 90 degrees. I think you should just call it 'flip_vulkan' in this case.
On 2021-11-25 03:28 pm, Lynne wrote: > 25 Nov 2021, 10:39 by jianhua.wu@intel.com: > >> Lynne: >> >>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of >>> Lynne >>> Sent: Thursday, November 25, 2021 5:33 PM >>> To: FFmpeg development discussions and patches <ffmpeg- >>> devel@ffmpeg.org> >>> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] avfilter: add a bflip_vulkan filter >>> >>> 25 Nov 2021, 10:22 by ffmpeg@gyani.pro: >>> >>>> >>>> On 2021-11-25 02:38 pm, Wu Jianhua wrote: >>>> >>>>> 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. >>>>> >>>> bflip is not an intuitive name. >>>> >>>> Either hvflip, or since h+v flip == 180 deg rotation, maybe rotate180 >>>> or rot180 >>>> >>>> Regards, >>>> Gyan >>>> >>> I think I'd prefer if it was called 'transpose_vulkan', with the same options as >>> the regular transpose filter, but with only a single direction currently >>> supported. >>> That way, we'd have a template to which we could implement more modes >>> later on. >>> >> Does transpose only indicate switches the row and column indices? Ummm..I'm not sure. >> Maybe rotate 180 is more better. >> > You're right, transpose only does flips by 90 degrees. > I think you should just call it 'flip_vulkan' in this case. That name indicates a generic filter with option to choose flip type. If that's the plan, apt name, but else something specific is clearer. Regards, Gyan
diff --git a/configure b/configure index d068b11073..a7562b53c3 100755 --- a/configure +++ b/configure @@ -3569,6 +3569,7 @@ atempo_filter_select="rdft" avgblur_opencl_filter_deps="opencl" avgblur_vulkan_filter_deps="vulkan spirv_compiler" azmq_filter_deps="libzmq" +bflip_vulkan_filter_deps="vulkan spirv_compiler" blackframe_filter_deps="gpl" bm3d_filter_deps="avcodec" bm3d_filter_select="dct" diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 4bf17ef292..041292853a 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -175,6 +175,7 @@ extern const AVFilter ff_vf_avgblur_opencl; extern const AVFilter ff_vf_avgblur_vulkan; extern const AVFilter ff_vf_bbox; extern const AVFilter ff_vf_bench; +extern const AVFilter ff_vf_bflip_vulkan; extern const AVFilter ff_vf_bilateral; extern const AVFilter ff_vf_bitplanenoise; extern const AVFilter ff_vf_blackdetect; diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c index e9e04db91b..e20766e9ed 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; @@ -267,6 +271,11 @@ static int vflip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) return flip_vulkan_filter_frame(link, in, FLIP_VERTICAL); } +static int bflip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) +{ + return flip_vulkan_filter_frame(link, in, FLIP_BOTH); +} + static const AVOption hflip_vulkan_options[] = { { NULL }, }; @@ -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 bflip_vulkan_options[] = { + { NULL }, +}; + +AVFILTER_DEFINE_CLASS(bflip_vulkan); + +static const AVFilterPad bflip_vulkan_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .filter_frame = &bflip_vulkan_filter_frame, + .config_props = &ff_vk_filter_config_input, + } +}; + +const AVFilter ff_vf_bflip_vulkan = { + .name = "bflip_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(bflip_vulkan_inputs), + FILTER_OUTPUTS(flip_vulkan_outputs), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VULKAN), + .priv_class = &bflip_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 | 39 +++++++++++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 1 deletion(-)