FFmpeg
Loading...
Searching...
No Matches
vf_convolution_opencl.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Danil Iashchenko
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "config_components.h"
22
23#include "libavutil/avassert.h"
24#include "libavutil/common.h"
25#include "libavutil/imgutils.h"
26#include "libavutil/mem.h"
27#include "libavutil/opt.h"
28#include "libavutil/pixdesc.h"
29#include "libavutil/avstring.h"
30
31
32#include "avfilter.h"
33#include "filters.h"
34#include "opencl.h"
35#include "opencl_source.h"
36#include "video.h"
37
40
42 cl_kernel kernel;
43 cl_command_queue command_queue;
44
45 char *matrix_str[4];
46
47 cl_mem matrix[4];
48 cl_int matrix_sizes[4];
49 cl_int dims[4];
50 cl_float rdivs[4];
51 cl_float biases[4];
52
53 cl_int planes;
54 cl_float scale;
55 cl_float delta;
56
58
60{
62 const char *kernel_name;
63 cl_int cle;
64 int err;
65
67 if (err < 0)
68 goto fail;
69
70 ctx->command_queue = clCreateCommandQueue(ctx->ocf.hwctx->context,
71 ctx->ocf.hwctx->device_id,
72 0, &cle);
73 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create OpenCL "
74 "command queue %d.\n", cle);
75
76 if (!strcmp(avctx->filter->name, "convolution_opencl")) {
77 kernel_name = "convolution_global";
78 } else if (!strcmp(avctx->filter->name, "sobel_opencl")) {
79 kernel_name = "sobel_global";
80 } else if (!strcmp(avctx->filter->name, "prewitt_opencl")){
81 kernel_name = "prewitt_global";
82 } else if (!strcmp(avctx->filter->name, "roberts_opencl")){
83 kernel_name = "roberts_global";
84 } else {
85 av_assert0(0);
86 }
87 ctx->kernel = clCreateKernel(ctx->ocf.program, kernel_name, &cle);
88 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create "
89 "kernel %d.\n", cle);
90
91 ctx->initialised = 1;
92 return 0;
93
94fail:
95 if (ctx->command_queue)
96 clReleaseCommandQueue(ctx->command_queue);
97 if (ctx->kernel)
98 clReleaseKernel(ctx->kernel);
99 return err;
100}
101
102
103
105{
107 float *matrix = NULL;
108 size_t matrix_bytes;
109 cl_mem buffer;
110 cl_int cle;
111 int i, j;
112 int sscanf_err;
113 char *p, *arg, *saveptr = NULL;
114 float input_matrix[4][49];
115
116 for (i = 0; i < 4; i++) {
117 ctx->biases[i] = ctx->biases[i] / 255.0;
118 }
119
120 for (i = 0; i < 4; i++) {
121 p = ctx->matrix_str[i];
122 while (ctx->matrix_sizes[i] < 49) {
123 arg = av_strtok(p, " ", &saveptr);
124 if (!arg) {
125 break;
126 }
127 p = NULL;
128 sscanf_err = sscanf(arg, "%f", &input_matrix[i][ctx->matrix_sizes[i]]);
129 if (sscanf_err != 1) {
130 av_log(ctx, AV_LOG_ERROR, "Matrix is sequence of 9, 25 or 49 signed numbers\n");
131 return AVERROR(EINVAL);
132 }
133 ctx->matrix_sizes[i]++;
134 }
135 if (ctx->matrix_sizes[i] == 9) {
136 ctx->dims[i] = 3;
137 } else if (ctx->matrix_sizes[i] == 25) {
138 ctx->dims[i] = 5;
139 } else if (ctx->matrix_sizes[i] == 49) {
140 ctx->dims[i] = 7;
141 } else {
142 av_log(ctx, AV_LOG_ERROR, "Invalid matrix size:%d\n", ctx->matrix_sizes[i]);
143 return AVERROR(EINVAL);
144 }
145
146 }
147
148 for (j = 0; j < 4; j++) {
149 matrix_bytes = sizeof(float)*ctx->matrix_sizes[j];
150 matrix = av_malloc(matrix_bytes);
151 if (!matrix) {
153 return AVERROR(ENOMEM);
154 }
155
156 for (i = 0; i < ctx->matrix_sizes[j]; i++)
157 matrix[i] = input_matrix[j][i];
158
159 buffer = clCreateBuffer(ctx->ocf.hwctx->context,
160 CL_MEM_READ_ONLY |
161 CL_MEM_COPY_HOST_PTR |
162 CL_MEM_HOST_NO_ACCESS,
163 matrix_bytes, matrix, &cle);
164 if (!buffer) {
165 av_log(avctx, AV_LOG_ERROR, "Failed to create matrix buffer: "
166 "%d.\n", cle);
168 return AVERROR(EIO);
169 }
170 ctx->matrix[j] = buffer;
172 }
173
174 return 0;
175}
176
178{
179 AVFilterContext *avctx = inlink->dst;
180 AVFilterLink *outlink = avctx->outputs[0];
182 AVFrame *output = NULL;
183 cl_int cle;
184 size_t global_work[2];
185 cl_mem src, dst;
186 int err, p;
187 size_t origin[3] = {0, 0, 0};
188 size_t region[3] = {0, 0, 1};
189
190 av_log(ctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
192 input->width, input->height, input->pts);
193
194 if (!input->hw_frames_ctx)
195 return AVERROR(EINVAL);
196
197 if (!ctx->initialised) {
198 err = convolution_opencl_init(avctx);
199 if (err < 0)
200 goto fail;
201
202 if (!strcmp(avctx->filter->name, "convolution_opencl")) {
204 if (err < 0)
205 goto fail;
206 } else {
207 ctx->delta /= 255.0;
208 }
209
210 }
211
212 output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
213 if (!output) {
214 err = AVERROR(ENOMEM);
215 goto fail;
216 }
217
218 for (p = 0; p < FF_ARRAY_ELEMS(output->data); p++) {
219 src = (cl_mem) input->data[p];
220 dst = (cl_mem)output->data[p];
221
222 if (!dst)
223 break;
224
225 if (!strcmp(avctx->filter->name, "convolution_opencl")) {
226 CL_SET_KERNEL_ARG(ctx->kernel, 0, cl_mem, &dst);
227 CL_SET_KERNEL_ARG(ctx->kernel, 1, cl_mem, &src);
228 CL_SET_KERNEL_ARG(ctx->kernel, 2, cl_int, &ctx->dims[p]);
229 CL_SET_KERNEL_ARG(ctx->kernel, 3, cl_mem, &ctx->matrix[p]);
230 CL_SET_KERNEL_ARG(ctx->kernel, 4, cl_float, &ctx->rdivs[p]);
231 CL_SET_KERNEL_ARG(ctx->kernel, 5, cl_float, &ctx->biases[p]);
232
233 err = ff_opencl_filter_work_size_from_image(avctx, global_work, output, p, 0);
234 if (err < 0)
235 goto fail;
236
237 av_log(avctx, AV_LOG_DEBUG, "Run kernel on plane %d "
238 "(%zux%zu).\n",
239 p, global_work[0], global_work[1]);
240
241 cle = clEnqueueNDRangeKernel(ctx->command_queue, ctx->kernel, 2, NULL,
242 global_work, NULL,
243 0, NULL, NULL);
244 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to enqueue "
245 "kernel: %d.\n", cle);
246 } else {
247 if (!(ctx->planes & (1 << p))) {
248 err = ff_opencl_filter_work_size_from_image(avctx, region, output, p, 0);
249 if (err < 0)
250 goto fail;
251
252 cle = clEnqueueCopyImage(ctx->command_queue, src, dst,
253 origin, origin, region, 0, NULL, NULL);
254 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to copy plane %d: %d.\n",
255 p, cle);
256 } else {
257 CL_SET_KERNEL_ARG(ctx->kernel, 0, cl_mem, &dst);
258 CL_SET_KERNEL_ARG(ctx->kernel, 1, cl_mem, &src);
259 CL_SET_KERNEL_ARG(ctx->kernel, 2, cl_float, &ctx->scale);
260 CL_SET_KERNEL_ARG(ctx->kernel, 3, cl_float, &ctx->delta);
261
262 err = ff_opencl_filter_work_size_from_image(avctx, global_work, output, p, 0);
263 if (err < 0)
264 goto fail;
265
266 av_log(avctx, AV_LOG_DEBUG, "Run kernel on plane %d "
267 "(%zux%zu).\n",
268 p, global_work[0], global_work[1]);
269
270 cle = clEnqueueNDRangeKernel(ctx->command_queue, ctx->kernel, 2, NULL,
271 global_work, NULL,
272 0, NULL, NULL);
273 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to enqueue "
274 "kernel: %d.\n", cle);
275 }
276 }
277 }
278
279 cle = clFinish(ctx->command_queue);
280 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to finish command queue: %d.\n", cle);
281
282 err = av_frame_copy_props(output, input);
283 if (err < 0)
284 goto fail;
285
286 av_frame_free(&input);
287
288 av_log(ctx, AV_LOG_DEBUG, "Filter output: %s, %ux%u (%"PRId64").\n",
290 output->width, output->height, output->pts);
291
292 return ff_filter_frame(outlink, output);
293
294fail:
295 clFinish(ctx->command_queue);
296 av_frame_free(&input);
297 av_frame_free(&output);
298 return err;
299}
300
302{
304 cl_int cle;
305 int i;
306
307 for (i = 0; i < 4; i++) {
308 clReleaseMemObject(ctx->matrix[i]);
309 }
310
311 if (ctx->kernel) {
312 cle = clReleaseKernel(ctx->kernel);
313 if (cle != CL_SUCCESS)
314 av_log(avctx, AV_LOG_ERROR, "Failed to release "
315 "kernel: %d.\n", cle);
316 }
317
318 if (ctx->command_queue) {
319 cle = clReleaseCommandQueue(ctx->command_queue);
320 if (cle != CL_SUCCESS)
321 av_log(avctx, AV_LOG_ERROR, "Failed to release "
322 "command queue: %d.\n", cle);
323 }
324
326}
327
329 {
330 .name = "default",
331 .type = AVMEDIA_TYPE_VIDEO,
332 .filter_frame = &convolution_opencl_filter_frame,
333 .config_props = &ff_opencl_filter_config_input,
334 },
335};
336
338 {
339 .name = "default",
340 .type = AVMEDIA_TYPE_VIDEO,
341 .config_props = &ff_opencl_filter_config_output,
342 },
343};
344
345#define OFFSET(x) offsetof(ConvolutionOpenCLContext, x)
346#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
347
348#if CONFIG_CONVOLUTION_OPENCL_FILTER
349
350static const AVOption convolution_opencl_options[] = {
351 { "0m", "set matrix for 2nd plane", OFFSET(matrix_str[0]), AV_OPT_TYPE_STRING, {.str="0 0 0 0 1 0 0 0 0"}, 0, 0, FLAGS },
352 { "1m", "set matrix for 2nd plane", OFFSET(matrix_str[1]), AV_OPT_TYPE_STRING, {.str="0 0 0 0 1 0 0 0 0"}, 0, 0, FLAGS },
353 { "2m", "set matrix for 3rd plane", OFFSET(matrix_str[2]), AV_OPT_TYPE_STRING, {.str="0 0 0 0 1 0 0 0 0"}, 0, 0, FLAGS },
354 { "3m", "set matrix for 4th plane", OFFSET(matrix_str[3]), AV_OPT_TYPE_STRING, {.str="0 0 0 0 1 0 0 0 0"}, 0, 0, FLAGS },
355 { "0rdiv", "set rdiv for 1st plane", OFFSET(rdivs[0]), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, INT_MAX, FLAGS},
356 { "1rdiv", "set rdiv for 2nd plane", OFFSET(rdivs[1]), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, INT_MAX, FLAGS},
357 { "2rdiv", "set rdiv for 3rd plane", OFFSET(rdivs[2]), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, INT_MAX, FLAGS},
358 { "3rdiv", "set rdiv for 4th plane", OFFSET(rdivs[3]), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, INT_MAX, FLAGS},
359 { "0bias", "set bias for 1st plane", OFFSET(biases[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
360 { "1bias", "set bias for 2nd plane", OFFSET(biases[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
361 { "2bias", "set bias for 3rd plane", OFFSET(biases[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
362 { "3bias", "set bias for 4th plane", OFFSET(biases[3]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
363 { NULL }
364};
365
366AVFILTER_DEFINE_CLASS(convolution_opencl);
367
369 .p.name = "convolution_opencl",
370 .p.description = NULL_IF_CONFIG_SMALL("Apply convolution mask to input video"),
371 .p.priv_class = &convolution_opencl_class,
372 .p.flags = AVFILTER_FLAG_HWDEVICE,
373 .priv_size = sizeof(ConvolutionOpenCLContext),
379 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
380};
381
382#endif /* CONFIG_CONVOLUTION_OPENCL_FILTER */
383
384#if CONFIG_SOBEL_OPENCL_FILTER
385
386static const AVOption sobel_opencl_options[] = {
387 { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=15}, 0, 15, FLAGS},
388 { "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 65535, FLAGS},
389 { "delta", "set delta", OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0}, -65535, 65535, FLAGS},
390 { NULL }
391};
392
393AVFILTER_DEFINE_CLASS(sobel_opencl);
394
396 .p.name = "sobel_opencl",
397 .p.description = NULL_IF_CONFIG_SMALL("Apply sobel operator"),
398 .p.priv_class = &sobel_opencl_class,
399 .p.flags = AVFILTER_FLAG_HWDEVICE,
400 .priv_size = sizeof(ConvolutionOpenCLContext),
406 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
407};
408
409#endif /* CONFIG_SOBEL_OPENCL_FILTER */
410
411#if CONFIG_PREWITT_OPENCL_FILTER
412
413static const AVOption prewitt_opencl_options[] = {
414 { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=15}, 0, 15, FLAGS},
415 { "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 65535, FLAGS},
416 { "delta", "set delta", OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0}, -65535, 65535, FLAGS},
417 { NULL }
418};
419
420AVFILTER_DEFINE_CLASS(prewitt_opencl);
421
423 .p.name = "prewitt_opencl",
424 .p.description = NULL_IF_CONFIG_SMALL("Apply prewitt operator"),
425 .p.priv_class = &prewitt_opencl_class,
426 .p.flags = AVFILTER_FLAG_HWDEVICE,
427 .priv_size = sizeof(ConvolutionOpenCLContext),
433 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
434};
435
436#endif /* CONFIG_PREWITT_OPENCL_FILTER */
437
438#if CONFIG_ROBERTS_OPENCL_FILTER
439
440static const AVOption roberts_opencl_options[] = {
441 { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=15}, 0, 15, FLAGS},
442 { "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 65535, FLAGS},
443 { "delta", "set delta", OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0}, -65535, 65535, FLAGS},
444 { NULL }
445};
446
447AVFILTER_DEFINE_CLASS(roberts_opencl);
448
450 .p.name = "roberts_opencl",
451 .p.description = NULL_IF_CONFIG_SMALL("Apply roberts operator"),
452 .p.priv_class = &roberts_opencl_class,
453 .p.flags = AVFILTER_FLAG_HWDEVICE,
454 .priv_size = sizeof(ConvolutionOpenCLContext),
460 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
461};
462
463#endif /* CONFIG_ROBERTS_OPENCL_FILTER */
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
const FFFilter ff_vf_roberts_opencl
const FFFilter ff_vf_prewitt_opencl
const FFFilter ff_vf_convolution_opencl
const FFFilter ff_vf_sobel_opencl
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define FLAGS
Definition cmdutils.c:598
common internal and external API header
#define NULL
Definition coverity.c:32
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define fail
Definition test.h:479
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition avfilter.h:187
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
Definition avstring.c:179
misc image utilities
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition intra.c:278
static av_cold void uninit(AVBitStreamFilterContext *ctx)
const char * arg
Definition jacosubdec.c:65
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition filters.h:208
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static const struct @257111027162314367033347246032313251342043035002 planes[]
Memory handling functions.
void ff_opencl_filter_uninit(AVFilterContext *avctx)
Uninitialise an OpenCL filter context.
Definition opencl.c:144
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.
Definition opencl.c:159
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.
Definition opencl.c:46
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition opencl.c:135
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.
Definition opencl.c:266
int ff_opencl_filter_config_output(AVFilterLink *outlink)
Create a suitable hardware frames context for the output.
Definition opencl.c:83
#define CL_SET_KERNEL_ARG(kernel, arg_num, type, arg)
set argument to specific Kernel.
Definition opencl.h:61
#define CL_FAIL_ON_ERROR(errcode,...)
A helper macro to handle OpenCL errors.
Definition opencl.h:74
const char * ff_source_convolution_cl
#define av_malloc(s)
Definition ops_static.c:52
AVOptions.
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.
Definition pixdesc.c:3380
@ AV_PIX_FMT_OPENCL
Hardware surfaces for OpenCL.
Definition pixfmt.h:358
#define FF_ARRAY_ELEMS(a)
An instance of a filter.
Definition avfilter.h:273
const AVFilter * filter
the AVFilter of which this is an instance
Definition avfilter.h:276
void * priv
private data for use by the filter
Definition avfilter.h:288
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:285
A filter pad used for either input or output.
Definition filters.h:40
const char * name
Filter name.
Definition avfilter.h:219
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:493
int width
Definition frame.h:544
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
Definition frame.h:769
int height
Definition frame.h:544
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition frame.h:559
AVOption.
Definition opt.h:428
#define av_freep(p)
#define av_log(a,...)
#define src
Definition vp8dsp.c:248
static char buffer[20]
Definition seek.c:32
static int convolution_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
static int convolution_opencl_make_filter_params(AVFilterContext *avctx)
static av_cold void convolution_opencl_uninit(AVFilterContext *avctx)
static int convolution_opencl_init(AVFilterContext *avctx)
static const AVFilterPad convolution_opencl_inputs[]
static const AVFilterPad convolution_opencl_outputs[]
#define OFFSET(x)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89
float delta