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 "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 []
 
const AVFilter ff_vf_removegrain
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 33 of file vf_removegrain.c.

◆ FLAGS

Definition at line 34 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 57 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 67 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 75 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 82 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 91 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 100 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 109 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 132 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 164 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 196 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 228 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 250 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 275 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 283 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 301 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 320 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 330 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 352 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 360 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 368 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 386 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 399 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 423 of file vf_removegrain.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 457 of file vf_removegrain.c.

◆ filter_slice()

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

Definition at line 515 of file vf_removegrain.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 583 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 36 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 625 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 634 of file vf_removegrain.c.

pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_removegrain.c:46
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
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:212
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:283
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_removegrain.c:583
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:86
removegrain_inputs
static const AVFilterPad removegrain_inputs[]
Definition: vf_removegrain.c:625
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:108
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:73
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
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:87
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: vf_removegrain.c:33
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:85
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
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:106
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:174
FLAGS
#define FLAGS
Definition: vf_removegrain.c:34
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:147
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_removegrain.c:457
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:107
a5
#define a5
Definition: regdef.h:51
mode
mode
Definition: ebur128.h:83
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
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:78
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
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:117
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:77
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
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:80
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:79
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:173