[FFmpeg-cvslog] lavfi/opencl: add more opencl helper macro
Ruiling Song
git at videolan.org
Fri Apr 26 04:14:00 EEST 2019
ffmpeg | branch: master | Ruiling Song <ruiling.song at intel.com> | Fri Apr 12 16:27:54 2019 +0800| [0fc464631aafa2741e97ce00fc8f81378fcf441a] | committer: Ruiling Song
lavfi/opencl: add more opencl helper macro
Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0fc464631aafa2741e97ce00fc8f81378fcf441a
---
libavfilter/opencl.h | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
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.
More information about the ffmpeg-cvslog
mailing list