FFmpeg
Data Structures | Macros | Functions | Variables
vf_nlmeans_opencl.c File Reference
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "opencl.h"
#include "opencl_source.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  NLMeansOpenCLContext
 

Macros

#define OFFSET(x)   offsetof(NLMeansOpenCLContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Functions

static int is_format_supported (enum AVPixelFormat fmt)
 
static int nlmeans_opencl_init (AVFilterContext *avctx, int width, int height)
 
static int nlmeans_plane (AVFilterContext *avctx, cl_mem dst, cl_mem src, cl_int width, cl_int height, cl_int p, cl_int r)
 
static int nlmeans_opencl_filter_frame (AVFilterLink *inlink, AVFrame *input)
 
static av_cold void nlmeans_opencl_uninit (AVFilterContext *avctx)
 
 AVFILTER_DEFINE_CLASS (nlmeans_opencl)
 

Variables

static enum AVPixelFormat supported_formats []
 
static const AVOption nlmeans_opencl_options []
 
static const AVFilterPad nlmeans_opencl_inputs []
 
static const AVFilterPad nlmeans_opencl_outputs []
 
const AVFilter ff_vf_nlmeans_opencl
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(NLMeansOpenCLContext, x)

Definition at line 400 of file vf_nlmeans_opencl.c.

◆ FLAGS

Definition at line 401 of file vf_nlmeans_opencl.c.

Function Documentation

◆ is_format_supported()

static int is_format_supported ( enum AVPixelFormat  fmt)
static

Definition at line 42 of file vf_nlmeans_opencl.c.

Referenced by nlmeans_opencl_filter_frame().

◆ nlmeans_opencl_init()

static int nlmeans_opencl_init ( AVFilterContext avctx,
int  width,
int  height 
)
static

Definition at line 74 of file vf_nlmeans_opencl.c.

Referenced by nlmeans_opencl_filter_frame().

◆ nlmeans_plane()

static int nlmeans_plane ( AVFilterContext avctx,
cl_mem  dst,
cl_mem  src,
cl_int  width,
cl_int  height,
cl_int  p,
cl_int  r 
)
static

Definition at line 170 of file vf_nlmeans_opencl.c.

Referenced by nlmeans_opencl_filter_frame().

◆ nlmeans_opencl_filter_frame()

static int nlmeans_opencl_filter_frame ( AVFilterLink inlink,
AVFrame input 
)
static

Definition at line 286 of file vf_nlmeans_opencl.c.

◆ nlmeans_opencl_uninit()

static av_cold void nlmeans_opencl_uninit ( AVFilterContext avctx)
static

Definition at line 380 of file vf_nlmeans_opencl.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( nlmeans_opencl  )

Variable Documentation

◆ supported_formats

enum AVPixelFormat supported_formats[]
static
Initial value:

Definition at line 36 of file vf_nlmeans_opencl.c.

Referenced by is_format_supported().

◆ nlmeans_opencl_options

const AVOption nlmeans_opencl_options[]
static
Initial value:
= {
{ "s", "denoising strength", OFFSET(sigma), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 1.0, 30.0, FLAGS },
{ "p", "patch size", OFFSET(patch_size), AV_OPT_TYPE_INT, { .i64 = 2*3+1 }, 0, 99, FLAGS },
{ "pc", "patch size for chroma planes", OFFSET(patch_size_uv), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 99, FLAGS },
{ "r", "research window", OFFSET(research_size), AV_OPT_TYPE_INT, { .i64 = 7*2+1 }, 0, 99, FLAGS },
{ "rc", "research window for chroma planes", OFFSET(research_size_uv), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 99, FLAGS },
{ NULL }
}

Definition at line 402 of file vf_nlmeans_opencl.c.

◆ nlmeans_opencl_inputs

const AVFilterPad nlmeans_opencl_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = &nlmeans_opencl_filter_frame,
},
}

Definition at line 413 of file vf_nlmeans_opencl.c.

◆ nlmeans_opencl_outputs

const AVFilterPad nlmeans_opencl_outputs[]
static
Initial value:
= {
{
.name = "default",
},
}

Definition at line 422 of file vf_nlmeans_opencl.c.

◆ ff_vf_nlmeans_opencl

const AVFilter ff_vf_nlmeans_opencl
Initial value:
= {
.name = "nlmeans_opencl",
.description = NULL_IF_CONFIG_SMALL("Non-local means denoiser through OpenCL"),
.priv_size = sizeof(NLMeansOpenCLContext),
.priv_class = &nlmeans_opencl_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 430 of file vf_nlmeans_opencl.c.

NLMeansOpenCLContext
Definition: vf_nlmeans_opencl.c:52
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
nlmeans_opencl_outputs
static const AVFilterPad nlmeans_opencl_outputs[]
Definition: vf_nlmeans_opencl.c:422
FLAGS
#define FLAGS
Definition: vf_nlmeans_opencl.c:401
ff_opencl_filter_config_output
int ff_opencl_filter_config_output(AVFilterLink *outlink)
Create a suitable hardware frames context for the output.
Definition: opencl.c:83
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition: opt.h:267
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_OPENCL
@ AV_PIX_FMT_OPENCL
Hardware surfaces for OpenCL.
Definition: pixfmt.h:358
FF_FILTER_FLAG_HWFRAME_AWARE
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: filters.h:206
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AVFILTER_FLAG_HWDEVICE
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition: avfilter.h:173
nlmeans_opencl_inputs
static const AVFilterPad nlmeans_opencl_inputs[]
Definition: vf_nlmeans_opencl.c:413
nlmeans_opencl_uninit
static av_cold void nlmeans_opencl_uninit(AVFilterContext *avctx)
Definition: vf_nlmeans_opencl.c:380
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: opencl.c:46
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
ff_opencl_filter_init
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition: opencl.c:135
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
nlmeans_opencl_filter_frame
static int nlmeans_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
Definition: vf_nlmeans_opencl.c:286
OFFSET
#define OFFSET(x)
Definition: vf_nlmeans_opencl.c:400
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: filters.h:252