diff options
author | Danil Iashchenko <danyaschenko@gmail.com> | 2018-06-15 05:55:34 +0300 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-06-17 17:58:17 +0100 |
commit | b41b6b323417ce1e79bf818f91d60526697954f1 (patch) | |
tree | 1f013af87a93cfa0488bd42a2c4501dc3761428f /libavfilter/opencl.h | |
parent | 89651c82b86e43021b0ebcde129fd98a2b922fa2 (diff) |
libavfilter/opencl: Add macro for setting opencl kernel arguments
Diffstat (limited to 'libavfilter/opencl.h')
-rw-r--r-- | libavfilter/opencl.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h index c0a4519785..7441b11614 100644 --- a/libavfilter/opencl.h +++ b/libavfilter/opencl.h @@ -46,6 +46,21 @@ typedef struct OpenCLFilterContext { int output_height; } OpenCLFilterContext; + +/** + * set argument to specific Kernel. + * This macro relies on usage of local label "fail" and variables: + * avctx, cle and err. + */ +#define CL_SET_KERNEL_ARG(kernel, arg_num, type, arg) \ + cle = clSetKernelArg(kernel, arg_num, sizeof(type), arg); \ + if (cle != CL_SUCCESS) { \ + av_log(avctx, AV_LOG_ERROR, "Failed to set kernel " \ + "argument %d: error %d.\n", arg_num, cle); \ + err = AVERROR(EIO); \ + goto fail; \ + } + /** * Return that all inputs and outputs support only AV_PIX_FMT_OPENCL. */ |