FFmpeg
Data Structures | Macros | Functions | Variables
vf_chromaber_vulkan.c File Reference
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
#include "vulkan.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 []
 
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 307 of file vf_chromaber_vulkan.c.

◆ FLAGS

Definition at line 308 of file vf_chromaber_vulkan.c.

Function Documentation

◆ init_filter()

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

Definition at line 67 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 172 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 266 of file vf_chromaber_vulkan.c.

◆ chromaber_vulkan_uninit()

static void chromaber_vulkan_uninit ( AVFilterContext avctx)
static

Definition at line 298 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 43 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 309 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,
},
{ NULL }
}

Definition at line 317 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,
},
{ NULL }
}

Definition at line 327 of file vf_chromaber_vulkan.c.

◆ ff_vf_chromaber_vulkan

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 336 of file vf_chromaber_vulkan.c.

ff_vk_filter_query_formats
int ff_vk_filter_query_formats(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan.c:592
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
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:339
chromaber_vulkan_uninit
static void chromaber_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_chromaber_vulkan.c:298
OFFSET
#define OFFSET(x)
Definition: vf_chromaber_vulkan.c:307
b
#define b
Definition: input.c:41
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:308
ff_vk_filter_config_input
int ff_vk_filter_config_input(AVFilterLink *inlink)
Definition: vulkan.c:635
g
const char * g
Definition: vf_curves.c:117
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
f
#define f(width, name)
Definition: cbs_vp9.c:255
opts
AVDictionary * opts
Definition: movenc.c:50
NULL
#define NULL
Definition: coverity.c:32
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
chromaber_vulkan_outputs
static const AVFilterPad chromaber_vulkan_outputs[]
Definition: vf_chromaber_vulkan.c:327
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:266
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
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
Definition: vulkan.c:756
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
pos
unsigned int pos
Definition: spdifenc.c:412
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:243
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
chromaber_vulkan_inputs
static const AVFilterPad chromaber_vulkan_inputs[]
Definition: vf_chromaber_vulkan.c:317
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan.c:705