FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Functions | Variables
vf_nlmeans_vulkan.c File Reference
#include "libavutil/mem.h"
#include "libavutil/random_seed.h"
#include "libavutil/vulkan_spirv.h"
#include "libavutil/opt.h"
#include "vulkan_filter.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  NLMeansVulkanContext
 
struct  NLMeansVulkanContext::nlmeans_opts
 
struct  IntegralPushData
 
struct  WeightsPushData
 
struct  DenoisePushData
 

Macros

#define TYPE_NAME   "vec4"
 
#define TYPE_ELEMS   4
 
#define TYPE_SIZE   (TYPE_ELEMS*4)
 
#define TYPE_BLOCK_ELEMS   16
 
#define TYPE_BLOCK_SIZE   (TYPE_SIZE * TYPE_BLOCK_ELEMS)
 
#define WG_SIZE   32
 
#define OFFSET(x)   offsetof(NLMeansVulkanContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Functions

static void shared_shd_def (FFVulkanShader *shd)
 
static av_cold int init_integral_pipeline (FFVulkanContext *vkctx, FFVkExecPool *exec, FFVulkanShader *shd_horizontal, FFVulkanShader *shd_vertical, FFVkSPIRVCompiler *spv, const AVPixFmtDescriptor *desc, int planes)
 
static av_cold int init_weights_pipeline (FFVulkanContext *vkctx, FFVkExecPool *exec, FFVulkanShader *shd, FFVkSPIRVCompiler *spv, const AVPixFmtDescriptor *desc, int planes)
 
static av_cold int init_denoise_pipeline (FFVulkanContext *vkctx, FFVkExecPool *exec, FFVulkanShader *shd, FFVkSPIRVCompiler *spv, const AVPixFmtDescriptor *desc, int planes)
 
static av_cold int init_filter (AVFilterContext *ctx)
 
static int denoise_pass (NLMeansVulkanContext *s, FFVkExecContext *exec, FFVkBuffer *ws_vk, uint32_t comp_offs[4], uint32_t comp_planes[4], uint32_t ws_offset[4], uint32_t ws_stride[4], uint32_t ws_count, uint32_t t, uint32_t nb_components)
 
static int nlmeans_vulkan_filter_frame (AVFilterLink *link, AVFrame *in)
 
static void nlmeans_vulkan_uninit (AVFilterContext *avctx)
 
 AVFILTER_DEFINE_CLASS (nlmeans_vulkan)
 

Variables

static const AVOption nlmeans_vulkan_options []
 
static const AVFilterPad nlmeans_vulkan_inputs []
 
static const AVFilterPad nlmeans_vulkan_outputs []
 
const FFFilter ff_vf_nlmeans_vulkan
 

Macro Definition Documentation

◆ TYPE_NAME

#define TYPE_NAME   "vec4"

Definition at line 30 of file vf_nlmeans_vulkan.c.

◆ TYPE_ELEMS

#define TYPE_ELEMS   4

Definition at line 31 of file vf_nlmeans_vulkan.c.

◆ TYPE_SIZE

#define TYPE_SIZE   (TYPE_ELEMS*4)

Definition at line 32 of file vf_nlmeans_vulkan.c.

◆ TYPE_BLOCK_ELEMS

#define TYPE_BLOCK_ELEMS   16

Definition at line 33 of file vf_nlmeans_vulkan.c.

◆ TYPE_BLOCK_SIZE

#define TYPE_BLOCK_SIZE   (TYPE_SIZE * TYPE_BLOCK_ELEMS)

Definition at line 34 of file vf_nlmeans_vulkan.c.

◆ WG_SIZE

#define WG_SIZE   32

Definition at line 35 of file vf_nlmeans_vulkan.c.

◆ OFFSET

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

Definition at line 1174 of file vf_nlmeans_vulkan.c.

◆ FLAGS

Definition at line 1175 of file vf_nlmeans_vulkan.c.

Function Documentation

◆ shared_shd_def()

static void shared_shd_def ( FFVulkanShader shd)
static

Definition at line 83 of file vf_nlmeans_vulkan.c.

Referenced by init_integral_pipeline().

◆ init_integral_pipeline()

static av_cold int init_integral_pipeline ( FFVulkanContext vkctx,
FFVkExecPool exec,
FFVulkanShader shd_horizontal,
FFVulkanShader shd_vertical,
FFVkSPIRVCompiler spv,
const AVPixFmtDescriptor desc,
int  planes 
)
static

Definition at line 118 of file vf_nlmeans_vulkan.c.

Referenced by init_filter().

◆ init_weights_pipeline()

static av_cold int init_weights_pipeline ( FFVulkanContext vkctx,
FFVkExecPool exec,
FFVulkanShader shd,
FFVkSPIRVCompiler spv,
const AVPixFmtDescriptor desc,
int  planes 
)
static

Definition at line 307 of file vf_nlmeans_vulkan.c.

Referenced by init_filter().

◆ init_denoise_pipeline()

static av_cold int init_denoise_pipeline ( FFVulkanContext vkctx,
FFVkExecPool exec,
FFVulkanShader shd,
FFVkSPIRVCompiler spv,
const AVPixFmtDescriptor desc,
int  planes 
)
static

Definition at line 487 of file vf_nlmeans_vulkan.c.

Referenced by init_filter().

◆ init_filter()

static av_cold int init_filter ( AVFilterContext ctx)
static

Definition at line 606 of file vf_nlmeans_vulkan.c.

Referenced by nlmeans_vulkan_filter_frame().

◆ denoise_pass()

static int denoise_pass ( NLMeansVulkanContext s,
FFVkExecContext exec,
FFVkBuffer ws_vk,
uint32_t  comp_offs[4],
uint32_t  comp_planes[4],
uint32_t  ws_offset[4],
uint32_t  ws_stride[4],
uint32_t  ws_count,
uint32_t  t,
uint32_t  nb_components 
)
static

Definition at line 736 of file vf_nlmeans_vulkan.c.

Referenced by nlmeans_vulkan_filter_frame().

◆ nlmeans_vulkan_filter_frame()

static int nlmeans_vulkan_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 794 of file vf_nlmeans_vulkan.c.

◆ nlmeans_vulkan_uninit()

static void nlmeans_vulkan_uninit ( AVFilterContext avctx)
static

Definition at line 1152 of file vf_nlmeans_vulkan.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( nlmeans_vulkan  )

Variable Documentation

◆ nlmeans_vulkan_options

const AVOption nlmeans_vulkan_options[]
static
Initial value:
= {
{ "s", "denoising strength for all components", OFFSET(opts.s), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0.0, 100.0, FLAGS },
{ "p", "patch size for all components", OFFSET(opts.p), AV_OPT_TYPE_INT, { .i64 = 3*2+1 }, 0, 99, FLAGS },
{ "r", "research window size", OFFSET(opts.r), AV_OPT_TYPE_INT, { .i64 = 7*2+1 }, 0, 99, FLAGS },
{ "t", "parallelism", OFFSET(opts.t), AV_OPT_TYPE_INT, { .i64 = 8 }, 1, 64, FLAGS },
{ "s1", "denoising strength for component 1", OFFSET(opts.sc[0]), AV_OPT_TYPE_DOUBLE, { .dbl = NAN }, 0.0, 100.0, FLAGS },
{ "s2", "denoising strength for component 2", OFFSET(opts.sc[1]), AV_OPT_TYPE_DOUBLE, { .dbl = NAN }, 0.0, 100.0, FLAGS },
{ "s3", "denoising strength for component 3", OFFSET(opts.sc[2]), AV_OPT_TYPE_DOUBLE, { .dbl = NAN }, 0.0, 100.0, FLAGS },
{ "s4", "denoising strength for component 4", OFFSET(opts.sc[3]), AV_OPT_TYPE_DOUBLE, { .dbl = NAN }, 0.0, 100.0, FLAGS },
{ "p1", "patch size for component 1", OFFSET(opts.pc[0]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 99, FLAGS },
{ "p2", "patch size for component 2", OFFSET(opts.pc[1]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 99, FLAGS },
{ "p3", "patch size for component 3", OFFSET(opts.pc[2]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 99, FLAGS },
{ "p4", "patch size for component 4", OFFSET(opts.pc[3]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 99, FLAGS },
{ NULL }
}

Definition at line 1176 of file vf_nlmeans_vulkan.c.

◆ nlmeans_vulkan_inputs

const AVFilterPad nlmeans_vulkan_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = &nlmeans_vulkan_filter_frame,
.config_props = &ff_vk_filter_config_input,
},
}

Definition at line 1197 of file vf_nlmeans_vulkan.c.

◆ nlmeans_vulkan_outputs

const AVFilterPad nlmeans_vulkan_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = &ff_vk_filter_config_output,
},
}

Definition at line 1206 of file vf_nlmeans_vulkan.c.

◆ ff_vf_nlmeans_vulkan

const FFFilter ff_vf_nlmeans_vulkan
Initial value:
= {
.p.name = "nlmeans_vulkan",
.p.description = NULL_IF_CONFIG_SMALL("Non-local means denoiser (Vulkan)"),
.p.priv_class = &nlmeans_vulkan_class,
.priv_size = sizeof(NLMeansVulkanContext),
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 1214 of file vf_nlmeans_vulkan.c.

FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:263
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan_filter.c:233
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:379
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition: opt.h:267
FLAGS
#define FLAGS
Definition: vf_nlmeans_vulkan.c:1175
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:264
NAN
#define NAN
Definition: mathematics.h:115
opts
AVDictionary * opts
Definition: movenc.c:51
NULL
#define NULL
Definition: coverity.c:32
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan_filter.c:209
nlmeans_vulkan_inputs
static const AVFilterPad nlmeans_vulkan_inputs[]
Definition: vf_nlmeans_vulkan.c:1197
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:207
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
NLMeansVulkanContext
Definition: vf_nlmeans_vulkan.c:37
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:188
nlmeans_vulkan_outputs
static const AVFilterPad nlmeans_vulkan_outputs[]
Definition: vf_nlmeans_vulkan.c:1206
nlmeans_vulkan_uninit
static void nlmeans_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_nlmeans_vulkan.c:1152
nlmeans_vulkan_filter_frame
static int nlmeans_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_nlmeans_vulkan.c:794
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
OFFSET
#define OFFSET(x)
Definition: vf_nlmeans_vulkan.c:1174
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
ff_vk_filter_config_input
int ff_vk_filter_config_input(AVFilterLink *inlink)
Definition: vulkan_filter.c:176
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: filters.h:253