FFmpeg
Loading...
Searching...
No Matches
vf_decimate.c File Reference
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"

Go to the source code of this file.

Data Structures

struct  qitem
 
struct  DecimateContext
 

Macros

#define INPUT_MAIN   0
 
#define INPUT_CLEANSRC   1
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define CALC_DIFF(nbits)
 
#define PF_NOALPHA(suf)
 
#define PF_ALPHA(suf)
 
#define PF(suf)
 

Functions

 AVFILTER_DEFINE_CLASS (decimate)
 
static void calc_diffs (const DecimateContext *dm, struct qitem *q, const AVFrame *f1, const AVFrame *f2)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int activate (AVFilterContext *ctx)
 
static av_cold int decimate_init (AVFilterContext *ctx)
 
static av_cold void decimate_uninit (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 

Variables

static const AVOption decimate_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad decimate_outputs []
 
const FFFilter ff_vf_decimate
 

Macro Definition Documentation

◆ INPUT_MAIN

◆ INPUT_CLEANSRC

#define INPUT_CLEANSRC   1

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 70 of file vf_decimate.c.

◆ FLAGS

Definition at line 71 of file vf_decimate.c.

◆ CALC_DIFF

#define CALC_DIFF ( nbits)
Value:
do { \
for (x = 0; x < width; x += hblockx) { \
int64_t acc = 0; \
int m = FFMIN(width, x + hblockx); \
for (xl = x; xl < m; xl++) \
acc += abs(((const uint##nbits##_t *)f1p)[xl] - \
((const uint##nbits##_t *)f2p)[xl]); \
bdiffs[ydest * dm->nxblocks + xdest] += acc; \
xdest++; \
} \
} while (0)
long long int64_t
Definition coverity.c:34
#define abs(x)
#define FFMIN(a, b)
Definition macros.h:49
#define width
Definition dsp.h:89

Referenced by calc_diffs().

◆ PF_NOALPHA

#define PF_NOALPHA ( suf)
Value:
AV_PIX_FMT_YUV420##suf, AV_PIX_FMT_YUV422##suf, AV_PIX_FMT_YUV444##suf

◆ PF_ALPHA

#define PF_ALPHA ( suf)
Value:
AV_PIX_FMT_YUVA420##suf, AV_PIX_FMT_YUVA422##suf, AV_PIX_FMT_YUVA444##suf

◆ PF

#define PF ( suf)
Value:
PF_NOALPHA(suf), PF_ALPHA(suf)
#define PF_NOALPHA(suf)
#define PF_ALPHA(suf)

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( decimate )

◆ calc_diffs()

static void calc_diffs ( const DecimateContext * dm,
struct qitem * q,
const AVFrame * f1,
const AVFrame * f2 )
static

Definition at line 87 of file vf_decimate.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * in )
static

Definition at line 152 of file vf_decimate.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext * ctx)
static

Definition at line 257 of file vf_decimate.c.

◆ decimate_init()

static av_cold int decimate_init ( AVFilterContext * ctx)
static

Definition at line 317 of file vf_decimate.c.

◆ decimate_uninit()

static av_cold void decimate_uninit ( AVFilterContext * ctx)
static

Definition at line 348 of file vf_decimate.c.

◆ config_output()

static int config_output ( AVFilterLink * outlink)
static

Definition at line 381 of file vf_decimate.c.

Variable Documentation

◆ decimate_options

const AVOption decimate_options[]
static
Initial value:
= {
{ "cycle", "set the number of frame from which one will be dropped", OFFSET(cycle), AV_OPT_TYPE_INT, {.i64 = 5}, 2, 25, FLAGS },
{ "dupthresh", "set duplicate threshold", OFFSET(dupthresh_flt), AV_OPT_TYPE_DOUBLE, {.dbl = 1.1}, 0, 100, FLAGS },
{ "scthresh", "set scene change threshold", OFFSET(scthresh_flt), AV_OPT_TYPE_DOUBLE, {.dbl = 15.0}, 0, 100, FLAGS },
{ "blockx", "set the size of the x-axis blocks used during metric calculations", OFFSET(blockx), AV_OPT_TYPE_INT, {.i64 = 32}, 4, 1<<9, FLAGS },
{ "blocky", "set the size of the y-axis blocks used during metric calculations", OFFSET(blocky), AV_OPT_TYPE_INT, {.i64 = 32}, 4, 1<<9, FLAGS },
{ "ppsrc", "mark main input as a pre-processed input and activate clean source input stream", OFFSET(ppsrc), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ "chroma", "set whether or not chroma is considered in the metric calculations", OFFSET(chroma), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
{ "mixed", "set whether or not the input only partially contains content to be decimated", OFFSET(mixed), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ NULL }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
static av_always_inline void chroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset_y, int offset_x, int column, int mirror, int jobnr, int nb_jobs)

Definition at line 73 of file vf_decimate.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static
Initial value:
= {
#define PF_NOALPHA(suf)
#define PF_ALPHA(suf)
#define PF(suf)
PF(P), PF(P9), PF(P10), PF_NOALPHA(P12), PF_NOALPHA(P14), PF(P16),
}
#define P
#define AV_PIX_FMT_YUV440P12
Definition pixfmt.h:551
#define AV_PIX_FMT_GRAY9
Definition pixfmt.h:524
#define AV_PIX_FMT_GRAY12
Definition pixfmt.h:526
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ 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_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ 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_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
@ 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_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
@ 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
#define AV_PIX_FMT_GRAY10
Definition pixfmt.h:525
#define AV_PIX_FMT_GRAY14
Definition pixfmt.h:527
#define AV_PIX_FMT_YUV440P10
Definition pixfmt.h:547
#define AV_PIX_FMT_GRAY16
Definition pixfmt.h:528
#define PF(suf)

Definition at line 367 of file vf_decimate.c.

◆ decimate_outputs

const AVFilterPad decimate_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
}
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int config_output(AVBitStreamFilterLink *outlink)

Definition at line 445 of file vf_decimate.c.

◆ ff_vf_decimate

const FFFilter ff_vf_decimate
Initial value:
= {
.p.name = "decimate",
.p.description = NULL_IF_CONFIG_SMALL("Decimate frames (post field matching filter)."),
.p.priv_class = &decimate_class,
.init = decimate_init,
.activate = activate,
.uninit = decimate_uninit,
.priv_size = sizeof(DecimateContext),
}
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition avfilter.h:155
static int activate(AVBitStreamFilterContext *ctx)
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
static av_cold void decimate_uninit(AVFilterContext *ctx)
static av_cold int decimate_init(AVFilterContext *ctx)
static const AVFilterPad decimate_outputs[]

Definition at line 453 of file vf_decimate.c.