FFmpeg
Functions
opencl.c File Reference
#include <stdio.h>
#include <string.h>
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "formats.h"
#include "opencl.h"

Go to the source code of this file.

Functions

static int opencl_filter_set_device (AVFilterContext *avctx, AVBufferRef *device)
 
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...
 

Function Documentation

◆ opencl_filter_set_device()

static int opencl_filter_set_device ( AVFilterContext avctx,
AVBufferRef device 
)
static

Definition at line 28 of file opencl.c.

Referenced by ff_opencl_filter_config_input(), and ff_opencl_filter_config_output().

◆ ff_opencl_filter_config_input()

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 45 of file opencl.c.

Referenced by program_opencl_init().

◆ ff_opencl_filter_config_output()

int ff_opencl_filter_config_output ( AVFilterLink outlink)

◆ ff_opencl_filter_init()

int ff_opencl_filter_init ( AVFilterContext avctx)

Initialise an OpenCL filter context.

Definition at line 132 of file opencl.c.

Referenced by overlay_opencl_init(), program_opencl_init(), and remap_opencl_init().

◆ ff_opencl_filter_uninit()

void ff_opencl_filter_uninit ( AVFilterContext avctx)

◆ ff_opencl_filter_load_program()

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 156 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(), remap_opencl_load(), tonemap_opencl_init(), transpose_opencl_init(), unsharp_opencl_init(), and xfade_opencl_load().

◆ ff_opencl_filter_load_program_from_file()

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 204 of file opencl.c.

Referenced by program_opencl_load(), and xfade_opencl_load().

◆ ff_opencl_filter_work_size_from_image()

int ff_opencl_filter_work_size_from_image ( AVFilterContext avctx,
size_t *  work_size,
AVFrame frame,
int  plane,
int  block_alignment 
)

◆ ff_opencl_print_const_matrix_3x3()

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 326 of file opencl.c.

Referenced by tonemap_opencl_init().

◆ ff_opencl_get_event_time()

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 339 of file opencl.c.

Referenced by filter_frame().