|
FFmpeg
|
Go to the source code of this file.
Data Structures | |
| struct | KernelCode |
| struct | OpenclContext |
| struct | OpenclErrorMsg |
Macros | |
| #define | LOCK_OPENCL |
| #define | UNLOCK_OPENCL |
| #define | MAX_KERNEL_NUM 500 |
| #define | MAX_KERNEL_CODE_NUM 200 |
| #define | OFFSET(x) offsetof(OpenclContext, x) |
Functions | |
| const char * | av_opencl_errstr (cl_int status) |
| Get OpenCL error string. | |
| static void | free_device_list (AVOpenCLDeviceList *device_list) |
| static int | get_device_list (AVOpenCLDeviceList *device_list) |
| int | av_opencl_get_device_list (AVOpenCLDeviceList **device_list) |
| Get OpenCL device list. | |
| void | av_opencl_free_device_list (AVOpenCLDeviceList **device_list) |
| Free OpenCL device list. | |
| int | av_opencl_set_option (const char *key, const char *val) |
| Set option in the global OpenCL context. | |
| int | av_opencl_get_option (const char *key, uint8_t **out_val) |
| Get option value from the global OpenCL context. | |
| void | av_opencl_free_option (void) |
| Free option values of the global OpenCL context. | |
| AVOpenCLExternalEnv * | av_opencl_alloc_external_env (void) |
| Allocate OpenCL external environment. | |
| void | av_opencl_free_external_env (AVOpenCLExternalEnv **ext_opencl_env) |
| Free OpenCL external environment. | |
| int | av_opencl_register_kernel_code (const char *kernel_code) |
| Register kernel code. | |
| int | av_opencl_create_kernel (AVOpenCLKernelEnv *env, const char *kernel_name) |
| Create kernel object in the specified kernel environment. | |
| void | av_opencl_release_kernel (AVOpenCLKernelEnv *env) |
| Release kernel object. | |
| static int | init_opencl_env (OpenclContext *opencl_ctx, AVOpenCLExternalEnv *ext_opencl_env) |
| static int | compile_kernel_file (OpenclContext *opencl_ctx) |
| int | av_opencl_init (AVOpenCLExternalEnv *ext_opencl_env) |
| Initialize the run time OpenCL environment and compile the kernel code registered with av_opencl_register_kernel_code(). | |
| void | av_opencl_uninit (void) |
| Release OpenCL environment. | |
| int | av_opencl_buffer_create (cl_mem *cl_buf, size_t cl_buf_size, int flags, void *host_ptr) |
| Create OpenCL buffer. | |
| void | av_opencl_buffer_release (cl_mem *cl_buf) |
| Release OpenCL buffer. | |
| int | av_opencl_buffer_write (cl_mem dst_cl_buf, uint8_t *src_buf, size_t buf_size) |
| Write OpenCL buffer with data from src_buf. | |
| int | av_opencl_buffer_read (uint8_t *dst_buf, cl_mem src_cl_buf, size_t buf_size) |
| Read data from OpenCL buffer to memory buffer. | |
| int | av_opencl_buffer_write_image (cl_mem dst_cl_buf, size_t cl_buffer_size, int dst_cl_offset, uint8_t **src_data, int *plane_size, int plane_num) |
| Write image data from memory to OpenCL buffer. | |
| int | av_opencl_buffer_read_image (uint8_t **dst_data, int *plane_size, int plane_num, cl_mem src_cl_buf, size_t cl_buffer_size) |
| Read image data from OpenCL buffer. | |
Variables | |
| static const AVOption | opencl_options [] |
| static const AVClass | openclutils_class |
| static OpenclContext | opencl_ctx = {&openclutils_class} |
| static const cl_device_type | device_type [] = {CL_DEVICE_TYPE_GPU, CL_DEVICE_TYPE_CPU, CL_DEVICE_TYPE_DEFAULT} |
| static const OpenclErrorMsg | opencl_err_msg [] |
| #define LOCK_OPENCL |
Definition at line 38 of file opencl.c.
Referenced by av_opencl_create_kernel(), av_opencl_free_option(), av_opencl_get_option(), av_opencl_init(), av_opencl_register_kernel_code(), av_opencl_release_kernel(), av_opencl_set_option(), and av_opencl_uninit().
| #define UNLOCK_OPENCL |
Definition at line 39 of file opencl.c.
Referenced by av_opencl_create_kernel(), av_opencl_free_option(), av_opencl_get_option(), av_opencl_init(), av_opencl_register_kernel_code(), av_opencl_release_kernel(), av_opencl_set_option(), and av_opencl_uninit().
| #define MAX_KERNEL_NUM 500 |
Definition at line 43 of file opencl.c.
Referenced by av_opencl_create_kernel().
| #define MAX_KERNEL_CODE_NUM 200 |
Definition at line 44 of file opencl.c.
Referenced by av_opencl_register_kernel_code(), and compile_kernel_file().
| #define OFFSET | ( | x | ) | offsetof(OpenclContext, x) |
| const char* av_opencl_errstr | ( | cl_int | status | ) |
Get OpenCL error string.
| status | OpenCL error code |
Definition at line 166 of file opencl.c.
Referenced by av_opencl_buffer_create(), av_opencl_buffer_read(), av_opencl_buffer_read_image(), av_opencl_buffer_release(), av_opencl_buffer_write(), av_opencl_buffer_write_image(), av_opencl_create_kernel(), av_opencl_release_kernel(), av_opencl_uninit(), compile_kernel_file(), ff_opencl_apply_unsharp(), ff_opencl_set_parameter(), ff_opencl_transform(), get_device_list(), and init_opencl_env().
|
static |
Definition at line 176 of file opencl.c.
Referenced by av_opencl_free_device_list(), av_opencl_get_device_list(), av_opencl_uninit(), and get_device_list().
|
static |
Definition at line 194 of file opencl.c.
Referenced by av_opencl_get_device_list(), and init_opencl_env().
| int av_opencl_get_device_list | ( | AVOpenCLDeviceList ** | device_list | ) |
Get OpenCL device list.
It must be freed with av_opencl_free_device_list().
| device_list | pointer to OpenCL environment device list, should be released by av_opencl_free_device_list() |
| void av_opencl_free_device_list | ( | AVOpenCLDeviceList ** | device_list | ) |
Free OpenCL device list.
| device_list | pointer to OpenCL environment device list created by av_opencl_get_device_list() |
| int av_opencl_set_option | ( | const char * | key, |
| const char * | val | ||
| ) |
Set option in the global OpenCL context.
This options affect the operation performed by the next av_opencl_init() operation.
The currently accepted options are:
See reference "OpenCL Specification Version: 1.2 chapter 5.6.4".
| key | option key |
| val | option value |
| int av_opencl_get_option | ( | const char * | key, |
| uint8_t ** | out_val | ||
| ) |
Get option value from the global OpenCL context.
| key | option key |
| out_val | pointer to location where option value will be written, must be freed with av_freep() |
| AVOpenCLExternalEnv* av_opencl_alloc_external_env | ( | void | ) |
Allocate OpenCL external environment.
It must be freed with av_opencl_free_external_env().
| void av_opencl_free_external_env | ( | AVOpenCLExternalEnv ** | ext_opencl_env | ) |
Free OpenCL external environment.
| ext_opencl_env | pointer to OpenCL external environment created by av_opencl_alloc_external_env() |
| int av_opencl_register_kernel_code | ( | const char * | kernel_code | ) |
Register kernel code.
The registered kernel code is stored in a global context, and compiled in the runtime environment when av_opencl_init() is called.
| kernel_code | kernel code to be compiled in the OpenCL runtime environment |
| int av_opencl_create_kernel | ( | AVOpenCLKernelEnv * | env, |
| const char * | kernel_name | ||
| ) |
Create kernel object in the specified kernel environment.
| env | pointer to kernel environment which is filled with the environment used to run the kernel |
| kernel_name | kernel function name |
Definition at line 391 of file opencl.c.
Referenced by ff_opencl_deshake_init(), and ff_opencl_unsharp_init().
| void av_opencl_release_kernel | ( | AVOpenCLKernelEnv * | env | ) |
Release kernel object.
| env | kernel environment where the kernel object was created with av_opencl_create_kernel() |
Definition at line 433 of file opencl.c.
Referenced by ff_opencl_deshake_uninit(), and ff_opencl_unsharp_uninit().
|
static |
Definition at line 452 of file opencl.c.
Referenced by av_opencl_init().
|
static |
Definition at line 545 of file opencl.c.
Referenced by av_opencl_init().
| int av_opencl_init | ( | AVOpenCLExternalEnv * | ext_opencl_env | ) |
Initialize the run time OpenCL environment and compile the kernel code registered with av_opencl_register_kernel_code().
| ext_opencl_env | external OpenCL environment, created by an application program, ignored if set to NULL |
Definition at line 588 of file opencl.c.
Referenced by ff_opencl_deshake_init(), and ff_opencl_unsharp_init().
Release OpenCL environment.
The OpenCL environment is effectively released only if all the created kernels had been released with av_opencl_release_kernel().
Definition at line 617 of file opencl.c.
Referenced by ff_opencl_deshake_uninit(), and ff_opencl_unsharp_uninit().
| int av_opencl_buffer_create | ( | cl_mem * | cl_buf, |
| size_t | cl_buf_size, | ||
| int | flags, | ||
| void * | host_ptr | ||
| ) |
Create OpenCL buffer.
The buffer is used to save the data used or created by an OpenCL kernel. The created buffer must be released with av_opencl_buffer_release().
See clCreateBuffer() function reference for more information about the parameters.
| cl_buf | pointer to OpenCL buffer |
| cl_buf_size | size in bytes of the OpenCL buffer to create |
| flags | flags used to control buffer attributes |
| host_ptr | host pointer of the OpenCL buffer |
Definition at line 660 of file opencl.c.
Referenced by ff_opencl_deshake_init(), ff_opencl_deshake_process_inout_buf(), ff_opencl_unsharp_init(), and ff_opencl_unsharp_process_inout_buf().
| void av_opencl_buffer_release | ( | cl_mem * | cl_buf | ) |
Release OpenCL buffer.
| cl_buf | pointer to OpenCL buffer to release, which was previously filled with av_opencl_buffer_create() |
Definition at line 671 of file opencl.c.
Referenced by ff_opencl_deshake_uninit(), and ff_opencl_unsharp_uninit().
| int av_opencl_buffer_write | ( | cl_mem | dst_cl_buf, |
| uint8_t * | src_buf, | ||
| size_t | buf_size | ||
| ) |
Write OpenCL buffer with data from src_buf.
| dst_cl_buf | pointer to OpenCL destination buffer |
| src_buf | pointer to source buffer |
| buf_size | size in bytes of the source and destination buffers |
Definition at line 684 of file opencl.c.
Referenced by compute_mask_matrix(), and ff_opencl_transform().
| int av_opencl_buffer_read | ( | uint8_t * | dst_buf, |
| cl_mem | src_cl_buf, | ||
| size_t | buf_size | ||
| ) |
Read data from OpenCL buffer to memory buffer.
| dst_buf | pointer to destination buffer (CPU memory) |
| src_cl_buf | pointer to source OpenCL buffer |
| buf_size | size in bytes of the source and destination buffers |
| int av_opencl_buffer_write_image | ( | cl_mem | dst_cl_buf, |
| size_t | cl_buffer_size, | ||
| int | dst_cl_offset, | ||
| uint8_t ** | src_data, | ||
| int * | plane_size, | ||
| int | plane_num | ||
| ) |
Write image data from memory to OpenCL buffer.
The source must be an array of pointers to image plane buffers.
| dst_cl_buf | pointer to destination OpenCL buffer |
| dst_cl_buf_size | size in bytes of OpenCL buffer |
| dst_cl_buf_offset | the offset of the OpenCL buffer start position |
| src_data | array of pointers to source plane buffers |
| src_plane_sizes | array of sizes in bytes of the source plane buffers |
| src_plane_num | number of source image planes |
Definition at line 730 of file opencl.c.
Referenced by ff_opencl_deshake_process_inout_buf(), and ff_opencl_unsharp_process_inout_buf().
| int av_opencl_buffer_read_image | ( | uint8_t ** | dst_data, |
| int * | plane_size, | ||
| int | plane_num, | ||
| cl_mem | src_cl_buf, | ||
| size_t | cl_buffer_size | ||
| ) |
Read image data from OpenCL buffer.
| dst_data | array of pointers to destination plane buffers |
| dst_plane_sizes | array of pointers to destination plane buffers |
| dst_plane_num | number of destination image planes |
| src_cl_buf | pointer to source OpenCL buffer |
| src_cl_buf_size | size in bytes of OpenCL buffer |
Definition at line 771 of file opencl.c.
Referenced by ff_opencl_apply_unsharp(), and ff_opencl_transform().
|
static |
|
static |
|
static |
|
static |
Definition at line 98 of file opencl.c.
Referenced by get_device_list().
|
static |
Definition at line 105 of file opencl.c.
Referenced by av_opencl_errstr().
1.8.2