FFmpeg
Loading...
Searching...
No Matches
vf_blurdetect.c File Reference

No-reference blurdetect filter. More...

#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/qsort.h"
#include "filters.h"
#include "edge_common.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  BLRContext
 

Macros

#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Functions

static int comp (const float *a, const float *b)
 
 AVFILTER_DEFINE_CLASS (blurdetect)
 
static av_cold int blurdetect_init (AVFilterContext *ctx)
 
static int blurdetect_config_input (AVFilterLink *inlink)
 
static float edge_width (BLRContext *blr, int i, int j, int8_t dir, int w, int h, int edge, const uint8_t *src, int src_linesize)
 
static float calculate_blur (BLRContext *s, int w, int h, int hsub, int vsub, int8_t *dir, int dir_linesize, uint8_t *dst, int dst_linesize, uint8_t *src, int src_linesize)
 
static void set_meta (AVDictionary **metadata, const char *key, float d)
 
static int blurdetect_filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void blurdetect_uninit (AVFilterContext *ctx)
 

Variables

static const AVOption blurdetect_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad blurdetect_inputs []
 
const FFFilter ff_vf_blurdetect
 

Detailed Description

No-reference blurdetect filter.

Implementing: Marziliano, Pina, et al. "A no-reference perceptual blur metric." Proceedings. International conference on image processing. Vol. 3. IEEE, 2002. https://infoscience.epfl.ch/record/111802/files/14%20A%20no-reference%20perceptual%20blur%20metric.pdf

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

Definition in file vf_blurdetect.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(BLRContext, x)

Definition at line 71 of file vf_blurdetect.c.

◆ FLAGS

Definition at line 72 of file vf_blurdetect.c.

Function Documentation

◆ comp()

static int comp ( const float * a,
const float * b )
static

Definition at line 42 of file vf_blurdetect.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( blurdetect )

◆ blurdetect_init()

static av_cold int blurdetect_init ( AVFilterContext * ctx)
static

Definition at line 86 of file vf_blurdetect.c.

◆ blurdetect_config_input()

static int blurdetect_config_input ( AVFilterLink * inlink)
static

Definition at line 96 of file vf_blurdetect.c.

◆ edge_width()

static float edge_width ( BLRContext * blr,
int i,
int j,
int8_t dir,
int w,
int h,
int edge,
const uint8_t * src,
int src_linesize )
static

Definition at line 127 of file vf_blurdetect.c.

Referenced by calculate_blur().

◆ calculate_blur()

static float calculate_blur ( BLRContext * s,
int w,
int h,
int hsub,
int vsub,
int8_t * dir,
int dir_linesize,
uint8_t * dst,
int dst_linesize,
uint8_t * src,
int src_linesize )
static

Definition at line 193 of file vf_blurdetect.c.

Referenced by blurdetect_filter_frame().

◆ set_meta()

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

Definition at line 248 of file vf_blurdetect.c.

Referenced by blurdetect_filter_frame().

◆ blurdetect_filter_frame()

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

Definition at line 255 of file vf_blurdetect.c.

◆ blurdetect_uninit()

static av_cold void blurdetect_uninit ( AVFilterContext * ctx)
static

Definition at line 323 of file vf_blurdetect.c.

Variable Documentation

◆ blurdetect_options

const AVOption blurdetect_options[]
static
Initial value:
= {
{ "high", "set high threshold", OFFSET(high), AV_OPT_TYPE_FLOAT, {.dbl=30/255.}, 0, 1, FLAGS },
{ "low", "set low threshold", OFFSET(low), AV_OPT_TYPE_FLOAT, {.dbl=15/255.}, 0, 1, FLAGS },
{ "radius", "search radius for maxima detection", OFFSET(radius), AV_OPT_TYPE_INT, {.i64=50}, 1, 100, FLAGS },
{ "block_pct", "block pooling threshold when calculating blurriness", OFFSET(block_pct), AV_OPT_TYPE_INT, {.i64=80}, 1, 100, FLAGS },
{ "block_width", "block size for block-based abbreviation of blurriness", OFFSET(block_width), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, FLAGS },
{ "block_height", "block size for block-based abbreviation of blurriness", OFFSET(block_height), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, FLAGS },
{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=1}, 0, 15, FLAGS },
{ NULL }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
int high
Definition dovi_rpuenc.c:39
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
static const struct @257111027162314367033347246032313251342043035002 planes[]

Definition at line 73 of file vf_blurdetect.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static
Initial value:
= {
}
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ 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_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ 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_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_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition pixfmt.h:174
@ 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_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition pixfmt.h:212
@ 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_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition pixfmt.h:173
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
@ 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

Definition at line 339 of file vf_blurdetect.c.

◆ blurdetect_inputs

const AVFilterPad blurdetect_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = blurdetect_config_input,
.filter_frame = blurdetect_filter_frame,
},
}
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int blurdetect_config_input(AVFilterLink *inlink)
static int blurdetect_filter_frame(AVFilterLink *inlink, AVFrame *in)

Definition at line 351 of file vf_blurdetect.c.

◆ ff_vf_blurdetect

const FFFilter ff_vf_blurdetect
Initial value:
= {
.p.name = "blurdetect",
.p.description = NULL_IF_CONFIG_SMALL("Blurdetect filter."),
.p.priv_class = &blurdetect_class,
.priv_size = sizeof(BLRContext),
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition avfilter.h:182
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#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 int blurdetect_init(AVFilterContext *ctx)
static const AVFilterPad blurdetect_inputs[]
static av_cold void blurdetect_uninit(AVFilterContext *ctx)
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

Definition at line 360 of file vf_blurdetect.c.