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 "formats.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 []
 
static const AVFilterPad mpdecimate_outputs []
 
const AVFilter ff_vf_mpdecimate
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 54 of file vf_mpdecimate.c.

◆ FLAGS

Definition at line 55 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 71 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 109 of file vf_mpdecimate.c.

Referenced by filter_frame().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 144 of file vf_mpdecimate.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 158 of file vf_mpdecimate.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 180 of file vf_mpdecimate.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame cur 
)
static

Definition at line 191 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 },
{ "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 57 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 220 of file vf_mpdecimate.c.

◆ mpdecimate_outputs

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

Definition at line 229 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 236 of file vf_mpdecimate.c.

FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:171
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
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_mpdecimate.c:180
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *cur)
Definition: vf_mpdecimate.c:191
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
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
FLAGS
#define FLAGS
Definition: vf_mpdecimate.c:55
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_mpdecimate.c:164
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:191
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_mpdecimate.c:54
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
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
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_mpdecimate.c:144
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
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
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
mpdecimate_outputs
static const AVFilterPad mpdecimate_outputs[]
Definition: vf_mpdecimate.c:229
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
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
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:192
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
DecimateContext
Definition: vf_decimate.c:38
mpdecimate_inputs
static const AVFilterPad mpdecimate_inputs[]
Definition: vf_mpdecimate.c:220
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_mpdecimate.c:158
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
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