vf_smartblur.c File Reference

Apply a smartblur filter to the input video Ported from MPlayer libmpcodecs/vf_smartblur.c by Michael Niedermayer. More...

#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libswscale/swscale.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
Include dependency graph for vf_smartblur.c:

Go to the source code of this file.

Data Structures

struct  FilterParam
 
struct  SmartblurContext
 

Macros

#define RADIUS_MIN   0.1
 
#define RADIUS_MAX   5.0
 
#define STRENGTH_MIN   -1.0
 
#define STRENGTH_MAX   1.0
 
#define THRESHOLD_MIN   -30
 
#define THRESHOLD_MAX   30
 
#define OFFSET(x)   offsetof(SmartblurContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (smartblur)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int alloc_sws_context (FilterParam *f, int width, int height, unsigned int flags)
 
static int config_props (AVFilterLink *inlink)
 
static void blur (uint8_t *dst, const int dst_linesize, const uint8_t *src, const int src_linesize, const int w, const int h, const int threshold, struct SwsContext *filter_context)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *inpic)
 

Variables

static const AVOption smartblur_options []
 
static const AVFilterPad smartblur_inputs []
 
static const AVFilterPad smartblur_outputs []
 
AVFilter avfilter_vf_smartblur
 

Detailed Description

Apply a smartblur filter to the input video Ported from MPlayer libmpcodecs/vf_smartblur.c by Michael Niedermayer.

Definition in file vf_smartblur.c.

Macro Definition Documentation

Definition at line 63 of file vf_smartblur.c.

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

Definition at line 62 of file vf_smartblur.c.

#define RADIUS_MAX   5.0

Definition at line 37 of file vf_smartblur.c.

#define RADIUS_MIN   0.1

Definition at line 36 of file vf_smartblur.c.

Referenced by init().

#define STRENGTH_MAX   1.0

Definition at line 40 of file vf_smartblur.c.

#define STRENGTH_MIN   -1.0

Definition at line 39 of file vf_smartblur.c.

Referenced by init().

#define THRESHOLD_MAX   30

Definition at line 43 of file vf_smartblur.c.

#define THRESHOLD_MIN   -30

Definition at line 42 of file vf_smartblur.c.

Referenced by init().

Function Documentation

static int alloc_sws_context ( FilterParam f,
int  width,
int  height,
unsigned int  flags 
)
static

Definition at line 132 of file vf_smartblur.c.

Referenced by config_props().

AVFILTER_DEFINE_CLASS ( smartblur  )
static void blur ( uint8_t dst,
const int  dst_linesize,
const uint8_t src,
const int  src_linesize,
const int  w,
const int  h,
const int  threshold,
struct SwsContext filter_context 
)
static

Definition at line 175 of file vf_smartblur.c.

Referenced by filter_frame().

static int config_props ( AVFilterLink inlink)
static

Definition at line 159 of file vf_smartblur.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame inpic 
)
static

Definition at line 239 of file vf_smartblur.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 85 of file vf_smartblur.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 117 of file vf_smartblur.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 109 of file vf_smartblur.c.

Variable Documentation

AVFilter avfilter_vf_smartblur
Initial value:
= {
.name = "smartblur",
.description = NULL_IF_CONFIG_SMALL("Blur the input video without impacting the outlines."),
.priv_size = sizeof(SmartblurContext),
.init = init,
.priv_class = &smartblur_class,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int query_formats(AVFilterContext *ctx)
Definition: vf_smartblur.c:117
static const AVFilterPad smartblur_inputs[]
Definition: vf_smartblur.c:274
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_smartblur.c:109
static const AVFilterPad smartblur_outputs[]
Definition: vf_smartblur.c:284
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
static av_cold int init(AVFilterContext *ctx)
Definition: vf_smartblur.c:85

Definition at line 292 of file vf_smartblur.c.

const AVFilterPad smartblur_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_props,
},
{ NULL }
}
static int config_props(AVFilterLink *inlink)
Definition: vf_smartblur.c:159
NULL
Definition: eval.c:55
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
Definition: vf_smartblur.c:239

Definition at line 274 of file vf_smartblur.c.

const AVOption smartblur_options[]
static
Initial value:
= {
{ "luma_radius", "set luma radius", OFFSET(luma.radius), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, RADIUS_MIN, RADIUS_MAX, .flags=FLAGS },
{ "lr" , "set luma radius", OFFSET(luma.radius), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, RADIUS_MIN, RADIUS_MAX, .flags=FLAGS },
{ "luma_strength", "set luma strength", OFFSET(luma.strength), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, STRENGTH_MIN, STRENGTH_MAX, .flags=FLAGS },
{ "ls", "set luma strength", OFFSET(luma.strength), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, STRENGTH_MIN, STRENGTH_MAX, .flags=FLAGS },
{ "luma_threshold", "set luma threshold", OFFSET(luma.threshold), AV_OPT_TYPE_INT, {.i64=0}, THRESHOLD_MIN, THRESHOLD_MAX, .flags=FLAGS },
{ "lt", "set luma threshold", OFFSET(luma.threshold), AV_OPT_TYPE_INT, {.i64=0}, THRESHOLD_MIN, THRESHOLD_MAX, .flags=FLAGS },
{ "chroma_radius", "set chroma radius", OFFSET(chroma.radius), AV_OPT_TYPE_FLOAT, {.dbl=RADIUS_MIN-1}, RADIUS_MIN-1, RADIUS_MAX, .flags=FLAGS },
{ "cr", "set chroma radius", OFFSET(chroma.radius), AV_OPT_TYPE_FLOAT, {.dbl=RADIUS_MIN-1}, RADIUS_MIN-1, RADIUS_MAX, .flags=FLAGS },
{ "chroma_strength", "set chroma strength", OFFSET(chroma.strength), AV_OPT_TYPE_FLOAT, {.dbl=STRENGTH_MIN-1}, STRENGTH_MIN-1, STRENGTH_MAX, .flags=FLAGS },
{ "cs", "set chroma strength", OFFSET(chroma.strength), AV_OPT_TYPE_FLOAT, {.dbl=STRENGTH_MIN-1}, STRENGTH_MIN-1, STRENGTH_MAX, .flags=FLAGS },
{ "chroma_threshold", "set chroma threshold", OFFSET(chroma.threshold), AV_OPT_TYPE_INT, {.i64=THRESHOLD_MIN-1}, THRESHOLD_MIN-1, THRESHOLD_MAX, .flags=FLAGS },
{ "ct", "set chroma threshold", OFFSET(chroma.threshold), AV_OPT_TYPE_INT, {.i64=THRESHOLD_MIN-1}, THRESHOLD_MIN-1, THRESHOLD_MAX, .flags=FLAGS },
{ NULL }
}
#define OFFSET(x)
Definition: vf_smartblur.c:62
#define FLAGS
Definition: vf_smartblur.c:63
#define THRESHOLD_MIN
Definition: vf_smartblur.c:42
#define STRENGTH_MAX
Definition: vf_smartblur.c:40
#define RADIUS_MIN
Definition: vf_smartblur.c:36
NULL
Definition: eval.c:55
#define THRESHOLD_MAX
Definition: vf_smartblur.c:43
#define RADIUS_MAX
Definition: vf_smartblur.c:37
#define STRENGTH_MIN
Definition: vf_smartblur.c:39

Definition at line 65 of file vf_smartblur.c.

const AVFilterPad smartblur_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
NULL
Definition: eval.c:55

Definition at line 284 of file vf_smartblur.c.