Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -73,6 +73,44 @@ typedef struct OpenCLFilterContext { · 72 unmodified lines | ||
| 73 | 73 | goto fail; \ |
| 74 | 74 | } \ |
| 75 | 75 | } while(0) |
| 76 | +/** | |
| 77 | + * release an OpenCL Kernel | |
| 78 | + */ | |
| 79 | +#define CL_RELEASE_KERNEL(k) \ | |
| 80 | +do { \ | |
| 81 | + if (k) { \ | |
| 82 | + cle = clReleaseKernel(k); \ | |
| 83 | + if (cle != CL_SUCCESS) \ | |
| 84 | + av_log(avctx, AV_LOG_ERROR, "Failed to release " \ | |
| 85 | + "OpenCL kernel: %d.\n", cle); \ | |
| 86 | + } \ | |
| 87 | +} while(0) | |
| 88 | + | |
| 89 | +/** | |
| 90 | + * release an OpenCL Memory Object | |
| 91 | + */ | |
| 92 | +#define CL_RELEASE_MEMORY(m) \ | |
| 93 | +do { \ | |
| 94 | + if (m) { \ | |
| 95 | + cle = clReleaseMemObject(m); \ | |
| 96 | + if (cle != CL_SUCCESS) \ | |
| 97 | + av_log(avctx, AV_LOG_ERROR, "Failed to release " \ | |
| 98 | + "OpenCL memory: %d.\n", cle); \ | |
| 99 | + } \ | |
| 100 | +} while(0) | |
| 101 | + | |
| 102 | +/** | |
| 103 | + * release an OpenCL Command Queue | |
| 104 | + */ | |
| 105 | +#define CL_RELEASE_QUEUE(q) \ | |
| 106 | +do { \ | |
| 107 | + if (q) { \ | |
| 108 | + cle = clReleaseCommandQueue(q); \ | |
| 109 | + if (cle != CL_SUCCESS) \ | |
| 110 | + av_log(avctx, AV_LOG_ERROR, "Failed to release " \ | |
| 111 | + "OpenCL command queue: %d.\n", cle); \ | |
| 112 | + } \ | |
| 113 | +} while(0) | |
| 76 | 114 | |
| 77 | 115 | /** |
| 78 | 116 | * Return that all inputs and outputs support only AV_PIX_FMT_OPENCL. |