From be8bc645b6b63c9bfdc4a4c3e256f3bae5133e2a Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 28 Sep 2021 00:27:44 +0200 Subject: [PATCH] avfilter/opencl: Store format in filter, remove query function Signed-off-by: Andreas Rheinhardt --- libavfilter/opencl.c | 10 ---------- libavfilter/opencl.h | 5 ----- libavfilter/vf_avgblur_opencl.c | 4 ++-- libavfilter/vf_colorkey_opencl.c | 2 +- libavfilter/vf_convolution_opencl.c | 8 ++++---- libavfilter/vf_deshake_opencl.c | 2 +- libavfilter/vf_neighbor_opencl.c | 4 ++-- libavfilter/vf_nlmeans_opencl.c | 2 +- libavfilter/vf_overlay_opencl.c | 2 +- libavfilter/vf_pad_opencl.c | 2 +- libavfilter/vf_program_opencl.c | 4 ++-- libavfilter/vf_tonemap_opencl.c | 2 +- libavfilter/vf_transpose_opencl.c | 2 +- libavfilter/vf_unsharp_opencl.c | 2 +- libavfilter/vf_xfade_opencl.c | 2 +- 15 files changed, 19 insertions(+), 34 deletions(-) diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c index f479182140..8174537c2b 100644 --- a/libavfilter/opencl.c +++ b/libavfilter/opencl.c @@ -25,16 +25,6 @@ #include "formats.h" #include "opencl.h" -int ff_opencl_filter_query_formats(AVFilterContext *avctx) -{ - const static enum AVPixelFormat pix_fmts[] = { - AV_PIX_FMT_OPENCL, - AV_PIX_FMT_NONE, - }; - - return ff_set_common_formats_from_list(avctx, pix_fmts); -} - static int opencl_filter_set_device(AVFilterContext *avctx, AVBufferRef *device) { diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h index 7487e60241..dec376766e 100644 --- a/libavfilter/opencl.h +++ b/libavfilter/opencl.h @@ -236,11 +236,6 @@ do { */ #define CL_CREATE_BUFFER(ctx, buffer_name, size) CL_CREATE_BUFFER_FLAGS(ctx, buffer_name, 0, size, NULL) -/** - * Return that all inputs and outputs support only AV_PIX_FMT_OPENCL. - */ -int ff_opencl_filter_query_formats(AVFilterContext *avctx); - /** * Check that the input link contains a suitable hardware frames * context and extract the device from it. diff --git a/libavfilter/vf_avgblur_opencl.c b/libavfilter/vf_avgblur_opencl.c index 241c312576..53cd1b8f48 100644 --- a/libavfilter/vf_avgblur_opencl.c +++ b/libavfilter/vf_avgblur_opencl.c @@ -347,7 +347,7 @@ const AVFilter ff_vf_avgblur_opencl = { .uninit = &avgblur_opencl_uninit, FILTER_INPUTS(avgblur_opencl_inputs), FILTER_OUTPUTS(avgblur_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -386,7 +386,7 @@ const AVFilter ff_vf_boxblur_opencl = { .uninit = &avgblur_opencl_uninit, FILTER_INPUTS(avgblur_opencl_inputs), FILTER_OUTPUTS(avgblur_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_colorkey_opencl.c b/libavfilter/vf_colorkey_opencl.c index d54dd86c21..84be1999a8 100644 --- a/libavfilter/vf_colorkey_opencl.c +++ b/libavfilter/vf_colorkey_opencl.c @@ -237,6 +237,6 @@ const AVFilter ff_vf_colorkey_opencl = { .uninit = &colorkey_opencl_uninit, FILTER_INPUTS(colorkey_opencl_inputs), FILTER_OUTPUTS(colorkey_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE }; diff --git a/libavfilter/vf_convolution_opencl.c b/libavfilter/vf_convolution_opencl.c index 3871ddcff4..d886c7aead 100644 --- a/libavfilter/vf_convolution_opencl.c +++ b/libavfilter/vf_convolution_opencl.c @@ -369,7 +369,7 @@ const AVFilter ff_vf_convolution_opencl = { .uninit = &convolution_opencl_uninit, FILTER_INPUTS(convolution_opencl_inputs), FILTER_OUTPUTS(convolution_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -395,7 +395,7 @@ const AVFilter ff_vf_sobel_opencl = { .uninit = &convolution_opencl_uninit, FILTER_INPUTS(convolution_opencl_inputs), FILTER_OUTPUTS(convolution_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -421,7 +421,7 @@ const AVFilter ff_vf_prewitt_opencl = { .uninit = &convolution_opencl_uninit, FILTER_INPUTS(convolution_opencl_inputs), FILTER_OUTPUTS(convolution_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -447,7 +447,7 @@ const AVFilter ff_vf_roberts_opencl = { .uninit = &convolution_opencl_uninit, FILTER_INPUTS(convolution_opencl_inputs), FILTER_OUTPUTS(convolution_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_deshake_opencl.c b/libavfilter/vf_deshake_opencl.c index 848f4a4f30..9c761ba5ad 100644 --- a/libavfilter/vf_deshake_opencl.c +++ b/libavfilter/vf_deshake_opencl.c @@ -2195,6 +2195,6 @@ const AVFilter ff_vf_deshake_opencl = { .activate = activate, FILTER_INPUTS(deshake_opencl_inputs), FILTER_OUTPUTS(deshake_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE }; diff --git a/libavfilter/vf_neighbor_opencl.c b/libavfilter/vf_neighbor_opencl.c index 93c5fbbadc..98b04b2852 100644 --- a/libavfilter/vf_neighbor_opencl.c +++ b/libavfilter/vf_neighbor_opencl.c @@ -280,7 +280,7 @@ const AVFilter ff_vf_erosion_opencl = { .uninit = &neighbor_opencl_uninit, FILTER_INPUTS(neighbor_opencl_inputs), FILTER_OUTPUTS(neighbor_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -306,9 +306,9 @@ const AVFilter ff_vf_dilation_opencl = { .priv_class = &dilation_opencl_class, .init = &ff_opencl_filter_init, .uninit = &neighbor_opencl_uninit, - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), FILTER_INPUTS(neighbor_opencl_inputs), FILTER_OUTPUTS(neighbor_opencl_outputs), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_nlmeans_opencl.c b/libavfilter/vf_nlmeans_opencl.c index 6d6ac8136c..c0ac8bf95d 100644 --- a/libavfilter/vf_nlmeans_opencl.c +++ b/libavfilter/vf_nlmeans_opencl.c @@ -436,6 +436,6 @@ const AVFilter ff_vf_nlmeans_opencl = { .uninit = &nlmeans_opencl_uninit, FILTER_INPUTS(nlmeans_opencl_inputs), FILTER_OUTPUTS(nlmeans_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_overlay_opencl.c b/libavfilter/vf_overlay_opencl.c index b17b60c980..1e3ad903e1 100644 --- a/libavfilter/vf_overlay_opencl.c +++ b/libavfilter/vf_overlay_opencl.c @@ -320,6 +320,6 @@ const AVFilter ff_vf_overlay_opencl = { .activate = &overlay_opencl_activate, FILTER_INPUTS(overlay_opencl_inputs), FILTER_OUTPUTS(overlay_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_pad_opencl.c b/libavfilter/vf_pad_opencl.c index 4e52556e9e..728e850f72 100644 --- a/libavfilter/vf_pad_opencl.c +++ b/libavfilter/vf_pad_opencl.c @@ -390,6 +390,6 @@ const AVFilter ff_vf_pad_opencl = { .uninit = &pad_opencl_uninit, FILTER_INPUTS(pad_opencl_inputs), FILTER_OUTPUTS(pad_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE }; diff --git a/libavfilter/vf_program_opencl.c b/libavfilter/vf_program_opencl.c index 7615e5c7c7..5f3c71d95b 100644 --- a/libavfilter/vf_program_opencl.c +++ b/libavfilter/vf_program_opencl.c @@ -367,7 +367,7 @@ const AVFilter ff_vf_program_opencl = { .activate = &program_opencl_activate, .inputs = NULL, FILTER_OUTPUTS(program_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -417,7 +417,7 @@ const AVFilter ff_vsrc_openclsrc = { .uninit = &program_opencl_uninit, .inputs = NULL, FILTER_OUTPUTS(openclsrc_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c index 0e65f16234..121ef7d6f4 100644 --- a/libavfilter/vf_tonemap_opencl.c +++ b/libavfilter/vf_tonemap_opencl.c @@ -546,6 +546,6 @@ const AVFilter ff_vf_tonemap_opencl = { .uninit = &tonemap_opencl_uninit, FILTER_INPUTS(tonemap_opencl_inputs), FILTER_OUTPUTS(tonemap_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_transpose_opencl.c b/libavfilter/vf_transpose_opencl.c index c275a7d08e..c6e8bd2f53 100644 --- a/libavfilter/vf_transpose_opencl.c +++ b/libavfilter/vf_transpose_opencl.c @@ -279,6 +279,6 @@ const AVFilter ff_vf_transpose_opencl = { .uninit = &transpose_opencl_uninit, FILTER_INPUTS(transpose_opencl_inputs), FILTER_OUTPUTS(transpose_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_unsharp_opencl.c b/libavfilter/vf_unsharp_opencl.c index d8c0c8dc3b..53e310de09 100644 --- a/libavfilter/vf_unsharp_opencl.c +++ b/libavfilter/vf_unsharp_opencl.c @@ -405,6 +405,6 @@ const AVFilter ff_vf_unsharp_opencl = { .uninit = &unsharp_opencl_uninit, FILTER_INPUTS(unsharp_opencl_inputs), FILTER_OUTPUTS(unsharp_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/libavfilter/vf_xfade_opencl.c b/libavfilter/vf_xfade_opencl.c index f8d90a483f..cca4980e01 100644 --- a/libavfilter/vf_xfade_opencl.c +++ b/libavfilter/vf_xfade_opencl.c @@ -431,6 +431,6 @@ const AVFilter ff_vf_xfade_opencl = { .activate = &xfade_opencl_activate, FILTER_INPUTS(xfade_opencl_inputs), FILTER_OUTPUTS(xfade_opencl_outputs), - FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, };