FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
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"

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 ff_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

#define RADIUS_MIN   0.1

Definition at line 36 of file vf_smartblur.c.

Referenced by init().

#define RADIUS_MAX   5.0

Definition at line 37 of file vf_smartblur.c.

#define STRENGTH_MIN   -1.0

Definition at line 39 of file vf_smartblur.c.

Referenced by init().

#define STRENGTH_MAX   1.0

Definition at line 40 of file vf_smartblur.c.

#define THRESHOLD_MIN   -30

Definition at line 42 of file vf_smartblur.c.

Referenced by init().

#define THRESHOLD_MAX   30

Definition at line 43 of file vf_smartblur.c.

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

Definition at line 62 of file vf_smartblur.c.

Definition at line 63 of file vf_smartblur.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( smartblur  )
static av_cold int init ( AVFilterContext ctx)
static

Definition at line 85 of file vf_smartblur.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 109 of file vf_smartblur.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 117 of file vf_smartblur.c.

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

Definition at line 133 of file vf_smartblur.c.

Referenced by config_props().

static int config_props ( AVFilterLink inlink)
static

Definition at line 160 of file vf_smartblur.c.

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 177 of file vf_smartblur.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame inpic 
)
static

Definition at line 241 of file vf_smartblur.c.

Variable Documentation

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 NULL
Definition: coverity.c:32
#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
#define THRESHOLD_MAX
Definition: vf_smartblur.c:43
static void chroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column)
Definition: vf_waveform.c:785
#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_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_props,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_props(AVFilterLink *inlink)
Definition: vf_smartblur.c:160
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
Definition: vf_smartblur.c:241

Definition at line 276 of file vf_smartblur.c.

const AVFilterPad smartblur_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 286 of file vf_smartblur.c.

AVFilter ff_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:248
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:451
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static int query_formats(AVFilterContext *ctx)
Definition: vf_smartblur.c:117
static const AVFilterPad smartblur_inputs[]
Definition: vf_smartblur.c:276
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_smartblur.c:109
static const AVFilterPad inputs[]
Definition: af_ashowinfo.c:239
static int flags
Definition: cpu.c:47
static const AVFilterPad smartblur_outputs[]
Definition: vf_smartblur.c:286
static av_cold int init(AVFilterContext *ctx)
Definition: vf_smartblur.c:85

Definition at line 294 of file vf_smartblur.c.