summaryrefslogtreecommitdiff
path: root/libavutil/opencl.h
diff options
context:
space:
mode:
authorLenny Wang <lenny@multicorewareinc.com>2013-11-03 21:58:09 -0600
committerMichael Niedermayer <michaelni@gmx.at>2013-11-05 14:29:55 +0100
commit668255479085728bdf875a1b01c76201e2562a47 (patch)
tree98f8fb5b7faaa6e609c018ea6a167df1e3fe424b /libavutil/opencl.h
parente3f384b428351b62c83a19a8b77d93ffd415a124 (diff)
avutil/opencl: compile kernels separately
Reviewed-by: Wei Gao <highgod0401@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/opencl.h')
-rw-r--r--libavutil/opencl.h40
1 files changed, 33 insertions, 7 deletions
diff --git a/libavutil/opencl.h b/libavutil/opencl.h
index 094c108a3c..e4ecbf812c 100644
--- a/libavutil/opencl.h
+++ b/libavutil/opencl.h
@@ -1,7 +1,8 @@
/*
- * Copyright (C) 2012 Peng Gao <peng@multicorewareinc.com>
- * Copyright (C) 2012 Li Cao <li@multicorewareinc.com>
- * Copyright (C) 2012 Wei Gao <weigao@multicorewareinc.com>
+ * Copyright (C) 2012 Peng Gao <peng@multicorewareinc.com>
+ * Copyright (C) 2012 Li Cao <li@multicorewareinc.com>
+ * Copyright (C) 2012 Wei Gao <weigao@multicorewareinc.com>
+ * Copyright (C) 2013 Lenny Wang <lwanghpc@gmail.com>
*
* This file is part of FFmpeg.
*
@@ -39,6 +40,8 @@
#endif
#include "dict.h"
+#include "libavutil/version.h"
+
#define AV_OPENCL_KERNEL( ... )# __VA_ARGS__
#define AV_OPENCL_MAX_KERNEL_NAME_SIZE 150
@@ -65,11 +68,13 @@ typedef struct {
AVOpenCLPlatformNode **platform_node;
} AVOpenCLDeviceList;
+#if FF_API_OLD_OPENCL
typedef struct {
cl_command_queue command_queue;
cl_kernel kernel;
char kernel_name[AV_OPENCL_MAX_KERNEL_NAME_SIZE];
} AVOpenCLKernelEnv;
+#endif
typedef struct {
cl_platform_id platform_id;
@@ -107,7 +112,6 @@ void av_opencl_free_device_list(AVOpenCLDeviceList **device_list);
* av_opencl_init() operation.
*
* The currently accepted options are:
- * - build_options: set options to compile registered kernels code
* - platform: set index of platform in device list
* - device: set index of device in device list
*
@@ -174,15 +178,15 @@ const char *av_opencl_errstr(cl_int status);
int av_opencl_register_kernel_code(const char *kernel_code);
/**
- * Initialize the run time OpenCL environment and compile the kernel
- * code registered with av_opencl_register_kernel_code().
+ * Initialize the run time OpenCL environment
*
* @param ext_opencl_env external OpenCL environment, created by an
* application program, ignored if set to NULL
* @return >=0 on success, a negative error code in case of failure
*/
- int av_opencl_init(AVOpenCLExternalEnv *ext_opencl_env);
+int av_opencl_init(AVOpenCLExternalEnv *ext_opencl_env);
+#if FF_API_OLD_OPENCL
/**
* Create kernel object in the specified kernel environment.
*
@@ -190,8 +194,27 @@ int av_opencl_register_kernel_code(const char *kernel_code);
* the environment used to run the kernel
* @param kernel_name kernel function name
* @return >=0 on success, a negative error code in case of failure
+ * @deprecated, use clCreateKernel
*/
int av_opencl_create_kernel(AVOpenCLKernelEnv *env, const char *kernel_name);
+#endif
+
+/**
+ * compile specific OpenCL kernel source
+ *
+ * @param program_name pointer to a program name used for identification
+ * @param build_opts pointer to a string that describes the preprocessor
+ * build options to be used for building the program
+ * @return a cl_program object
+ */
+cl_program av_opencl_compile(const char *program_name, const char* build_opts);
+
+/**
+ * get OpenCL command queue
+ *
+ * @return a cl_command_queue object
+ */
+cl_command_queue av_opencl_get_command_queue(void);
/**
* Create OpenCL buffer.
@@ -268,13 +291,16 @@ int av_opencl_buffer_read_image(uint8_t **dst_data, int *plane_size, int plane_n
*/
void av_opencl_buffer_release(cl_mem *cl_buf);
+#if FF_API_OLD_OPENCL
/**
* Release kernel object.
*
* @param env kernel environment where the kernel object was created
* with av_opencl_create_kernel()
+ * @deprecated, use clReleaseKernel
*/
void av_opencl_release_kernel(AVOpenCLKernelEnv *env);
+#endif
/**
* Release OpenCL environment.