summaryrefslogtreecommitdiff
path: root/libavfilter/opencl.h
diff options
context:
space:
mode:
authorDanil Iashchenko <danyaschenko@gmail.com>2018-06-15 05:55:34 +0300
committerMark Thompson <sw@jkqxz.net>2018-06-17 17:58:17 +0100
commitb41b6b323417ce1e79bf818f91d60526697954f1 (patch)
tree1f013af87a93cfa0488bd42a2c4501dc3761428f /libavfilter/opencl.h
parent89651c82b86e43021b0ebcde129fd98a2b922fa2 (diff)
libavfilter/opencl: Add macro for setting opencl kernel arguments
Diffstat (limited to 'libavfilter/opencl.h')
-rw-r--r--libavfilter/opencl.h15
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.
*/