FFmpeg
Data Structures | Macros | Functions | Variables
vf_photosensitivity.c File Reference
#include <float.h>
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.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 query_formats (AVFilterContext *ctx)
 
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 []
 
static const AVFilterPad outputs []
 
AVFilter ff_vf_photosensitivity
 

Macro Definition Documentation

#define MAX_FRAMES   240

Definition at line 32 of file vf_photosensitivity.c.

#define GRID_SIZE   8

Definition at line 33 of file vf_photosensitivity.c.

Referenced by config_input(), convert_frame_partial(), and get_badness().

#define NUM_CHANNELS   3

Definition at line 34 of file vf_photosensitivity.c.

Referenced by convert_frame_partial(), and get_badness().

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

Definition at line 58 of file vf_photosensitivity.c.

Definition at line 59 of file vf_photosensitivity.c.

#define NUM_CELLS   (GRID_SIZE * GRID_SIZE)

Definition at line 93 of file vf_photosensitivity.c.

Referenced by convert_frame(), and convert_frame_partial().

Function Documentation

AVFILTER_DEFINE_CLASS ( photosensitivity  )
static int query_formats ( AVFilterContext ctx)
static

Definition at line 73 of file vf_photosensitivity.c.

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

Definition at line 95 of file vf_photosensitivity.c.

Referenced by convert_frame().

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

Definition at line 143 of file vf_photosensitivity.c.

Referenced by filter_frame().

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

Definition at line 159 of file vf_photosensitivity.c.

Referenced by blend_frame().

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

Definition at line 182 of file vf_photosensitivity.c.

Referenced by filter_frame().

static int get_badness ( PhotosensitivityFrame a,
PhotosensitivityFrame b 
)
static

Definition at line 191 of file vf_photosensitivity.c.

Referenced by filter_frame().

static int config_input ( AVFilterLink inlink)
static

Definition at line 207 of file vf_photosensitivity.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 218 of file vf_photosensitivity.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 307 of file vf_photosensitivity.c.

Variable Documentation

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 }
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
#define MAX_FRAMES
#define FLAGS

Definition at line 61 of file vf_photosensitivity.c.

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

Definition at line 314 of file vf_photosensitivity.c.

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 324 of file vf_photosensitivity.c.

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,
}
static int query_formats(AVFilterContext *ctx)
static const AVFilterPad inputs[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static av_cold void uninit(AVFilterContext *ctx)
static const AVFilterPad outputs[]

Definition at line 332 of file vf_photosensitivity.c.