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 "libavutil/x86/asm.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
Include dependency graph for vf_noise.c:

Go to the source code of this file.

Data Structures

struct  FilterParams
 filter data More...
 
struct  NoiseContext
 

Macros

#define MAX_NOISE   4096
 
#define MAX_SHIFT   1024
 
#define MAX_RES   (MAX_NOISE-MAX_SHIFT)
 
#define NOISE_UNIFORM   1
 
#define NOISE_TEMPORAL   2
 
#define NOISE_AVERAGED   8
 
#define NOISE_PATTERN   16
 
#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)))
 
#define ASMALIGN(ZEROBITS)   ".p2align " #ZEROBITS "\n\t"
 

Functions

 AVFILTER_DEFINE_CLASS (noise)
 
static int init_noise (NoiseContext *n, int comp)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static void line_noise_c (uint8_t *dst, const uint8_t *src, int8_t *noise, int len, int shift)
 
static void line_noise_mmx (uint8_t *dst, const uint8_t *src, int8_t *noise, int len, int shift)
 
static void line_noise_mmxext (uint8_t *dst, const uint8_t *src, int8_t *noise, int len, int shift)
 
static void line_noise_avg_c (uint8_t *dst, const uint8_t *src, int len, int8_t **shift)
 
static void line_noise_avg_mmx (uint8_t *dst, const uint8_t *src, int len, int8_t **shift)
 
static void noise (uint8_t *dst, const uint8_t *src, int dst_linesize, int src_linesize, int width, int height, NoiseContext *n, int comp)
 
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 avfilter_vf_noise
 

Detailed Description

noise generator

Definition in file vf_noise.c.

Macro Definition Documentation

#define ASMALIGN (   ZEROBITS)    ".p2align " #ZEROBITS "\n\t"

Definition at line 215 of file vf_noise.c.

Referenced by line_noise_avg_mmx(), line_noise_mmx(), and line_noise_mmxext().

Definition at line 71 of file vf_noise.c.

#define MAX_NOISE   4096

Definition at line 38 of file vf_noise.c.

Referenced by init_noise().

#define MAX_RES   (MAX_NOISE-MAX_SHIFT)

Definition at line 40 of file vf_noise.c.

Referenced by init_noise().

#define MAX_SHIFT   1024

Definition at line 39 of file vf_noise.c.

Referenced by init_noise(), and noise().

#define NOISE_AVERAGED   8

Definition at line 44 of file vf_noise.c.

Referenced by init_noise(), and noise().

#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"},
const char * name
Definition: avisynth_c.h:675
#define NOISE_PATTERN
Definition: vf_noise.c:45
#define NOISE_UNIFORM
Definition: vf_noise.c:42
#define OFFSET(x)
Definition: vf_noise.c:70
#define NOISE_TEMPORAL
Definition: vf_noise.c:43
Discrete Time axis x
#define NOISE_AVERAGED
Definition: vf_noise.c:44
#define FLAGS
Definition: vf_noise.c:71

Definition at line 73 of file vf_noise.c.

#define NOISE_PATTERN   16

Definition at line 45 of file vf_noise.c.

Referenced by init_noise().

#define NOISE_TEMPORAL   2

Definition at line 43 of file vf_noise.c.

Referenced by noise().

#define NOISE_UNIFORM   1

Definition at line 42 of file vf_noise.c.

Referenced by init_noise().

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

Definition at line 70 of file vf_noise.c.

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

Definition at line 97 of file vf_noise.c.

Referenced by init_noise().

Function Documentation

AVFILTER_DEFINE_CLASS ( noise  )
static int config_input ( AVFilterLink inlink)
static

Definition at line 183 of file vf_noise.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame inpicref 
)
static

Definition at line 375 of file vf_noise.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 402 of file vf_noise.c.

static int init_noise ( NoiseContext n,
int  comp 
)
static

Definition at line 98 of file vf_noise.c.

Referenced by init().

static void line_noise_avg_c ( uint8_t dst,
const uint8_t src,
int  len,
int8_t **  shift 
)
inlinestatic

Definition at line 277 of file vf_noise.c.

Referenced by line_noise_avg_mmx().

static void line_noise_avg_mmx ( uint8_t dst,
const uint8_t src,
int  len,
int8_t **  shift 
)
inlinestatic

Definition at line 289 of file vf_noise.c.

Referenced by init().

static void line_noise_c ( uint8_t dst,
const uint8_t src,
int8_t *  noise,
int  len,
int  shift 
)
inlinestatic

Definition at line 202 of file vf_noise.c.

Referenced by line_noise_mmx(), and line_noise_mmxext().

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

Definition at line 217 of file vf_noise.c.

Referenced by init().

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

Definition at line 247 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  height,
NoiseContext n,
int  comp 
)
static

Definition at line 333 of file vf_noise.c.

Referenced by filter_frame(), and init_noise().

static int query_formats ( AVFilterContext ctx)
static

Definition at line 168 of file vf_noise.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 436 of file vf_noise.c.

Variable Documentation

AVFilter avfilter_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:445
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static int query_formats(AVFilterContext *ctx)
Definition: vf_noise.c:168
static const AVFilterPad noise_outputs[]
Definition: vf_noise.c:456
static av_cold int init(AVFilterContext *ctx)
Definition: vf_noise.c:402
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_noise.c:436

Definition at line 464 of file vf_noise.c.

const AVFilterPad noise_inputs[]
static
Initial value:
= {
{
.name = "default",
.get_video_buffer = ff_null_get_video_buffer,
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
static int config_input(AVFilterLink *inlink)
Definition: vf_noise.c:183
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:35
NULL
Definition: eval.c:55
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
Definition: vf_noise.c:375

Definition at line 445 of file vf_noise.c.

const AVOption noise_options[]
static
Initial value:
= {
NOISE_PARAMS(c3, 3, param[3])
{NULL}
}
#define NOISE_PARAMS(name, x, param)
Definition: vf_noise.c:73
NULL
Definition: eval.c:55
#define c3
Definition: idct_sh4.c:28

Definition at line 84 of file vf_noise.c.

const AVFilterPad noise_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
NULL
Definition: eval.c:55

Definition at line 456 of file vf_noise.c.

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

Definition at line 95 of file vf_noise.c.

Referenced by init_noise().