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

Referenced by config_props().

static int config_props ( AVFilterLink inlink)
static

Definition at line 159 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 176 of file vf_smartblur.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame inpic 
)
static

Definition at line 240 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 }
}

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

Definition at line 275 of file vf_smartblur.c.

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

Definition at line 285 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,
}

Definition at line 293 of file vf_smartblur.c.