You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avfilter/opencl: Store format in filter, remove query function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -25,16 +25,6 @@
|
|||||||
#include "formats.h"
|
#include "formats.h"
|
||||||
#include "opencl.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,
|
static int opencl_filter_set_device(AVFilterContext *avctx,
|
||||||
AVBufferRef *device)
|
AVBufferRef *device)
|
||||||
{
|
{
|
||||||
|
@@ -236,11 +236,6 @@ do {
|
|||||||
*/
|
*/
|
||||||
#define CL_CREATE_BUFFER(ctx, buffer_name, size) CL_CREATE_BUFFER_FLAGS(ctx, buffer_name, 0, size, NULL)
|
#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
|
* Check that the input link contains a suitable hardware frames
|
||||||
* context and extract the device from it.
|
* context and extract the device from it.
|
||||||
|
@@ -347,7 +347,7 @@ const AVFilter ff_vf_avgblur_opencl = {
|
|||||||
.uninit = &avgblur_opencl_uninit,
|
.uninit = &avgblur_opencl_uninit,
|
||||||
FILTER_INPUTS(avgblur_opencl_inputs),
|
FILTER_INPUTS(avgblur_opencl_inputs),
|
||||||
FILTER_OUTPUTS(avgblur_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -386,7 +386,7 @@ const AVFilter ff_vf_boxblur_opencl = {
|
|||||||
.uninit = &avgblur_opencl_uninit,
|
.uninit = &avgblur_opencl_uninit,
|
||||||
FILTER_INPUTS(avgblur_opencl_inputs),
|
FILTER_INPUTS(avgblur_opencl_inputs),
|
||||||
FILTER_OUTPUTS(avgblur_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -237,6 +237,6 @@ const AVFilter ff_vf_colorkey_opencl = {
|
|||||||
.uninit = &colorkey_opencl_uninit,
|
.uninit = &colorkey_opencl_uninit,
|
||||||
FILTER_INPUTS(colorkey_opencl_inputs),
|
FILTER_INPUTS(colorkey_opencl_inputs),
|
||||||
FILTER_OUTPUTS(colorkey_opencl_outputs),
|
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
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE
|
||||||
};
|
};
|
||||||
|
@@ -369,7 +369,7 @@ const AVFilter ff_vf_convolution_opencl = {
|
|||||||
.uninit = &convolution_opencl_uninit,
|
.uninit = &convolution_opencl_uninit,
|
||||||
FILTER_INPUTS(convolution_opencl_inputs),
|
FILTER_INPUTS(convolution_opencl_inputs),
|
||||||
FILTER_OUTPUTS(convolution_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ const AVFilter ff_vf_sobel_opencl = {
|
|||||||
.uninit = &convolution_opencl_uninit,
|
.uninit = &convolution_opencl_uninit,
|
||||||
FILTER_INPUTS(convolution_opencl_inputs),
|
FILTER_INPUTS(convolution_opencl_inputs),
|
||||||
FILTER_OUTPUTS(convolution_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -421,7 +421,7 @@ const AVFilter ff_vf_prewitt_opencl = {
|
|||||||
.uninit = &convolution_opencl_uninit,
|
.uninit = &convolution_opencl_uninit,
|
||||||
FILTER_INPUTS(convolution_opencl_inputs),
|
FILTER_INPUTS(convolution_opencl_inputs),
|
||||||
FILTER_OUTPUTS(convolution_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ const AVFilter ff_vf_roberts_opencl = {
|
|||||||
.uninit = &convolution_opencl_uninit,
|
.uninit = &convolution_opencl_uninit,
|
||||||
FILTER_INPUTS(convolution_opencl_inputs),
|
FILTER_INPUTS(convolution_opencl_inputs),
|
||||||
FILTER_OUTPUTS(convolution_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2195,6 +2195,6 @@ const AVFilter ff_vf_deshake_opencl = {
|
|||||||
.activate = activate,
|
.activate = activate,
|
||||||
FILTER_INPUTS(deshake_opencl_inputs),
|
FILTER_INPUTS(deshake_opencl_inputs),
|
||||||
FILTER_OUTPUTS(deshake_opencl_outputs),
|
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
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE
|
||||||
};
|
};
|
||||||
|
@@ -280,7 +280,7 @@ const AVFilter ff_vf_erosion_opencl = {
|
|||||||
.uninit = &neighbor_opencl_uninit,
|
.uninit = &neighbor_opencl_uninit,
|
||||||
FILTER_INPUTS(neighbor_opencl_inputs),
|
FILTER_INPUTS(neighbor_opencl_inputs),
|
||||||
FILTER_OUTPUTS(neighbor_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -306,9 +306,9 @@ const AVFilter ff_vf_dilation_opencl = {
|
|||||||
.priv_class = &dilation_opencl_class,
|
.priv_class = &dilation_opencl_class,
|
||||||
.init = &ff_opencl_filter_init,
|
.init = &ff_opencl_filter_init,
|
||||||
.uninit = &neighbor_opencl_uninit,
|
.uninit = &neighbor_opencl_uninit,
|
||||||
FILTER_QUERY_FUNC(&ff_opencl_filter_query_formats),
|
|
||||||
FILTER_INPUTS(neighbor_opencl_inputs),
|
FILTER_INPUTS(neighbor_opencl_inputs),
|
||||||
FILTER_OUTPUTS(neighbor_opencl_outputs),
|
FILTER_OUTPUTS(neighbor_opencl_outputs),
|
||||||
|
FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL),
|
||||||
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -436,6 +436,6 @@ const AVFilter ff_vf_nlmeans_opencl = {
|
|||||||
.uninit = &nlmeans_opencl_uninit,
|
.uninit = &nlmeans_opencl_uninit,
|
||||||
FILTER_INPUTS(nlmeans_opencl_inputs),
|
FILTER_INPUTS(nlmeans_opencl_inputs),
|
||||||
FILTER_OUTPUTS(nlmeans_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
@@ -320,6 +320,6 @@ const AVFilter ff_vf_overlay_opencl = {
|
|||||||
.activate = &overlay_opencl_activate,
|
.activate = &overlay_opencl_activate,
|
||||||
FILTER_INPUTS(overlay_opencl_inputs),
|
FILTER_INPUTS(overlay_opencl_inputs),
|
||||||
FILTER_OUTPUTS(overlay_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
@@ -390,6 +390,6 @@ const AVFilter ff_vf_pad_opencl = {
|
|||||||
.uninit = &pad_opencl_uninit,
|
.uninit = &pad_opencl_uninit,
|
||||||
FILTER_INPUTS(pad_opencl_inputs),
|
FILTER_INPUTS(pad_opencl_inputs),
|
||||||
FILTER_OUTPUTS(pad_opencl_outputs),
|
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
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE
|
||||||
};
|
};
|
||||||
|
@@ -367,7 +367,7 @@ const AVFilter ff_vf_program_opencl = {
|
|||||||
.activate = &program_opencl_activate,
|
.activate = &program_opencl_activate,
|
||||||
.inputs = NULL,
|
.inputs = NULL,
|
||||||
FILTER_OUTPUTS(program_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -417,7 +417,7 @@ const AVFilter ff_vsrc_openclsrc = {
|
|||||||
.uninit = &program_opencl_uninit,
|
.uninit = &program_opencl_uninit,
|
||||||
.inputs = NULL,
|
.inputs = NULL,
|
||||||
FILTER_OUTPUTS(openclsrc_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -546,6 +546,6 @@ const AVFilter ff_vf_tonemap_opencl = {
|
|||||||
.uninit = &tonemap_opencl_uninit,
|
.uninit = &tonemap_opencl_uninit,
|
||||||
FILTER_INPUTS(tonemap_opencl_inputs),
|
FILTER_INPUTS(tonemap_opencl_inputs),
|
||||||
FILTER_OUTPUTS(tonemap_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
@@ -279,6 +279,6 @@ const AVFilter ff_vf_transpose_opencl = {
|
|||||||
.uninit = &transpose_opencl_uninit,
|
.uninit = &transpose_opencl_uninit,
|
||||||
FILTER_INPUTS(transpose_opencl_inputs),
|
FILTER_INPUTS(transpose_opencl_inputs),
|
||||||
FILTER_OUTPUTS(transpose_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
@@ -405,6 +405,6 @@ const AVFilter ff_vf_unsharp_opencl = {
|
|||||||
.uninit = &unsharp_opencl_uninit,
|
.uninit = &unsharp_opencl_uninit,
|
||||||
FILTER_INPUTS(unsharp_opencl_inputs),
|
FILTER_INPUTS(unsharp_opencl_inputs),
|
||||||
FILTER_OUTPUTS(unsharp_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
@@ -431,6 +431,6 @@ const AVFilter ff_vf_xfade_opencl = {
|
|||||||
.activate = &xfade_opencl_activate,
|
.activate = &xfade_opencl_activate,
|
||||||
FILTER_INPUTS(xfade_opencl_inputs),
|
FILTER_INPUTS(xfade_opencl_inputs),
|
||||||
FILTER_OUTPUTS(xfade_opencl_outputs),
|
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,
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user