FFmpeg
Data Structures | Macros | Functions | Variables
vf_blockdetect.c File Reference
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  BLKContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (blockdetect)
 
static int blockdetect_config_input (AVFilterLink *inlink)
 
static float calculate_blockiness (BLKContext *s, int w, int h, float *grad, int grad_linesize, uint8_t *src, int src_linesize)
 
static void set_meta (AVDictionary **metadata, const char *key, float d)
 
static int blockdetect_filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void blockdetect_uninit (AVFilterContext *ctx)
 

Variables

static const AVOption blockdetect_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad blockdetect_inputs []
 
const AVFilter ff_vf_blockdetect
 

Detailed Description

No-reference blockdetect filter

Implementing: Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference. IEEE, 2005. http://www.eurasip.org/Proceedings/Eusipco/Eusipco2005/defevent/papers/cr1042.pdf

Author
Thilo Borgmann <thilo.borgmann at mail.de>

Definition in file vf_blockdetect.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 55 of file vf_blockdetect.c.

◆ FLAGS

Definition at line 56 of file vf_blockdetect.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( blockdetect  )

◆ blockdetect_config_input()

static int blockdetect_config_input ( AVFilterLink inlink)
static

Definition at line 66 of file vf_blockdetect.c.

◆ calculate_blockiness()

static float calculate_blockiness ( BLKContext s,
int  w,
int  h,
float grad,
int  grad_linesize,
uint8_t *  src,
int  src_linesize 
)
static

Definition at line 86 of file vf_blockdetect.c.

Referenced by blockdetect_filter_frame().

◆ set_meta()

static void set_meta ( AVDictionary **  metadata,
const char *  key,
float  d 
)
static

Definition at line 193 of file vf_blockdetect.c.

Referenced by blockdetect_filter_frame().

◆ blockdetect_filter_frame()

static int blockdetect_filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 200 of file vf_blockdetect.c.

◆ blockdetect_uninit()

static av_cold void blockdetect_uninit ( AVFilterContext ctx)
static

Definition at line 246 of file vf_blockdetect.c.

Variable Documentation

◆ blockdetect_options

const AVOption blockdetect_options[]
static
Initial value:
= {
{ "period_min", "Minimum period to search for", OFFSET(period_min), AV_OPT_TYPE_INT, {.i64=3}, 2, 32, FLAGS},
{ "period_max", "Maximum period to search for", OFFSET(period_max), AV_OPT_TYPE_INT, {.i64=24}, 2, 64, FLAGS},
{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=1}, 0, 15, FLAGS },
{ NULL }
}

Definition at line 57 of file vf_blockdetect.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ blockdetect_inputs

const AVFilterPad blockdetect_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = blockdetect_config_input,
.filter_frame = blockdetect_filter_frame,
},
}

Definition at line 270 of file vf_blockdetect.c.

◆ ff_vf_blockdetect

const AVFilter ff_vf_blockdetect
Initial value:
= {
.name = "blockdetect",
.description = NULL_IF_CONFIG_SMALL("Blockdetect filter."),
.priv_size = sizeof(BLKContext),
.priv_class = &blockdetect_class,
}

Definition at line 279 of file vf_blockdetect.c.

FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_blockdetect.c:258
blockdetect_inputs
static const AVFilterPad blockdetect_inputs[]
Definition: vf_blockdetect.c:270
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
blockdetect_uninit
static av_cold void blockdetect_uninit(AVFilterContext *ctx)
Definition: vf_blockdetect.c:246
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
BLKContext
Definition: vf_blockdetect.c:39
planes
static const struct @469 planes[]
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
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
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_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
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
OFFSET
#define OFFSET(x)
Definition: vf_blockdetect.c:55
NULL
#define NULL
Definition: coverity.c:32
FLAGS
#define FLAGS
Definition: vf_blockdetect.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
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:94
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
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
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
blockdetect_filter_frame
static int blockdetect_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_blockdetect.c:200
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVFILTER_FLAG_METADATA_ONLY
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition: avfilter.h:168
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
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
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
blockdetect_config_input
static int blockdetect_config_input(AVFilterLink *inlink)
Definition: vf_blockdetect.c:66