FFmpeg
Data Structures | Macros | Functions | Variables
vf_removegrain.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/qsort.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "removegrain.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(RemoveGrainContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define REMOVE_GRAIN_SORT_AXIS
 

Functions

 AVFILTER_DEFINE_CLASS (removegrain)
 
static int mode01 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int cmp_int (const void *p1, const void *p2)
 
static int mode02 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode03 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode04 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode05 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode06 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode07 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode08 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode09 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode10 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode1112 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode1314 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode1516 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode17 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode18 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode19 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode20 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode21 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode22 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode23 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int mode24 (int c, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 

Variables

static const AVOption removegrain_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad removegrain_inputs []
 
static const AVFilterPad removegrain_outputs []
 
const AVFilter ff_vf_removegrain
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 34 of file vf_removegrain.c.

◆ FLAGS

Definition at line 35 of file vf_removegrain.c.

◆ REMOVE_GRAIN_SORT_AXIS

#define REMOVE_GRAIN_SORT_AXIS
Value:
const int ma1 = FFMAX(a1, a8); \
const int mi1 = FFMIN(a1, a8); \
const int ma2 = FFMAX(a2, a7); \
const int mi2 = FFMIN(a2, a7); \
const int ma3 = FFMAX(a3, a6); \
const int mi3 = FFMIN(a3, a6); \
const int ma4 = FFMAX(a4, a5); \
const int mi4 = FFMIN(a4, a5);

Definition at line 58 of file vf_removegrain.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( removegrain  )

◆ mode01()

static int mode01 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 68 of file vf_removegrain.c.

Referenced by config_input().

◆ cmp_int()

static int cmp_int ( const void *  p1,
const void *  p2 
)
static

Definition at line 76 of file vf_removegrain.c.

Referenced by mode02(), mode03(), and mode04().

◆ mode02()

static int mode02 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 83 of file vf_removegrain.c.

Referenced by config_input().

◆ mode03()

static int mode03 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 92 of file vf_removegrain.c.

Referenced by config_input().

◆ mode04()

static int mode04 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 101 of file vf_removegrain.c.

Referenced by config_input().

◆ mode05()

static int mode05 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 110 of file vf_removegrain.c.

Referenced by config_input().

◆ mode06()

static int mode06 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 133 of file vf_removegrain.c.

Referenced by config_input().

◆ mode07()

static int mode07 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 165 of file vf_removegrain.c.

Referenced by config_input().

◆ mode08()

static int mode08 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 197 of file vf_removegrain.c.

Referenced by config_input().

◆ mode09()

static int mode09 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 229 of file vf_removegrain.c.

Referenced by config_input().

◆ mode10()

static int mode10 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 251 of file vf_removegrain.c.

Referenced by config_input().

◆ mode1112()

static int mode1112 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 276 of file vf_removegrain.c.

Referenced by config_input().

◆ mode1314()

static int mode1314 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 284 of file vf_removegrain.c.

Referenced by config_input().

◆ mode1516()

static int mode1516 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 302 of file vf_removegrain.c.

Referenced by config_input().

◆ mode17()

static int mode17 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 321 of file vf_removegrain.c.

Referenced by config_input().

◆ mode18()

static int mode18 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 331 of file vf_removegrain.c.

Referenced by config_input().

◆ mode19()

static int mode19 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 353 of file vf_removegrain.c.

Referenced by config_input().

◆ mode20()

static int mode20 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 361 of file vf_removegrain.c.

Referenced by config_input().

◆ mode21()

static int mode21 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 369 of file vf_removegrain.c.

Referenced by config_input().

◆ mode22()

static int mode22 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 387 of file vf_removegrain.c.

Referenced by config_input().

◆ mode23()

static int mode23 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 400 of file vf_removegrain.c.

Referenced by config_input().

◆ mode24()

static int mode24 ( int  c,
int  a1,
int  a2,
int  a3,
int  a4,
int  a5,
int  a6,
int  a7,
int  a8 
)
static

Definition at line 424 of file vf_removegrain.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 458 of file vf_removegrain.c.

◆ filter_slice()

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

Definition at line 516 of file vf_removegrain.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 584 of file vf_removegrain.c.

Variable Documentation

◆ removegrain_options

const AVOption removegrain_options[]
static
Initial value:
= {
{ "m0", "set mode for 1st plane", OFFSET(mode[0]), AV_OPT_TYPE_INT, {.i64=0}, 0, 24, FLAGS },
{ "m1", "set mode for 2nd plane", OFFSET(mode[1]), AV_OPT_TYPE_INT, {.i64=0}, 0, 24, FLAGS },
{ "m2", "set mode for 3rd plane", OFFSET(mode[2]), AV_OPT_TYPE_INT, {.i64=0}, 0, 24, FLAGS },
{ "m3", "set mode for 4th plane", OFFSET(mode[3]), AV_OPT_TYPE_INT, {.i64=0}, 0, 24, FLAGS },
{NULL}
}

Definition at line 37 of file vf_removegrain.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ removegrain_inputs

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

Definition at line 626 of file vf_removegrain.c.

◆ removegrain_outputs

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

Definition at line 635 of file vf_removegrain.c.

◆ ff_vf_removegrain

const AVFilter ff_vf_removegrain
Initial value:
= {
.name = "removegrain",
.description = NULL_IF_CONFIG_SMALL("Remove grain."),
.priv_size = sizeof(RemoveGrainContext),
.priv_class = &removegrain_class,
}

Definition at line 642 of file vf_removegrain.c.

pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_removegrain.c:47
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:170
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
a1
#define a1
Definition: regdef.h:47
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:248
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_removegrain.c:584
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
removegrain_inputs
static const AVFilterPad removegrain_inputs[]
Definition: vf_removegrain.c:626
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
RemoveGrainContext
Definition: removegrain.h:27
a4
#define a4
Definition: regdef.h:50
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: vf_removegrain.c:34
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
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:117
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:167
FLAGS
#define FLAGS
Definition: vf_removegrain.c:35
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:152
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_removegrain.c:458
a2
#define a2
Definition: regdef.h:48
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:100
removegrain_outputs
static const AVFilterPad removegrain_outputs[]
Definition: vf_removegrain.c:635
a5
#define a5
Definition: regdef.h:51
mode
mode
Definition: ebur128.h:83
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
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:127
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
a3
#define a3
Definition: regdef.h:49
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:166