64 "command queue: %d.\n", cle);
108 size_t global_work[2];
109 cl_mem
src, dst, inter;
110 int err, p, radius_x, radius_y;
139 src = (cl_mem) input->
data[p];
140 dst = (cl_mem)output->
data[p];
141 inter = (cl_mem) intermediate->
data[p];
149 if (!(ctx->
planes & (1 << p))) {
154 cle = clSetKernelArg(ctx->
kernel_horiz, 0,
sizeof(cl_mem), &inter);
155 if (cle != CL_SUCCESS) {
157 "destination image argument: %d.\n", cle);
161 cle = clSetKernelArg(ctx->
kernel_horiz, 1,
sizeof(cl_mem), &src);
162 if (cle != CL_SUCCESS) {
164 "source image argument: %d.\n", cle);
168 cle = clSetKernelArg(ctx->
kernel_horiz, 2,
sizeof(cl_int), &radius_x);
169 if (cle != CL_SUCCESS) {
171 "sizeX argument: %d.\n", cle);
183 p, global_work[0], global_work[1]);
188 if (cle != CL_SUCCESS) {
195 cle = clSetKernelArg(ctx->
kernel_vert, 0,
sizeof(cl_mem), &dst);
196 if (cle != CL_SUCCESS) {
198 "destination image argument: %d.\n", cle);
202 cle = clSetKernelArg(ctx->
kernel_vert, 1,
sizeof(cl_mem), &inter);
203 if (cle != CL_SUCCESS) {
205 "source image argument: %d.\n", cle);
209 cle = clSetKernelArg(ctx->
kernel_vert, 2,
sizeof(cl_int), &radius_y);
210 if (cle != CL_SUCCESS) {
212 "sizeY argument: %d.\n", cle);
223 "(%"SIZE_SPECIFIER
"x%"SIZE_SPECIFIER
").\n",
224 p, global_work[0], global_work[1]);
229 if (cle != CL_SUCCESS) {
239 if (cle != CL_SUCCESS) {
275 if (cle != CL_SUCCESS)
277 "kernel: %d.\n", cle);
282 if (cle != CL_SUCCESS)
284 "kernel: %d.\n", cle);
289 if (cle != CL_SUCCESS)
291 "command queue: %d.\n", cle);
297 #define OFFSET(x) offsetof(AverageBlurOpenCLContext, x) 298 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) 328 .
name =
"avgblur_opencl",
331 .priv_class = &avgblur_opencl_class,
335 .
inputs = avgblur_opencl_inputs,
336 .
outputs = avgblur_opencl_outputs,
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
This structure describes decoded (raw) audio or video data.
int ff_opencl_filter_work_size_from_image(AVFilterContext *avctx, size_t *work_size, AVFrame *frame, int plane, int block_alignment)
Find the work size needed needed for a given plane of an image.
int ff_opencl_filter_config_input(AVFilterLink *inlink)
Check that the input link contains a suitable hardware frames context and extract the device from it...
const char * ff_opencl_source_avgblur
int ff_opencl_filter_query_formats(AVFilterContext *avctx)
Return that all inputs and outputs support only AV_PIX_FMT_OPENCL.
static av_cold void avgblur_opencl_uninit(AVFilterContext *avctx)
Main libavfilter public API header.
Memory handling functions.
static av_cold int init(AVCodecContext *avctx)
int h
agreed upon image height
cl_command_queue command_queue
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
static const AVOption avgblur_opencl_options[]
AVOpenCLDeviceContext * hwctx
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame...
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static av_cold int uninit(AVCodecContext *avctx)
cl_device_id device_id
The primary device ID of the device.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int ff_opencl_filter_config_output(AVFilterLink *outlink)
Create a suitable hardware frames context for the output.
AVFilter ff_vf_avgblur_opencl
A filter pad used for either input or output.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int w
agreed upon image width
AVFILTER_DEFINE_CLASS(avgblur_opencl)
static const AVFilterPad avgblur_opencl_inputs[]
static const AVFilterPad avgblur_opencl_outputs[]
static const AVFilterPad inputs[]
static int avgblur_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
static const AVFilterPad outputs[]
#define FF_ARRAY_ELEMS(a)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int query_formats(AVFilterContext *ctx)
common internal and external API header
void ff_opencl_filter_uninit(AVFilterContext *avctx)
Uninitialise an OpenCL filter context.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
AVFilterContext * dst
dest filter
cl_context context
The OpenCL context which will contain all operations and frames on this device.
static int avgblur_opencl_init(AVFilterContext *avctx)
int ff_opencl_filter_load_program(AVFilterContext *avctx, const char **program_source_array, int nb_strings)
Load a new OpenCL program from strings in memory.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.