FFmpeg
Data Structures | Macros | Functions | Variables
vf_blackdetect_vulkan.c File Reference
#include <float.h>
#include "libavutil/opt.h"
#include "libavutil/timestamp.h"
#include "vulkan_filter.h"
#include "filters.h"

Go to the source code of this file.

Data Structures

struct  BlackDetectVulkanContext
 
struct  BlackDetectPushData
 
struct  BlackDetectBuf
 

Macros

#define SLICES   16
 
#define OFFSET(x)   offsetof(BlackDetectVulkanContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Functions

static av_cold int init_filter (AVFilterContext *ctx)
 
static void report_black_region (AVFilterContext *ctx, int64_t black_end)
 
static void evaluate (AVFilterLink *link, AVFrame *in, const BlackDetectBuf *sum)
 
static int blackdetect_vulkan_filter_frame (AVFilterLink *link, AVFrame *in)
 
static void blackdetect_vulkan_uninit (AVFilterContext *avctx)
 
static int config_output (AVFilterLink *outlink)
 
 AVFILTER_DEFINE_CLASS (blackdetect_vulkan)
 

Variables

const unsigned char ff_blackdetect_comp_spv_data []
 
const unsigned int ff_blackdetect_comp_spv_len
 
static const AVOption blackdetect_vulkan_options []
 
static const AVFilterPad blackdetect_vulkan_inputs []
 
static const AVFilterPad blackdetect_vulkan_outputs []
 
const FFFilter ff_vf_blackdetect_vulkan
 

Macro Definition Documentation

◆ SLICES

#define SLICES   16

Definition at line 56 of file vf_blackdetect_vulkan.c.

◆ OFFSET

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

Definition at line 365 of file vf_blackdetect_vulkan.c.

◆ FLAGS

Definition at line 366 of file vf_blackdetect_vulkan.c.

Function Documentation

◆ init_filter()

static av_cold int init_filter ( AVFilterContext ctx)
static

Definition at line 60 of file vf_blackdetect_vulkan.c.

Referenced by blackdetect_vulkan_filter_frame().

◆ report_black_region()

static void report_black_region ( AVFilterContext ctx,
int64_t  black_end 
)
static

Definition at line 121 of file vf_blackdetect_vulkan.c.

Referenced by blackdetect_vulkan_uninit(), and evaluate().

◆ evaluate()

static void evaluate ( AVFilterLink link,
AVFrame in,
const BlackDetectBuf sum 
)
static

Definition at line 137 of file vf_blackdetect_vulkan.c.

◆ blackdetect_vulkan_filter_frame()

static int blackdetect_vulkan_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 171 of file vf_blackdetect_vulkan.c.

◆ blackdetect_vulkan_uninit()

static void blackdetect_vulkan_uninit ( AVFilterContext avctx)
static

Definition at line 322 of file vf_blackdetect_vulkan.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 342 of file vf_blackdetect_vulkan.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( blackdetect_vulkan  )

Variable Documentation

◆ ff_blackdetect_comp_spv_data

const unsigned char ff_blackdetect_comp_spv_data[]

Referenced by init_filter().

◆ ff_blackdetect_comp_spv_len

const unsigned int ff_blackdetect_comp_spv_len

Referenced by init_filter().

◆ blackdetect_vulkan_options

const AVOption blackdetect_vulkan_options[]
static
Initial value:
= {
{ "d", "set minimum detected black duration in seconds", OFFSET(black_min_duration_time), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 0, DBL_MAX, FLAGS },
{ "black_min_duration", "set minimum detected black duration in seconds", OFFSET(black_min_duration_time), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 0, DBL_MAX, FLAGS },
{ "picture_black_ratio_th", "set the picture black ratio threshold", OFFSET(picture_black_ratio_th), AV_OPT_TYPE_DOUBLE, {.dbl=.98}, 0, 1, FLAGS },
{ "pic_th", "set the picture black ratio threshold", OFFSET(picture_black_ratio_th), AV_OPT_TYPE_DOUBLE, {.dbl=.98}, 0, 1, FLAGS },
{ "pixel_black_th", "set the pixel black threshold", OFFSET(pixel_black_th), AV_OPT_TYPE_DOUBLE, {.dbl=.10}, 0, 1, FLAGS },
{ "pix_th", "set the pixel black threshold", OFFSET(pixel_black_th), AV_OPT_TYPE_DOUBLE, {.dbl=.10}, 0, 1, FLAGS },
{ "alpha", "check alpha instead of luma", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 367 of file vf_blackdetect_vulkan.c.

◆ blackdetect_vulkan_inputs

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

Definition at line 380 of file vf_blackdetect_vulkan.c.

◆ blackdetect_vulkan_outputs

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

Definition at line 389 of file vf_blackdetect_vulkan.c.

◆ ff_vf_blackdetect_vulkan

const FFFilter ff_vf_blackdetect_vulkan
Initial value:
= {
.p.name = "blackdetect_vulkan",
.p.description = NULL_IF_CONFIG_SMALL("Detect video intervals that are (almost) black."),
.p.priv_class = &blackdetect_vulkan_class,
.priv_size = sizeof(BlackDetectVulkanContext),
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 397 of file vf_blackdetect_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: filters.h:208
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan_filter.c:233
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: filters.h:254
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_blackdetect_vulkan.c:342
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:379
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:265
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition: opt.h:267
NULL
#define NULL
Definition: coverity.c:32
blackdetect_vulkan_uninit
static void blackdetect_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_blackdetect_vulkan.c:322
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:551
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:188
OFFSET
#define OFFSET(x)
Definition: vf_blackdetect_vulkan.c:365
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
blackdetect_vulkan_outputs
static const AVFilterPad blackdetect_vulkan_outputs[]
Definition: vf_blackdetect_vulkan.c:389
blackdetect_vulkan_filter_frame
static int blackdetect_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_blackdetect_vulkan.c:171
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:264
blackdetect_vulkan_inputs
static const AVFilterPad blackdetect_vulkan_inputs[]
Definition: vf_blackdetect_vulkan.c:380
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:200
alpha
static const int16_t alpha[]
Definition: ilbcdata.h:55
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
FLAGS
#define FLAGS
Definition: vf_blackdetect_vulkan.c:366
BlackDetectVulkanContext
Definition: vf_blackdetect_vulkan.c:31