aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/opencl.h
diff options
context:
space:
mode:
authorRuiling Song <ruiling.song@intel.com>2019-04-12 16:27:54 +0800
committerRuiling Song <ruiling.song@intel.com>2019-04-26 10:08:05 +0800
commit0fc464631aafa2741e97ce00fc8f81378fcf441a (patch)
tree915d97c75afe4d65526dfdc84b77fe1205e84f2c /libavfilter/opencl.h
parent2be0bd12b71cf923bc5d41cc619b7c491860194b (diff)
downloadffmpeg-0fc464631aafa2741e97ce00fc8f81378fcf441a.tar.gz
lavfi/opencl: add more opencl helper macro
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'libavfilter/opencl.h')
-rw-r--r--libavfilter/opencl.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h
index 0b06232ade..973b6d82dd 100644
--- a/libavfilter/opencl.h
+++ b/libavfilter/opencl.h
@@ -73,6 +73,44 @@ typedef struct OpenCLFilterContext {
goto fail; \
} \
} while(0)
+/**
+ * release an OpenCL Kernel
+ */
+#define CL_RELEASE_KERNEL(k) \
+do { \
+ if (k) { \
+ cle = clReleaseKernel(k); \
+ if (cle != CL_SUCCESS) \
+ av_log(avctx, AV_LOG_ERROR, "Failed to release " \
+ "OpenCL kernel: %d.\n", cle); \
+ } \
+} while(0)
+
+/**
+ * release an OpenCL Memory Object
+ */
+#define CL_RELEASE_MEMORY(m) \
+do { \
+ if (m) { \
+ cle = clReleaseMemObject(m); \
+ if (cle != CL_SUCCESS) \
+ av_log(avctx, AV_LOG_ERROR, "Failed to release " \
+ "OpenCL memory: %d.\n", cle); \
+ } \
+} while(0)
+
+/**
+ * release an OpenCL Command Queue
+ */
+#define CL_RELEASE_QUEUE(q) \
+do { \
+ if (q) { \
+ cle = clReleaseCommandQueue(q); \
+ if (cle != CL_SUCCESS) \
+ av_log(avctx, AV_LOG_ERROR, "Failed to release " \
+ "OpenCL command queue: %d.\n", cle); \
+ } \
+} while(0)
/**
* Return that all inputs and outputs support only AV_PIX_FMT_OPENCL.