FFmpeg
Data Structures | Macros | Functions | Variables
vf_chromaber_vulkan.c File Reference
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
#include "libavutil/vulkan_spirv.h"
#include "vulkan_filter.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  ChromaticAberrationVulkanContext
 

Macros

#define OFFSET(x)   offsetof(ChromaticAberrationVulkanContext, 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 chromaber_vulkan_filter_frame (AVFilterLink *link, AVFrame *in)
 
static void chromaber_vulkan_uninit (AVFilterContext *avctx)
 
 AVFILTER_DEFINE_CLASS (chromaber_vulkan)
 

Variables

static const char distort_chroma_kernel []
 
static const AVOption chromaber_vulkan_options []
 
static const AVFilterPad chromaber_vulkan_inputs []
 
static const AVFilterPad chromaber_vulkan_outputs []
 
const AVFilter ff_vf_chromaber_vulkan
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 225 of file vf_chromaber_vulkan.c.

◆ FLAGS

Definition at line 226 of file vf_chromaber_vulkan.c.

Function Documentation

◆ init_filter()

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

Definition at line 68 of file vf_chromaber_vulkan.c.

Referenced by chromaber_vulkan_filter_frame().

◆ chromaber_vulkan_filter_frame()

static int chromaber_vulkan_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 174 of file vf_chromaber_vulkan.c.

◆ chromaber_vulkan_uninit()

static void chromaber_vulkan_uninit ( AVFilterContext avctx)
static

Definition at line 207 of file vf_chromaber_vulkan.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( chromaber_vulkan  )

Variable Documentation

◆ distort_chroma_kernel

const char distort_chroma_kernel[]
static
Initial value:
= {
C(0, void distort_rgb(ivec2 size, ivec2 pos) )
C(0, { )
C(1, const vec2 p = ((vec2(pos)/vec2(size)) - 0.5f)*2.0f; )
C(1, const vec2 o = p * (dist - 1.0f); )
C(0, )
C(1, vec4 res; )
C(1, res.r = texture(input_img[0], ((p - o)/2.0f) + 0.5f).r; )
C(1, res.g = texture(input_img[0], ((p )/2.0f) + 0.5f).g; )
C(1, res.b = texture(input_img[0], ((p + o)/2.0f) + 0.5f).b; )
C(1, res.a = texture(input_img[0], ((p )/2.0f) + 0.5f).a; )
C(1, imageStore(output_img[0], pos, res); )
C(0, } )
C(0, )
C(0, void distort_chroma(int idx, ivec2 size, ivec2 pos) )
C(0, { )
C(1, vec2 p = ((vec2(pos)/vec2(size)) - 0.5f)*2.0f; )
C(1, float d = sqrt(p.x*p.x + p.y*p.y); )
C(1, p *= d / (d*dist); )
C(1, vec4 res = texture(input_img[idx], (p/2.0f) + 0.5f); )
C(1, imageStore(output_img[idx], pos, res); )
C(0, } )
}

Definition at line 44 of file vf_chromaber_vulkan.c.

Referenced by init_filter().

◆ chromaber_vulkan_options

const AVOption chromaber_vulkan_options[]
static
Initial value:
= {
{ "dist_x", "Set horizontal distortion amount", OFFSET(opts.dist[0]), AV_OPT_TYPE_FLOAT, {.dbl = 0.0f}, -10.0f, 10.0f, .flags = FLAGS },
{ "dist_y", "Set vertical distortion amount", OFFSET(opts.dist[1]), AV_OPT_TYPE_FLOAT, {.dbl = 0.0f}, -10.0f, 10.0f, .flags = FLAGS },
{ NULL },
}

Definition at line 227 of file vf_chromaber_vulkan.c.

◆ chromaber_vulkan_inputs

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

Definition at line 235 of file vf_chromaber_vulkan.c.

◆ chromaber_vulkan_outputs

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

Definition at line 244 of file vf_chromaber_vulkan.c.

◆ ff_vf_chromaber_vulkan

const AVFilter ff_vf_chromaber_vulkan
Initial value:
= {
.name = "chromaber_vulkan",
.description = NULL_IF_CONFIG_SMALL("Offset chroma of input video (chromatic aberration)"),
.priv_size = sizeof(ChromaticAberrationVulkanContext),
.priv_class = &chromaber_vulkan_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 252 of file vf_chromaber_vulkan.c.

r
const char * r
Definition: vf_curves.c:127
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
chromaber_vulkan_uninit
static void chromaber_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_chromaber_vulkan.c:207
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan_filter.c:233
OFFSET
#define OFFSET(x)
Definition: vf_chromaber_vulkan.c:225
b
#define b
Definition: input.c:41
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:379
ChromaticAberrationVulkanContext
Definition: vf_chromaber_vulkan.c:29
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
FLAGS
#define FLAGS
Definition: vf_chromaber_vulkan.c:226
g
const char * g
Definition: vf_curves.c:128
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
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
chromaber_vulkan_outputs
static const AVFilterPad chromaber_vulkan_outputs[]
Definition: vf_chromaber_vulkan.c:244
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
f
f
Definition: af_crystalizer.c:122
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
size
int size
Definition: twinvq_data.h:10344
chromaber_vulkan_filter_frame
static int chromaber_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_chromaber_vulkan.c:174
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
pos
unsigned int pos
Definition: spdifenc.c:414
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:201
chromaber_vulkan_inputs
static const AVFilterPad chromaber_vulkan_inputs[]
Definition: vf_chromaber_vulkan.c:235
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: filters.h:252