FFmpeg
Data Structures | Macros | Functions | Variables
vf_mpdecimate.c File Reference
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixelutils.h"
#include "libavutil/timestamp.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  DecimateContext
 

Macros

#define OFFSET(x)   offsetof(DecimateContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (mpdecimate)
 
static int diff_planes (AVFilterContext *ctx, uint8_t *cur, int cur_linesize, uint8_t *ref, int ref_linesize, int w, int h)
 Return 1 if the two planes are different, 0 otherwise. More...
 
static int decimate_frame (AVFilterContext *ctx, AVFrame *cur, AVFrame *ref)
 Tell if the frame should be decimated, for example if it is no much different with respect to the reference frame ref. More...
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *cur)
 

Variables

static const AVOption mpdecimate_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad mpdecimate_inputs []
 
const AVFilter ff_vf_mpdecimate
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 56 of file vf_mpdecimate.c.

◆ FLAGS

Definition at line 57 of file vf_mpdecimate.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( mpdecimate  )

◆ diff_planes()

static int diff_planes ( AVFilterContext ctx,
uint8_t *  cur,
int  cur_linesize,
uint8_t *  ref,
int  ref_linesize,
int  w,
int  h 
)
static

Return 1 if the two planes are different, 0 otherwise.

Definition at line 75 of file vf_mpdecimate.c.

Referenced by decimate_frame().

◆ decimate_frame()

static int decimate_frame ( AVFilterContext ctx,
AVFrame cur,
AVFrame ref 
)
static

Tell if the frame should be decimated, for example if it is no much different with respect to the reference frame ref.

Definition at line 113 of file vf_mpdecimate.c.

Referenced by filter_frame().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 151 of file vf_mpdecimate.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 165 of file vf_mpdecimate.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 187 of file vf_mpdecimate.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame cur 
)
static

Definition at line 198 of file vf_mpdecimate.c.

Variable Documentation

◆ mpdecimate_options

const AVOption mpdecimate_options[]
static
Initial value:
= {
{ "max", "set the maximum number of consecutive dropped frames (positive), or the minimum interval between dropped frames (negative)",
OFFSET(max_drop_count), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX, FLAGS },
{ "keep", "set the number of similar consecutive frames to be kept before starting to drop similar frames",
OFFSET(max_keep_count), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
{ "hi", "set high dropping threshold", OFFSET(hi), AV_OPT_TYPE_INT, {.i64=64*12}, INT_MIN, INT_MAX, FLAGS },
{ "lo", "set low dropping threshold", OFFSET(lo), AV_OPT_TYPE_INT, {.i64=64*5}, INT_MIN, INT_MAX, FLAGS },
{ "frac", "set fraction dropping threshold", OFFSET(frac), AV_OPT_TYPE_FLOAT, {.dbl=0.33}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 59 of file vf_mpdecimate.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ mpdecimate_inputs

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

Definition at line 231 of file vf_mpdecimate.c.

◆ ff_vf_mpdecimate

const AVFilter ff_vf_mpdecimate
Initial value:
= {
.name = "mpdecimate",
.description = NULL_IF_CONFIG_SMALL("Remove near-duplicate frames."),
.init = init,
.uninit = uninit,
.priv_size = sizeof(DecimateContext),
.priv_class = &mpdecimate_class,
}

Definition at line 240 of file vf_mpdecimate.c.

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
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_mpdecimate.c:187
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 *cur)
Definition: vf_mpdecimate.c:198
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
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
FLAGS
#define FLAGS
Definition: vf_mpdecimate.c:57
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_mpdecimate.c:171
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_mpdecimate.c:56
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
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
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_mpdecimate.c:151
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
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
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
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
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
DecimateContext
Definition: vf_decimate.c:38
mpdecimate_inputs
static const AVFilterPad mpdecimate_inputs[]
Definition: vf_mpdecimate.c:231
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_mpdecimate.c:165
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
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