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

Go to the source code of this file.

Data Structures

struct  FilterParamsVulkan
 
struct  BlendVulkanContext
 

Macros

#define CGS   32
 
#define IN_TOP   0
 
#define IN_BOTTOM   1
 
#define DEFINE_BLEND_MODE(MODE, EXPR)
 
#define A   top
 
#define B   bottom
 
#define FN(EXPR)   A + ((EXPR) - A) * opacity
 
#define CASE(MODE)
 
#define OFFSET(x)   offsetof(BlendVulkanContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Functions

static void init_blend_func (FilterParamsVulkan *param)
 
static int config_params (AVFilterContext *avctx)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 
static av_cold int init_filter (AVFilterContext *avctx)
 
static int process_frames (AVFilterContext *avctx, AVFrame *out_frame, AVFrame *top_frame, AVFrame *bottom_frame)
 
static int blend_frame (FFFrameSync *fs)
 
static av_cold int init (AVFilterContext *avctx)
 
static av_cold void uninit (AVFilterContext *avctx)
 
static int config_props_output (AVFilterLink *outlink)
 
static int activate (AVFilterContext *avctx)
 
 AVFILTER_DEFINE_CLASS (blend_vulkan)
 

Variables

static const AVOption blend_vulkan_options []
 
static const AVFilterPad blend_vulkan_inputs []
 
static const AVFilterPad blend_vulkan_outputs []
 
const AVFilter ff_vf_blend_vulkan
 

Macro Definition Documentation

◆ CGS

#define CGS   32

Definition at line 29 of file vf_blend_vulkan.c.

◆ IN_TOP

#define IN_TOP   0

Definition at line 31 of file vf_blend_vulkan.c.

◆ IN_BOTTOM

#define IN_BOTTOM   1

Definition at line 32 of file vf_blend_vulkan.c.

◆ DEFINE_BLEND_MODE

#define DEFINE_BLEND_MODE (   MODE,
  EXPR 
)
Value:
static const char blend_##MODE[] = "blend_"#MODE; \
static const char blend_##MODE##_func[] = { \
C(0, vec4 blend_##MODE(vec4 top, vec4 bottom, float opacity) { ) \
C(1, vec4 dst = EXPR; ) \
C(1, return dst; ) \
C(0, } ) \
};

Definition at line 59 of file vf_blend_vulkan.c.

◆ A

#define A   top

Definition at line 68 of file vf_blend_vulkan.c.

◆ B

#define B   bottom

Definition at line 69 of file vf_blend_vulkan.c.

◆ FN

#define FN (   EXPR)    A + ((EXPR) - A) * opacity

Definition at line 71 of file vf_blend_vulkan.c.

◆ CASE

#define CASE (   MODE)
Value:
case BLEND_##MODE: \
param->blend = blend_##MODE;\
param->blend_func = blend_##MODE##_func; \
break;

◆ OFFSET

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

Definition at line 446 of file vf_blend_vulkan.c.

◆ FLAGS

Definition at line 447 of file vf_blend_vulkan.c.

Function Documentation

◆ init_blend_func()

static void init_blend_func ( FilterParamsVulkan param)
inlinestatic

Definition at line 76 of file vf_blend_vulkan.c.

Referenced by config_params().

◆ config_params()

static int config_params ( AVFilterContext avctx)
static

Definition at line 92 of file vf_blend_vulkan.c.

Referenced by config_props_output(), and process_command().

◆ process_command()

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  args,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 115 of file vf_blend_vulkan.c.

◆ init_filter()

static av_cold int init_filter ( AVFilterContext avctx)
static

Definition at line 125 of file vf_blend_vulkan.c.

Referenced by blend_frame().

◆ process_frames()

static int process_frames ( AVFilterContext avctx,
AVFrame out_frame,
AVFrame top_frame,
AVFrame bottom_frame 
)
static

Definition at line 224 of file vf_blend_vulkan.c.

Referenced by blend_frame().

◆ blend_frame()

static int blend_frame ( FFFrameSync fs)
static

Definition at line 348 of file vf_blend_vulkan.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext avctx)
static

Definition at line 387 of file vf_blend_vulkan.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext avctx)
static

Definition at line 396 of file vf_blend_vulkan.c.

◆ config_props_output()

static int config_props_output ( AVFilterLink outlink)
static

Definition at line 407 of file vf_blend_vulkan.c.

◆ activate()

static int activate ( AVFilterContext avctx)
static

Definition at line 440 of file vf_blend_vulkan.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( blend_vulkan  )

Variable Documentation

◆ blend_vulkan_options

const AVOption blend_vulkan_options[]
static
Initial value:
= {
{ "c0_mode", "set component #0 blend mode", OFFSET(params[0].mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, "mode" },
{ "c1_mode", "set component #1 blend mode", OFFSET(params[1].mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, "mode" },
{ "c2_mode", "set component #2 blend mode", OFFSET(params[2].mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, "mode" },
{ "c3_mode", "set component #3 blend mode", OFFSET(params[3].mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, "mode" },
{ "all_mode", "set blend mode for all components", OFFSET(all_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, BLEND_NB - 1, FLAGS, "mode" },
{ "normal", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_NORMAL }, 0, 0, FLAGS, "mode" },
{ "multiply", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_MULTIPLY }, 0, 0, FLAGS, "mode" },
{ "c0_opacity", "set color component #0 opacity", OFFSET(params[0].opacity), AV_OPT_TYPE_DOUBLE, { .dbl = 1 }, 0, 1, FLAGS },
{ "c1_opacity", "set color component #1 opacity", OFFSET(params[1].opacity), AV_OPT_TYPE_DOUBLE, { .dbl = 1 }, 0, 1, FLAGS },
{ "c2_opacity", "set color component #2 opacity", OFFSET(params[2].opacity), AV_OPT_TYPE_DOUBLE, { .dbl = 1 }, 0, 1, FLAGS },
{ "c3_opacity", "set color component #3 opacity", OFFSET(params[3].opacity), AV_OPT_TYPE_DOUBLE, { .dbl = 1 }, 0, 1, FLAGS },
{ "all_opacity", "set opacity for all color components", OFFSET(all_opacity), AV_OPT_TYPE_DOUBLE, { .dbl = 1 }, 0, 1, FLAGS },
{ NULL }
}

Definition at line 449 of file vf_blend_vulkan.c.

◆ blend_vulkan_inputs

const AVFilterPad blend_vulkan_inputs[]
static
Initial value:
= {
{
.name = "top",
.config_props = &ff_vk_filter_config_input,
},
{
.name = "bottom",
.config_props = &ff_vk_filter_config_input,
},
}

Definition at line 469 of file vf_blend_vulkan.c.

◆ blend_vulkan_outputs

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

Definition at line 483 of file vf_blend_vulkan.c.

◆ ff_vf_blend_vulkan

const AVFilter ff_vf_blend_vulkan
Initial value:
= {
.name = "blend_vulkan",
.description = NULL_IF_CONFIG_SMALL("Blend two video frames in Vulkan"),
.priv_size = sizeof(BlendVulkanContext),
.init = &init,
.priv_class = &blend_vulkan_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
.process_command = &process_command,
}

Definition at line 491 of file vf_blend_vulkan.c.

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:370
config_props_output
static int config_props_output(AVFilterLink *outlink)
Definition: vf_blend_vulkan.c:407
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:348
BLEND_NB
@ BLEND_NB
Definition: blend.h:69
init
static av_cold int init(AVFilterContext *avctx)
Definition: vf_blend_vulkan.c:387
blend_vulkan_outputs
static const AVFilterPad blend_vulkan_outputs[]
Definition: vf_blend_vulkan.c:483
OFFSET
#define OFFSET(x)
Definition: vf_blend_vulkan.c:446
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
blend_vulkan_inputs
static const AVFilterPad blend_vulkan_inputs[]
Definition: vf_blend_vulkan.c:469
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
activate
static int activate(AVFilterContext *avctx)
Definition: vf_blend_vulkan.c:440
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
NULL
#define NULL
Definition: coverity.c:32
BLEND_MULTIPLY
@ BLEND_MULTIPLY
Definition: blend.h:42
BlendVulkanContext
Definition: vf_blend_vulkan.c:41
FLAGS
#define FLAGS
Definition: vf_blend_vulkan.c:447
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
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:180
uninit
static av_cold void uninit(AVFilterContext *avctx)
Definition: vf_blend_vulkan.c:396
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_blend_vulkan.c:115
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:191
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
BLEND_NORMAL
@ BLEND_NORMAL
Definition: blend.h:29