FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vf_noise.c File Reference

noise generator More...

#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/lfg.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "vf_noise.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  ThreadData
 

Macros

#define OFFSET(x)   offsetof(NoiseContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define NOISE_PARAMS(name, x, param)
 
#define RAND_N(range)   ((int) ((double) range * av_lfg_get(lfg) / (UINT_MAX + 1.0)))
 

Functions

 AVFILTER_DEFINE_CLASS (noise)
 
static av_cold int init_noise (NoiseContext *n, int comp)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
void ff_line_noise_c (uint8_t *dst, const uint8_t *src, const int8_t *noise, int len, int shift)
 
void ff_line_noise_avg_c (uint8_t *dst, const uint8_t *src, int len, const int8_t *const *shift)
 
static void noise (uint8_t *dst, const uint8_t *src, int dst_linesize, int src_linesize, int width, int start, int end, NoiseContext *n, int comp)
 
static int filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *inpicref)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption noise_options []
 
static const int8_t patt [4] = { -1, 0, 1, 0 }
 
static const AVFilterPad noise_inputs []
 
static const AVFilterPad noise_outputs []
 
AVFilter ff_vf_noise
 

Detailed Description

noise generator

Definition in file vf_noise.c.

Macro Definition Documentation

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

Definition at line 42 of file vf_noise.c.

Definition at line 43 of file vf_noise.c.

#define NOISE_PARAMS (   name,
  x,
  param 
)
Value:
{#name"_seed", "set component #"#x" noise seed", OFFSET(param.seed), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, FLAGS}, \
{#name"_strength", "set component #"#x" strength", OFFSET(param.strength), AV_OPT_TYPE_INT, {.i64=0}, 0, 100, FLAGS}, \
{#name"s", "set component #"#x" strength", OFFSET(param.strength), AV_OPT_TYPE_INT, {.i64=0}, 0, 100, FLAGS}, \
{#name"_flags", "set component #"#x" flags", OFFSET(param.flags), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, 31, FLAGS, #name"_flags"}, \
{#name"f", "set component #"#x" flags", OFFSET(param.flags), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, 31, FLAGS, #name"_flags"}, \
{"a", "averaged noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_AVERAGED}, 0, 0, FLAGS, #name"_flags"}, \
{"p", "(semi)regular pattern", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_PATTERN}, 0, 0, FLAGS, #name"_flags"}, \
{"t", "temporal noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_TEMPORAL}, 0, 0, FLAGS, #name"_flags"}, \
{"u", "uniform noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_UNIFORM}, 0, 0, FLAGS, #name"_flags"},
#define NOISE_TEMPORAL
Definition: vf_noise.h:33
#define NOISE_PATTERN
Definition: vf_noise.h:35
#define OFFSET(x)
Definition: vf_noise.c:42
#define NOISE_AVERAGED
Definition: vf_noise.h:34
#define FLAGS
Definition: vf_noise.c:43
const char * name
Definition: opengl_enc.c:103
#define NOISE_UNIFORM
Definition: vf_noise.h:32

Definition at line 45 of file vf_noise.c.

#define RAND_N (   range)    ((int) ((double) range * av_lfg_get(lfg) / (UINT_MAX + 1.0)))

Definition at line 69 of file vf_noise.c.

Referenced by init_noise().

Function Documentation

AVFILTER_DEFINE_CLASS ( noise  )
static av_cold int init_noise ( NoiseContext n,
int  comp 
)
static

Definition at line 70 of file vf_noise.c.

Referenced by init().

static int query_formats ( AVFilterContext ctx)
static

Definition at line 133 of file vf_noise.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 148 of file vf_noise.c.

void ff_line_noise_c ( uint8_t dst,
const uint8_t src,
const int8_t *  noise,
int  len,
int  shift 
)

Definition at line 165 of file vf_noise.c.

Referenced by init().

void ff_line_noise_avg_c ( uint8_t dst,
const uint8_t src,
int  len,
const int8_t *const *  shift 
)

Definition at line 178 of file vf_noise.c.

Referenced by init().

static void noise ( uint8_t dst,
const uint8_t src,
int  dst_linesize,
int  src_linesize,
int  width,
int  start,
int  end,
NoiseContext n,
int  comp 
)
static

Definition at line 190 of file vf_noise.c.

Referenced by filter_slice(), and init_noise().

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

Definition at line 224 of file vf_noise.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame inpicref 
)
static

Definition at line 242 of file vf_noise.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 283 of file vf_noise.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 313 of file vf_noise.c.

Variable Documentation

const AVOption noise_options[]
static
Initial value:
= {
NOISE_PARAMS(c3, 3, param[3])
{NULL}
}
#define NULL
Definition: coverity.c:32
#define NOISE_PARAMS(name, x, param)
Definition: vf_noise.c:45

Definition at line 56 of file vf_noise.c.

const int8_t patt[4] = { -1, 0, 1, 0 }
static

Definition at line 67 of file vf_noise.c.

Referenced by filter_frame(), get_rdelta(), and init_noise().

const AVFilterPad noise_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)
Definition: vf_noise.c:148
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
Definition: vf_noise.c:242

Definition at line 322 of file vf_noise.c.

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

Definition at line 332 of file vf_noise.c.

AVFilter ff_vf_noise
Initial value:
= {
.name = "noise",
.description = NULL_IF_CONFIG_SMALL("Add noise."),
.priv_size = sizeof(NoiseContext),
.init = init,
.priv_class = &noise_class,
}
static const AVFilterPad noise_inputs[]
Definition: vf_noise.c:322
static int query_formats(AVFilterContext *ctx)
Definition: vf_noise.c:133
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:122
static const AVFilterPad noise_outputs[]
Definition: vf_noise.c:332
static av_cold int init(AVFilterContext *ctx)
Definition: vf_noise.c:283
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:113
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:385
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:375
static int flags
Definition: cpu.c:47
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_noise.c:313

Definition at line 340 of file vf_noise.c.