FFmpeg
Data Structures | Macros | Functions | Variables
vf_avgblur_vulkan.c File Reference
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
#include "vulkan_filter.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  AvgBlurVulkanContext
 

Macros

#define CGS   32
 
#define OFFSET(x)   offsetof(AvgBlurVulkanContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Functions

static av_cold int init_filter (AVFilterContext *ctx, AVFrame *in)
 
static int process_frames (AVFilterContext *avctx, AVFrame *out_f, AVFrame *tmp_f, AVFrame *in_f)
 
static int avgblur_vulkan_filter_frame (AVFilterLink *link, AVFrame *in)
 
static void avgblur_vulkan_uninit (AVFilterContext *avctx)
 
 AVFILTER_DEFINE_CLASS (avgblur_vulkan)
 

Variables

static const char blur_kernel []
 
static const AVOption avgblur_vulkan_options []
 
static const AVFilterPad avgblur_vulkan_inputs []
 
static const AVFilterPad avgblur_vulkan_outputs []
 
const AVFilter ff_vf_avgblur_vulkan
 

Macro Definition Documentation

◆ CGS

#define CGS   32

Definition at line 24 of file vf_avgblur_vulkan.c.

◆ OFFSET

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

Definition at line 382 of file vf_avgblur_vulkan.c.

◆ FLAGS

Definition at line 383 of file vf_avgblur_vulkan.c.

Function Documentation

◆ init_filter()

static av_cold int init_filter ( AVFilterContext ctx,
AVFrame in 
)
static

Definition at line 71 of file vf_avgblur_vulkan.c.

Referenced by avgblur_vulkan_filter_frame().

◆ process_frames()

static int process_frames ( AVFilterContext avctx,
AVFrame out_f,
AVFrame tmp_f,
AVFrame in_f 
)
static

Definition at line 205 of file vf_avgblur_vulkan.c.

Referenced by avgblur_vulkan_filter_frame().

◆ avgblur_vulkan_filter_frame()

static int avgblur_vulkan_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 332 of file vf_avgblur_vulkan.c.

◆ avgblur_vulkan_uninit()

static void avgblur_vulkan_uninit ( AVFilterContext avctx)
static

Definition at line 373 of file vf_avgblur_vulkan.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( avgblur_vulkan  )

Variable Documentation

◆ blur_kernel

const char blur_kernel[]
static
Initial value:
= {
C(0, shared vec4 cache[DIR(gl_WorkGroupSize) + FILTER_RADIUS*2 + 1]; )
C(0, )
C(0, void distort(const ivec2 pos, const int idx) )
C(0, { )
C(1, const uint cp = DIR(gl_LocalInvocationID) + FILTER_RADIUS; )
C(0, )
C(1, cache[cp] = texture(input_img[idx], pos); )
C(0, )
C(1, const ivec2 loc_l = pos - INC(FILTER_RADIUS); )
C(1, cache[cp - FILTER_RADIUS] = texture(input_img[idx], loc_l); )
C(0, )
C(1, const ivec2 loc_h = pos + INC(DIR(gl_WorkGroupSize)); )
C(1, cache[cp + DIR(gl_WorkGroupSize)] = texture(input_img[idx], loc_h); )
C(0, )
C(1, barrier(); )
C(0, )
C(1, vec4 sum = vec4(0); )
C(1, for (int p = -FILTER_RADIUS; p <= FILTER_RADIUS; p++) )
C(2, sum += cache[cp + p]; )
C(0, )
C(1, sum /= vec4(FILTER_RADIUS*2 + 1); )
C(1, imageStore(output_img[idx], pos, sum); )
C(0, } )
}

Definition at line 45 of file vf_avgblur_vulkan.c.

Referenced by init_filter().

◆ avgblur_vulkan_options

const AVOption avgblur_vulkan_options[]
static
Initial value:
= {
{ "sizeX", "Set horizontal radius", OFFSET(size_x), AV_OPT_TYPE_INT, {.i64 = 3}, 1, 32, .flags = FLAGS },
{ "planes", "Set planes to filter (bitmask)", OFFSET(planes), AV_OPT_TYPE_INT, {.i64 = 0xF}, 0, 0xF, .flags = FLAGS },
{ "sizeY", "Set vertical radius", OFFSET(size_y), AV_OPT_TYPE_INT, {.i64 = 3}, 1, 32, .flags = FLAGS },
{ NULL },
}

Definition at line 384 of file vf_avgblur_vulkan.c.

◆ avgblur_vulkan_inputs

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

Definition at line 393 of file vf_avgblur_vulkan.c.

◆ avgblur_vulkan_outputs

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

Definition at line 402 of file vf_avgblur_vulkan.c.

◆ ff_vf_avgblur_vulkan

const AVFilter ff_vf_avgblur_vulkan
Initial value:
= {
.name = "avgblur_vulkan",
.description = NULL_IF_CONFIG_SMALL("Apply avgblur mask to input video"),
.priv_size = sizeof(AvgBlurVulkanContext),
.priv_class = &avgblur_vulkan_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 410 of file vf_avgblur_vulkan.c.

planes
static const struct @346 planes[]
AvgBlurVulkanContext
Definition: vf_avgblur_vulkan.c:26
FLAGS
#define FLAGS
Definition: vf_avgblur_vulkan.c:383
avgblur_vulkan_outputs
static const AVFilterPad avgblur_vulkan_outputs[]
Definition: vf_avgblur_vulkan.c:402
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: internal.h:374
avgblur_vulkan_inputs
static const AVFilterPad avgblur_vulkan_inputs[]
Definition: vf_avgblur_vulkan.c:393
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan_filter.c:184
avgblur_vulkan_uninit
static void avgblur_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_avgblur_vulkan.c:373
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:376
C
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
Definition: writing_filters.txt:58
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:194
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: vf_avgblur_vulkan.c:382
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan_filter.c:133
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:115
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:184
pos
unsigned int pos
Definition: spdifenc.c:413
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avgblur_vulkan_filter_frame
static int avgblur_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_avgblur_vulkan.c:332
ff_vk_filter_config_input
int ff_vk_filter_config_input(AVFilterLink *inlink)
Definition: vulkan_filter.c:52
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:195
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:285