FFmpeg  4.3
Data Structures | Macros | Functions | Variables
vf_noise.c File Reference
#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
 Used for passing data between threads. More...
 

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

◆ OFFSET

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

Definition at line 42 of file vf_noise.c.

◆ FLAGS

Definition at line 43 of file vf_noise.c.

◆ NOISE_PARAMS

#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"},

Definition at line 45 of file vf_noise.c.

◆ RAND_N

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

Definition at line 69 of file vf_noise.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( noise  )

◆ init_noise()

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

Definition at line 70 of file vf_noise.c.

Referenced by init().

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 133 of file vf_noise.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 148 of file vf_noise.c.

◆ ff_line_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().

◆ ff_line_noise_avg_c()

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().

◆ noise()

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 ff_line_noise_c(), filter_slice(), and init_noise().

◆ filter_slice()

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().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame inpicref 
)
static

Definition at line 242 of file vf_noise.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 283 of file vf_noise.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 313 of file vf_noise.c.

Variable Documentation

◆ noise_options

const AVOption noise_options[]
static
Initial value:
= {
NOISE_PARAMS(c3, 3, param[3])
{NULL}
}

Definition at line 56 of file vf_noise.c.

◆ patt

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().

◆ noise_inputs

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

Definition at line 322 of file vf_noise.c.

◆ noise_outputs

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

Definition at line 332 of file vf_noise.c.

◆ ff_vf_noise

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,
}

Definition at line 340 of file vf_noise.c.

uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_noise.c:313
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
NOISE_PATTERN
#define NOISE_PATTERN
Definition: vf_noise.h:35
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_noise.c:148
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_noise.c:283
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
NoiseContext
Definition: noise_bsf.c:29
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
inputs
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
Definition: filter_design.txt:243
FLAGS
#define FLAGS
Definition: vf_noise.c:43
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:186
noise_outputs
static const AVFilterPad noise_outputs[]
Definition: vf_noise.c:332
noise_inputs
static const AVFilterPad noise_inputs[]
Definition: vf_noise.c:322
NOISE_PARAMS
#define NOISE_PARAMS(name, x, param)
Definition: vf_noise.c:45
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#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:125
NOISE_AVERAGED
#define NOISE_AVERAGED
Definition: vf_noise.h:34
NOISE_UNIFORM
#define NOISE_UNIFORM
Definition: vf_noise.h:32
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
OFFSET
#define OFFSET(x)
Definition: vf_noise.c:42
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:222
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:564
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_noise.c:133
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
Definition: vf_noise.c:242
NOISE_TEMPORAL
#define NOISE_TEMPORAL
Definition: vf_noise.h:33
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
noise_class
static const AVClass noise_class
Definition: noise_bsf.c:78