31 #define MAX_DIAMETER 23 
   80                      "command queue %d.\n", cle);
 
   89                                  ctx->
global ? 
"unsharp_global" 
   90                                              : 
"unsharp_local", &cle);
 
  100         clReleaseKernel(ctx->
kernel);
 
  113     float diam_x, diam_y, amount;
 
  114     int err, p, x, y, size_x, size_y;
 
  132         size_x = (
int)ceil(diam_x) | 1;
 
  133         size_y = (
int)ceil(diam_y) | 1;
 
  134         matrix_bytes = size_x * size_y * 
sizeof(float);
 
  143         for (x = 0; x < size_x; x++) {
 
  144             double dx = (double)(x - size_x / 2) / diam_x;
 
  147         for (x = 0; x < size_x; x++)
 
  151         for (y = 0; y < size_y; y++) {
 
  152             double dy = (double)(y - size_y / 2) / diam_y;
 
  155         for (y = 0; y < size_y; y++)
 
  158         for (y = 0; y < size_y; y++) {
 
  159             for (x = 0; x < size_x; x++) {
 
  161                 matrix[y * size_x + x] = 
val;
 
  168                                     CL_MEM_COPY_HOST_PTR |
 
  169                                     CL_MEM_HOST_NO_ACCESS,
 
  170                                     matrix_bytes, matrix, &cle);
 
  177                                     CL_MEM_COPY_HOST_PTR |
 
  178                                     CL_MEM_HOST_NO_ACCESS,
 
  187                                     CL_MEM_COPY_HOST_PTR |
 
  188                                     CL_MEM_HOST_NO_ACCESS,
 
  216     size_t global_work[2];
 
  217     size_t local_work[2];
 
  245         src = (cl_mem) input->
data[p];
 
  246         dst = (cl_mem)output->
data[p];
 
  274                p, global_work[0], global_work[1]);
 
  320         cle = clReleaseKernel(ctx->
kernel);
 
  321         if (cle != CL_SUCCESS)
 
  323                    "kernel: %d.\n", cle);
 
  328         if (cle != CL_SUCCESS)
 
  330                    "command queue: %d.\n", cle);
 
  336 #define OFFSET(x) offsetof(UnsharpOpenCLContext, x) 
  337 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) 
  339     { 
"luma_msize_x",     
"Set luma mask horizontal diameter (pixels)",
 
  342     { 
"lx",               
"Set luma mask horizontal diameter (pixels)",
 
  345     { 
"luma_msize_y",     
"Set luma mask vertical diameter (pixels)",
 
  348     { 
"ly",               
"Set luma mask vertical diameter (pixels)",
 
  351     { 
"luma_amount",      
"Set luma amount (multiplier)",
 
  353       { .dbl = 1.0 }, -10, 10, 
FLAGS },
 
  354     { 
"la",               
"Set luma amount (multiplier)",
 
  356       { .dbl = 1.0 }, -10, 10, 
FLAGS },
 
  358     { 
"chroma_msize_x",   
"Set chroma mask horizontal diameter (pixels after subsampling)",
 
  361     { 
"cx",               
"Set chroma mask horizontal diameter (pixels after subsampling)",
 
  364     { 
"chroma_msize_y",   
"Set chroma mask vertical diameter (pixels after subsampling)",
 
  367     { 
"cy",               
"Set chroma mask vertical diameter (pixels after subsampling)",
 
  370     { 
"chroma_amount",    
"Set chroma amount (multiplier)",
 
  372       { .dbl = 0.0 }, -10, 10, 
FLAGS },
 
  373     { 
"ca",               
"Set chroma amount (multiplier)",
 
  375       { .dbl = 0.0 }, -10, 10, 
FLAGS },
 
  402     .
name           = 
"unsharp_opencl",
 
  405     .priv_class     = &unsharp_opencl_class,
 
  409     .
inputs         = unsharp_opencl_inputs,
 
  410     .
outputs        = unsharp_opencl_outputs,
 
int plane
Which of the 4 planes contains the component. 
 
const char const char void * val
 
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
 
AVFilter ff_vf_unsharp_opencl
 
static av_cold void unsharp_opencl_uninit(AVFilterContext *avctx)
 
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
 
This structure describes decoded (raw) audio or video data. 
 
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. 
 
struct UnsharpOpenCLContext::@236 plane[4]
 
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...
 
int ff_opencl_filter_query_formats(AVFilterContext *avctx)
Return that all inputs and outputs support only AV_PIX_FMT_OPENCL. 
 
Main libavfilter public API header. 
 
Memory handling functions. 
 
static av_cold int init(AVCodecContext *avctx)
 
int h
agreed upon image height 
 
static const AVFilterPad unsharp_opencl_outputs[]
 
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions. 
 
static int unsharp_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
 
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context. 
 
AVOpenCLDeviceContext * hwctx
 
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame...
 
const char * name
Pad name. 
 
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter. 
 
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed. 
 
static av_cold int uninit(AVCodecContext *avctx)
 
static const AVOption unsharp_opencl_options[]
 
cl_device_id device_id
The primary device ID of the device. 
 
cl_command_queue command_queue
 
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user). 
 
int ff_opencl_filter_config_output(AVFilterLink *outlink)
Create a suitable hardware frames context for the output. 
 
A filter pad used for either input or output. 
 
A link between two filters. 
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
 
static int unsharp_opencl_make_filter_params(AVFilterContext *avctx)
 
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale). 
 
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g. 
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
 
void * priv
private data for use by the filter 
 
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers. 
 
const char * ff_opencl_source_unsharp
 
enum AVPixelFormat output_format
 
int w
agreed upon image width 
 
uint64_t flags
Combination of AV_PIX_FMT_FLAG_... 
 
uint8_t nb_components
The number of components each pixel has, (1-4) 
 
float blur_y[MAX_DIAMETER]
 
static const AVFilterPad inputs[]
 
static const AVFilterPad outputs[]
 
#define FF_ARRAY_ELEMS(a)
 
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
 
#define CL_SET_KERNEL_ARG(kernel, arg_num, type, arg)
set argument to specific Kernel. 
 
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
 
AVFILTER_DEFINE_CLASS(unsharp_opencl)
 
float blur_x[MAX_DIAMETER]
 
const char * name
Filter name. 
 
static int unsharp_opencl_init(AVFilterContext *avctx)
 
AVFilterLink ** outputs
array of pointers to output links 
 
#define CL_FAIL_ON_ERROR(errcode,...)
A helper macro to handle OpenCL errors. 
 
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
 
static int query_formats(AVFilterContext *ctx)
 
common internal and external API header 
 
static const AVFilterPad unsharp_opencl_inputs[]
 
void ff_opencl_filter_uninit(AVFilterContext *avctx)
Uninitialise an OpenCL filter context. 
 
AVFilterContext * dst
dest filter 
 
cl_context context
The OpenCL context which will contain all operations and frames on this device. 
 
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. 
 
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown. 
 
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.