FFmpeg
Loading...
Searching...
No Matches
vf_nlmeans_vulkan.c File Reference
#include "libavutil/mem.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_ELEMS   4
 
#define TYPE_SIZE   (TYPE_ELEMS*4)
 
#define WG_SIZE   32
 
#define OFFSET(x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Functions

static av_cold int init_integral_pipeline (FFVulkanContext *vkctx, FFVkExecPool *exec, FFVulkanShader *shd_horizontal, FFVulkanShader *shd_vertical, int planes)
 
static av_cold int init_weights_pipeline (FFVulkanContext *vkctx, FFVkExecPool *exec, FFVulkanShader *shd, int planes)
 
static av_cold int init_denoise_pipeline (FFVulkanContext *vkctx, FFVkExecPool *exec, FFVulkanShader *shd, 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

const unsigned char ff_nlmeans_horizontal_comp_spv_data []
 
const unsigned int ff_nlmeans_horizontal_comp_spv_len
 
const unsigned char ff_nlmeans_vertical_comp_spv_data []
 
const unsigned int ff_nlmeans_vertical_comp_spv_len
 
const unsigned char ff_nlmeans_weights_comp_spv_data []
 
const unsigned int ff_nlmeans_weights_comp_spv_len
 
const unsigned char ff_nlmeans_denoise_comp_spv_data []
 
const unsigned int ff_nlmeans_denoise_comp_spv_len
 
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_ELEMS

#define TYPE_ELEMS   4

Definition at line 38 of file vf_nlmeans_vulkan.c.

Referenced by init_filter(), and nlmeans_vulkan_filter_frame().

◆ TYPE_SIZE

#define TYPE_SIZE   (TYPE_ELEMS*4)

Definition at line 39 of file vf_nlmeans_vulkan.c.

Referenced by nlmeans_vulkan_filter_frame().

◆ WG_SIZE

#define WG_SIZE   32

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 772 of file vf_nlmeans_vulkan.c.

◆ FLAGS

Definition at line 773 of file vf_nlmeans_vulkan.c.

Function Documentation

◆ init_integral_pipeline()

static av_cold int init_integral_pipeline ( FFVulkanContext * vkctx,
FFVkExecPool * exec,
FFVulkanShader * shd_horizontal,
FFVulkanShader * shd_vertical,
int planes )
static

Definition at line 88 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,
int planes )
static

Definition at line 162 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,
int planes )
static

Definition at line 218 of file vf_nlmeans_vulkan.c.

Referenced by init_filter().

◆ init_filter()

static av_cold int init_filter ( AVFilterContext * ctx)
static

Definition at line 265 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 379 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 426 of file vf_nlmeans_vulkan.c.

◆ nlmeans_vulkan_uninit()

static void nlmeans_vulkan_uninit ( AVFilterContext * avctx)
static

Definition at line 750 of file vf_nlmeans_vulkan.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( nlmeans_vulkan )

Variable Documentation

◆ ff_nlmeans_horizontal_comp_spv_data

const unsigned char ff_nlmeans_horizontal_comp_spv_data[]
extern

Referenced by init_integral_pipeline().

◆ ff_nlmeans_horizontal_comp_spv_len

const unsigned int ff_nlmeans_horizontal_comp_spv_len
extern

Referenced by init_integral_pipeline().

◆ ff_nlmeans_vertical_comp_spv_data

const unsigned char ff_nlmeans_vertical_comp_spv_data[]
extern

Referenced by init_integral_pipeline().

◆ ff_nlmeans_vertical_comp_spv_len

const unsigned int ff_nlmeans_vertical_comp_spv_len
extern

Referenced by init_integral_pipeline().

◆ ff_nlmeans_weights_comp_spv_data

const unsigned char ff_nlmeans_weights_comp_spv_data[]
extern

Referenced by init_weights_pipeline().

◆ ff_nlmeans_weights_comp_spv_len

const unsigned int ff_nlmeans_weights_comp_spv_len
extern

Referenced by init_weights_pipeline().

◆ ff_nlmeans_denoise_comp_spv_data

const unsigned char ff_nlmeans_denoise_comp_spv_data[]
extern

Referenced by init_denoise_pipeline().

◆ ff_nlmeans_denoise_comp_spv_len

const unsigned int ff_nlmeans_denoise_comp_spv_len
extern

Referenced by init_denoise_pipeline().

◆ 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 }
}
static AVDictionary * opts
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
#define NAN

Definition at line 774 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,
},
}
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int nlmeans_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
int ff_vk_filter_config_input(AVFilterLink *inlink)

Definition at line 795 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,
},
}
int ff_vk_filter_config_output(AVFilterLink *outlink)

Definition at line 804 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,
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition avfilter.h:187
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#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:208
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition pixfmt.h:379
static void nlmeans_vulkan_uninit(AVFilterContext *avctx)
static const AVFilterPad nlmeans_vulkan_inputs[]
static const AVFilterPad nlmeans_vulkan_outputs[]
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.

Definition at line 812 of file vf_nlmeans_vulkan.c.