FFmpeg
|
#include "libavutil/bprint.h"
#include "libavutil/buffer.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_opencl.h"
#include "libavutil/pixfmt.h"
#include "avfilter.h"
Go to the source code of this file.
Data Structures | |
struct | OpenCLFilterContext |
struct | OpenCLKernelArg |
Macros | |
#define | CL_USE_DEPRECATED_OPENCL_1_2_APIS |
#define | CL_SET_KERNEL_ARG(kernel, arg_num, type, arg) |
set argument to specific Kernel. More... | |
#define | CL_FAIL_ON_ERROR(errcode, ...) |
A helper macro to handle OpenCL errors. More... | |
#define | CL_CREATE_KERNEL(ctx, kernel_name) |
Create a kernel with the given name. More... | |
#define | CL_RELEASE_KERNEL(k) |
release an OpenCL Kernel More... | |
#define | CL_RELEASE_MEMORY(m) |
release an OpenCL Memory Object More... | |
#define | CL_RELEASE_QUEUE(q) |
release an OpenCL Command Queue More... | |
#define | CL_ENQUEUE_KERNEL_WITH_ARGS(queue, kernel, global_work_size, local_work_size, event, ...) |
Enqueue a kernel with the given information. More... | |
#define | CL_RUN_KERNEL_WITH_ARGS(queue, kernel, global_work_size, local_work_size, event, ...) |
Uses the above macro to enqueue the given kernel and then additionally runs it to completion via clFinish. More... | |
#define | CL_CREATE_BUFFER_FLAGS(ctx, buffer_name, flags, size, host_ptr) |
Create a buffer with the given information. More... | |
#define | CL_BLOCKING_WRITE_BUFFER(queue, buffer, size, host_ptr, event) |
Perform a blocking write to a buffer. More... | |
#define | CL_CREATE_BUFFER(ctx, buffer_name, size) CL_CREATE_BUFFER_FLAGS(ctx, buffer_name, 0, size, NULL) |
Create a buffer with the given information. More... | |
Functions | |
int | ff_opencl_filter_query_formats (AVFilterContext *avctx) |
Return that all inputs and outputs support only AV_PIX_FMT_OPENCL. More... | |
int | ff_opencl_filter_config_input (AVFilterLink *inlink) |
Check that the input link contains a suitable hardware frames context and extract the device from it. More... | |
int | ff_opencl_filter_config_output (AVFilterLink *outlink) |
Create a suitable hardware frames context for the output. More... | |
int | ff_opencl_filter_init (AVFilterContext *avctx) |
Initialise an OpenCL filter context. More... | |
void | ff_opencl_filter_uninit (AVFilterContext *avctx) |
Uninitialise an OpenCL filter context. More... | |
int | ff_opencl_filter_load_program (AVFilterContext *avctx, const char **program_source_array, int nb_strings) |
Load a new OpenCL program from strings in memory. More... | |
int | ff_opencl_filter_load_program_from_file (AVFilterContext *avctx, const char *filename) |
Load a new OpenCL program from a file. More... | |
int | ff_opencl_filter_work_size_from_image (AVFilterContext *avctx, size_t *work_size, AVFrame *frame, int plane, int block_alignment) |
Find the work size needed needed for a given plane of an image. More... | |
void | ff_opencl_print_const_matrix_3x3 (AVBPrint *buf, const char *name_str, double mat[3][3]) |
Print a 3x3 matrix into a buffer as __constant array, which could be included in an OpenCL program. More... | |
cl_ulong | ff_opencl_get_event_time (cl_event event) |
Gets the command start and end times for the given event and returns the difference (the time that the event took). More... | |
set argument to specific Kernel.
This macro relies on usage of local label "fail" and variables: avctx, cle and err.
Definition at line 61 of file opencl.h.
Referenced by avgblur_opencl_filter_frame(), convolution_opencl_filter_frame(), filter_frame(), launch_kernel(), neighbor_opencl_filter_frame(), nlmeans_plane(), overlay_opencl_blend(), transpose_opencl_filter_frame(), unsharp_opencl_filter_frame(), and xfade_frame().
#define CL_FAIL_ON_ERROR | ( | errcode, | |
... | |||
) |
A helper macro to handle OpenCL errors.
It will assign errcode to variable err, log error msg, and jump to fail label on error.
Definition at line 74 of file opencl.h.
Referenced by avgblur_opencl_filter_frame(), avgblur_opencl_init(), colorkey_opencl_init(), convolution_opencl_filter_frame(), convolution_opencl_init(), deshake_opencl_init(), filter_frame(), launch_kernel(), neighbor_opencl_filter_frame(), neighbor_opencl_init(), nlmeans_opencl_filter_frame(), nlmeans_opencl_init(), nlmeans_plane(), overlay_opencl_blend(), overlay_opencl_load(), pad_opencl_init(), program_opencl_run(), queue_frame(), tonemap_opencl_filter_frame(), tonemap_opencl_init(), transpose_opencl_filter_frame(), transpose_opencl_init(), unsharp_opencl_filter_frame(), unsharp_opencl_init(), unsharp_opencl_make_filter_params(), xfade_frame(), and xfade_opencl_load().
#define CL_CREATE_KERNEL | ( | ctx, | |
kernel_name | |||
) |
Create a kernel with the given name.
The kernel variable in the context structure must have a name of the form kernel_<kernel_name>.
The OpenCLFilterContext variable in the context structure must be named ocf.
Requires the presence of a local cl_int variable named cle and a fail label for error handling.
Definition at line 93 of file opencl.h.
Referenced by deshake_opencl_init().
#define CL_RELEASE_KERNEL | ( | k | ) |
release an OpenCL Kernel
Definition at line 101 of file opencl.h.
Referenced by deshake_opencl_uninit(), nlmeans_opencl_init(), and nlmeans_opencl_uninit().
#define CL_RELEASE_MEMORY | ( | m | ) |
release an OpenCL Memory Object
Definition at line 114 of file opencl.h.
Referenced by deshake_opencl_uninit(), nlmeans_opencl_init(), and nlmeans_opencl_uninit().
#define CL_RELEASE_QUEUE | ( | q | ) |
release an OpenCL Command Queue
Definition at line 127 of file opencl.h.
Referenced by deshake_opencl_uninit(), nlmeans_opencl_init(), and nlmeans_opencl_uninit().
#define CL_ENQUEUE_KERNEL_WITH_ARGS | ( | queue, | |
kernel, | |||
global_work_size, | |||
local_work_size, | |||
event, | |||
... | |||
) |
Enqueue a kernel with the given information.
Kernel arguments are provided as KernelArg structures and are set in the order that they are passed.
Requires the presence of a local cl_int variable named cle and a fail label for error handling.
#define CL_RUN_KERNEL_WITH_ARGS | ( | queue, | |
kernel, | |||
global_work_size, | |||
local_work_size, | |||
event, | |||
... | |||
) |
Uses the above macro to enqueue the given kernel and then additionally runs it to completion via clFinish.
Requires the presence of a local cl_int variable named cle and a fail label for error handling.
Definition at line 180 of file opencl.h.
Referenced by filter_frame(), and queue_frame().
Create a buffer with the given information.
The buffer variable in the context structure must be named <buffer_name>.
Requires the presence of a local cl_int variable named cle and a fail label for error handling.
Definition at line 197 of file opencl.h.
Referenced by deshake_opencl_init().
Perform a blocking write to a buffer.
Requires the presence of a local cl_int variable named cle and a fail label for error handling.
Definition at line 214 of file opencl.h.
Referenced by filter_frame().
#define CL_CREATE_BUFFER | ( | ctx, | |
buffer_name, | |||
size | |||
) | CL_CREATE_BUFFER_FLAGS(ctx, buffer_name, 0, size, NULL) |
Create a buffer with the given information.
The buffer variable in the context structure must be named <buffer_name>.
Requires the presence of a local cl_int variable named cle and a fail label for error handling.
Definition at line 237 of file opencl.h.
Referenced by deshake_opencl_init().
int ff_opencl_filter_query_formats | ( | AVFilterContext * | avctx | ) |
int ff_opencl_filter_config_input | ( | AVFilterLink * | inlink | ) |
Check that the input link contains a suitable hardware frames context and extract the device from it.
Definition at line 60 of file opencl.c.
Referenced by program_opencl_init().
int ff_opencl_filter_config_output | ( | AVFilterLink * | outlink | ) |
Create a suitable hardware frames context for the output.
Definition at line 96 of file opencl.c.
Referenced by overlay_opencl_config_output(), pad_opencl_config_output(), program_opencl_config_output(), tonemap_opencl_config_output(), transpose_opencl_config_output(), and xfade_opencl_config_output().
int ff_opencl_filter_init | ( | AVFilterContext * | avctx | ) |
Initialise an OpenCL filter context.
Definition at line 147 of file opencl.c.
Referenced by overlay_opencl_init(), and program_opencl_init().
void ff_opencl_filter_uninit | ( | AVFilterContext * | avctx | ) |
Uninitialise an OpenCL filter context.
Definition at line 156 of file opencl.c.
Referenced by avgblur_opencl_uninit(), colorkey_opencl_uninit(), convolution_opencl_uninit(), deshake_opencl_uninit(), neighbor_opencl_uninit(), nlmeans_opencl_uninit(), overlay_opencl_uninit(), pad_opencl_uninit(), program_opencl_uninit(), tonemap_opencl_uninit(), transpose_opencl_uninit(), unsharp_opencl_uninit(), and xfade_opencl_uninit().
int ff_opencl_filter_load_program | ( | AVFilterContext * | avctx, |
const char ** | program_source_array, | ||
int | nb_strings | ||
) |
Load a new OpenCL program from strings in memory.
Creates a new program and compiles it for the current device. Will log any build errors if compilation fails.
Definition at line 171 of file opencl.c.
Referenced by avgblur_opencl_init(), colorkey_opencl_init(), convolution_opencl_init(), deshake_opencl_init(), ff_opencl_filter_load_program_from_file(), neighbor_opencl_init(), nlmeans_opencl_init(), overlay_opencl_load(), pad_opencl_init(), tonemap_opencl_init(), transpose_opencl_init(), unsharp_opencl_init(), and xfade_opencl_load().
int ff_opencl_filter_load_program_from_file | ( | AVFilterContext * | avctx, |
const char * | filename | ||
) |
Load a new OpenCL program from a file.
Same as ff_opencl_filter_load_program(), but from a file.
Definition at line 219 of file opencl.c.
Referenced by program_opencl_load(), and xfade_opencl_load().
int ff_opencl_filter_work_size_from_image | ( | AVFilterContext * | avctx, |
size_t * | work_size, | ||
AVFrame * | frame, | ||
int | plane, | ||
int | block_alignment | ||
) |
Find the work size needed needed for a given plane of an image.
Definition at line 278 of file opencl.c.
Referenced by avgblur_opencl_filter_frame(), convolution_opencl_filter_frame(), filter_frame(), launch_kernel(), neighbor_opencl_filter_frame(), overlay_opencl_blend(), program_opencl_run(), queue_frame(), transpose_opencl_filter_frame(), unsharp_opencl_filter_frame(), and xfade_frame().
void ff_opencl_print_const_matrix_3x3 | ( | AVBPrint * | buf, |
const char * | name_str, | ||
double | mat[3][3] | ||
) |
Print a 3x3 matrix into a buffer as __constant array, which could be included in an OpenCL program.
Definition at line 341 of file opencl.c.
Referenced by tonemap_opencl_init().
cl_ulong ff_opencl_get_event_time | ( | cl_event | event | ) |
Gets the command start and end times for the given event and returns the difference (the time that the event took).
Definition at line 354 of file opencl.c.
Referenced by filter_frame(), and queue_frame().