FFmpeg
Data Structures | Macros | Functions | Variables
vf_chromaber_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  ChromaticAberrationVulkanContext
 

Macros

#define CGROUPS   (int [3]){ 32, 32, 1 }
 
#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 process_frames (AVFilterContext *avctx, AVFrame *out_f, AVFrame *in_f)
 
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

◆ CGROUPS

#define CGROUPS   (int [3]){ 32, 32, 1 }

Definition at line 24 of file vf_chromaber_vulkan.c.

◆ OFFSET

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

Definition at line 314 of file vf_chromaber_vulkan.c.

◆ FLAGS

Definition at line 315 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().

◆ process_frames()

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

Definition at line 173 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 273 of file vf_chromaber_vulkan.c.

◆ chromaber_vulkan_uninit()

static void chromaber_vulkan_uninit ( AVFilterContext avctx)
static

Definition at line 305 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 316 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 324 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 333 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 341 of file vf_chromaber_vulkan.c.

r
const char * r
Definition: vf_curves.c:116
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:371
chromaber_vulkan_uninit
static void chromaber_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_chromaber_vulkan.c:305
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan_filter.c:184
OFFSET
#define OFFSET(x)
Definition: vf_chromaber_vulkan.c:314
b
#define b
Definition: input.c:40
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:346
init
static int init
Definition: av_tx.c:47
ChromaticAberrationVulkanContext
Definition: vf_chromaber_vulkan.c:26
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:315
g
const char * g
Definition: vf_curves.c:117
f
#define f(width, name)
Definition: cbs_vp9.c:255
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
opts
AVDictionary * opts
Definition: movenc.c:50
NULL
#define NULL
Definition: coverity.c:32
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan_filter.c:133
chromaber_vulkan_outputs
static const AVFilterPad chromaber_vulkan_outputs[]
Definition: vf_chromaber_vulkan.c:333
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:117
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:273
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
Definition: opt.h:227
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:181
pos
unsigned int pos
Definition: spdifenc.c:412
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:192
d
d
Definition: ffmpeg_filter.c:153
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:282
chromaber_vulkan_inputs
static const AVFilterPad chromaber_vulkan_inputs[]
Definition: vf_chromaber_vulkan.c:324