FFmpeg
Data Structures | Macros | Functions | Variables
vf_photosensitivity.c File Reference
#include <float.h>
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  PhotosensitivityFrame
 
struct  PhotosensitivityContext
 
struct  ThreadData_convert_frame
 
struct  ThreadData_blend_frame
 

Macros

#define MAX_FRAMES   240
 
#define GRID_SIZE   8
 
#define NUM_CHANNELS   3
 
#define OFFSET(x)   offsetof(PhotosensitivityContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define NUM_CELLS   (GRID_SIZE * GRID_SIZE)
 

Functions

 AVFILTER_DEFINE_CLASS (photosensitivity)
 
static int convert_frame_partial (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static void convert_frame (AVFilterContext *ctx, AVFrame *in, PhotosensitivityFrame *out, int skip)
 
static int blend_frame_partial (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static void blend_frame (AVFilterContext *ctx, AVFrame *target, AVFrame *source, float factor)
 
static int get_badness (PhotosensitivityFrame *a, PhotosensitivityFrame *b)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption photosensitivity_options []
 
static const AVFilterPad inputs []
 
const AVFilter ff_vf_photosensitivity
 

Macro Definition Documentation

◆ MAX_FRAMES

#define MAX_FRAMES   240

Definition at line 30 of file vf_photosensitivity.c.

◆ GRID_SIZE

#define GRID_SIZE   8

Definition at line 31 of file vf_photosensitivity.c.

◆ NUM_CHANNELS

#define NUM_CHANNELS   3

Definition at line 32 of file vf_photosensitivity.c.

◆ OFFSET

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

Definition at line 56 of file vf_photosensitivity.c.

◆ FLAGS

Definition at line 57 of file vf_photosensitivity.c.

◆ NUM_CELLS

#define NUM_CELLS   (GRID_SIZE * GRID_SIZE)

Definition at line 78 of file vf_photosensitivity.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( photosensitivity  )

◆ convert_frame_partial()

static int convert_frame_partial ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 80 of file vf_photosensitivity.c.

Referenced by convert_frame().

◆ convert_frame()

static void convert_frame ( AVFilterContext ctx,
AVFrame in,
PhotosensitivityFrame out,
int  skip 
)
static

Definition at line 128 of file vf_photosensitivity.c.

Referenced by filter_frame().

◆ blend_frame_partial()

static int blend_frame_partial ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 145 of file vf_photosensitivity.c.

Referenced by blend_frame().

◆ blend_frame()

static void blend_frame ( AVFilterContext ctx,
AVFrame target,
AVFrame source,
float  factor 
)
static

Definition at line 168 of file vf_photosensitivity.c.

Referenced by filter_frame().

◆ get_badness()

static int get_badness ( PhotosensitivityFrame a,
PhotosensitivityFrame b 
)
static

Definition at line 178 of file vf_photosensitivity.c.

Referenced by filter_frame().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 194 of file vf_photosensitivity.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 205 of file vf_photosensitivity.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 294 of file vf_photosensitivity.c.

Variable Documentation

◆ photosensitivity_options

const AVOption photosensitivity_options[]
static
Initial value:
= {
{ "frames", "set how many frames to use", OFFSET(nb_frames), AV_OPT_TYPE_INT, {.i64=30}, 2, MAX_FRAMES, FLAGS },
{ "f", "set how many frames to use", OFFSET(nb_frames), AV_OPT_TYPE_INT, {.i64=30}, 2, MAX_FRAMES, FLAGS },
{ "threshold", "set detection threshold factor (lower is stricter)", OFFSET(threshold_multiplier), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0.1, FLT_MAX, FLAGS },
{ "t", "set detection threshold factor (lower is stricter)", OFFSET(threshold_multiplier), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0.1, FLT_MAX, FLAGS },
{ "skip", "set pixels to skip when sampling frames", OFFSET(skip), AV_OPT_TYPE_INT, {.i64=1}, 1, 1024, FLAGS },
{ "bypass", "leave frames unchanged", OFFSET(bypass), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 59 of file vf_photosensitivity.c.

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}

Definition at line 301 of file vf_photosensitivity.c.

◆ ff_vf_photosensitivity

const AVFilter ff_vf_photosensitivity
Initial value:
= {
.name = "photosensitivity",
.description = NULL_IF_CONFIG_SMALL("Filter out photosensitive epilepsy seizure-inducing flashes."),
.priv_size = sizeof(PhotosensitivityContext),
.priv_class = &photosensitivity_class,
}

Definition at line 310 of file vf_photosensitivity.c.

config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_photosensitivity.c:194
PhotosensitivityContext
Definition: vf_photosensitivity.c:38
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_photosensitivity.c:294
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:36
OFFSET
#define OFFSET(x)
Definition: vf_photosensitivity.c:56
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:192
NULL
#define NULL
Definition: coverity.c:32
FLAGS
#define FLAGS
Definition: vf_photosensitivity.c:57
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
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:106
FILTER_PIXFMTS
#define FILTER_PIXFMTS(...)
Definition: internal.h:178
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_photosensitivity.c:205
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
MAX_FRAMES
#define MAX_FRAMES
Definition: vf_photosensitivity.c:30
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
inputs
static const AVFilterPad inputs[]
Definition: vf_photosensitivity.c:301
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:193
skip
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
Definition: bitstream_template.h:375