FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vf_sab.c File Reference

Shape Adaptive Blur filter, ported from MPlayer libmpcodecs/vf_sab.c. 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  SabContext
 

Macros

#define COLOR_DIFF_COEFF_SIZE   512
 
#define RADIUS_MIN   0.1
 
#define RADIUS_MAX   4.0
 
#define PRE_FILTER_RADIUS_MIN   0.1
 
#define PRE_FILTER_RADIUS_MAX   2.0
 
#define STRENGTH_MIN   0.1
 
#define STRENGTH_MAX   100.0
 
#define OFFSET(x)   offsetof(SabContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define NB_PLANES   4
 
#define UPDATE_FACTOR
 

Functions

static int query_formats (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (sab)
 
static av_cold int init (AVFilterContext *ctx)
 
static void close_filter_param (FilterParam *f)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int open_filter_param (FilterParam *f, int width, int height, unsigned int sws_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, FilterParam *fp)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *inpic)
 

Variables

static const AVOption sab_options []
 
static const AVFilterPad sab_inputs []
 
static const AVFilterPad sab_outputs []
 
AVFilter ff_vf_sab
 

Detailed Description

Shape Adaptive Blur filter, ported from MPlayer libmpcodecs/vf_sab.c.

Definition in file vf_sab.c.

Macro Definition Documentation

#define COLOR_DIFF_COEFF_SIZE   512

Definition at line 45 of file vf_sab.c.

Referenced by open_filter_param().

#define RADIUS_MIN   0.1

Definition at line 74 of file vf_sab.c.

Referenced by init().

#define RADIUS_MAX   4.0

Definition at line 75 of file vf_sab.c.

#define PRE_FILTER_RADIUS_MIN   0.1

Definition at line 77 of file vf_sab.c.

Referenced by init().

#define PRE_FILTER_RADIUS_MAX   2.0

Definition at line 78 of file vf_sab.c.

#define STRENGTH_MIN   0.1

Definition at line 80 of file vf_sab.c.

Referenced by init().

#define STRENGTH_MAX   100.0

Definition at line 81 of file vf_sab.c.

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

Definition at line 83 of file vf_sab.c.

Definition at line 84 of file vf_sab.c.

#define NB_PLANES   4

Definition at line 222 of file vf_sab.c.

Referenced by blur().

#define UPDATE_FACTOR
Value:
do { \
int factor; \
factor = f.color_diff_coeff[COLOR_DIFF_COEFF_SIZE/2 + pre_val - \
f.pre_filter_buf[ix + iy*f.pre_filter_linesize]] * f.dist_coeff[dx + dy*f.dist_linesize]; \
sum += src[ix + iy*src_linesize] * factor; \
div += factor; \
} while (0)
#define COLOR_DIFF_COEFF_SIZE
Definition: vf_sab.c:45
#define src
Definition: vp9dsp.c:530
static const int factor[16]
Definition: vf_pp7.c:75

Referenced by blur().

Function Documentation

static int query_formats ( AVFilterContext ctx)
static

Definition at line 58 of file vf_sab.c.

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

Definition at line 108 of file vf_sab.c.

static void close_filter_param ( FilterParam f)
static

Definition at line 131 of file vf_sab.c.

Referenced by config_props(), and uninit().

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 141 of file vf_sab.c.

static int open_filter_param ( FilterParam f,
int  width,
int  height,
unsigned int  sws_flags 
)
static

Definition at line 149 of file vf_sab.c.

Referenced by config_props().

static int config_props ( AVFilterLink inlink)
static

Definition at line 201 of file vf_sab.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,
FilterParam fp 
)
static

Definition at line 224 of file vf_sab.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame inpic 
)
static

Definition at line 282 of file vf_sab.c.

Variable Documentation

const AVOption sab_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_pre_filter_radius", "set luma pre-filter radius", OFFSET(luma.pre_filter_radius), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, PRE_FILTER_RADIUS_MIN, PRE_FILTER_RADIUS_MAX, .flags=FLAGS },
{ "lpfr", "set luma pre-filter radius", OFFSET(luma.pre_filter_radius), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, PRE_FILTER_RADIUS_MIN, PRE_FILTER_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 },
{ "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_pre_filter_radius", "set chroma pre-filter radius", OFFSET(chroma.pre_filter_radius), AV_OPT_TYPE_FLOAT, {.dbl=PRE_FILTER_RADIUS_MIN-1},
{ "cpfr", "set chroma pre-filter radius", OFFSET(chroma.pre_filter_radius), AV_OPT_TYPE_FLOAT, {.dbl=PRE_FILTER_RADIUS_MIN-1},
{ "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 },
{ NULL }
}
#define NULL
Definition: coverity.c:32
static av_always_inline void chroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset_y, int offset_x, int column, int mirror)
Definition: vf_waveform.c:1318
#define PRE_FILTER_RADIUS_MIN
Definition: vf_sab.c:77
#define FLAGS
Definition: vf_sab.c:84
#define RADIUS_MIN
Definition: vf_sab.c:74
#define RADIUS_MAX
Definition: vf_sab.c:75
#define STRENGTH_MAX
Definition: vf_sab.c:81
#define PRE_FILTER_RADIUS_MAX
Definition: vf_sab.c:78
#define STRENGTH_MIN
Definition: vf_sab.c:80
#define OFFSET(x)
Definition: vf_sab.c:83

Definition at line 86 of file vf_sab.c.

const AVFilterPad sab_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_sab.c:201
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
Definition: vf_sab.c:282

Definition at line 308 of file vf_sab.c.

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

Definition at line 318 of file vf_sab.c.

AVFilter ff_vf_sab
Initial value:
= {
.name = "sab",
.description = NULL_IF_CONFIG_SMALL("Apply shape adaptive blur."),
.priv_size = sizeof(SabContext),
.init = init,
.priv_class = &sab_class,
}
static const AVFilterPad sab_outputs[]
Definition: vf_sab.c:318
#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:123
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static int query_formats(AVFilterContext *ctx)
Definition: vf_sab.c:58
static const AVFilterPad sab_inputs[]
Definition: vf_sab.c:308
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static int flags
Definition: cpu.c:47
static av_cold int init(AVFilterContext *ctx)
Definition: vf_sab.c:108
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_sab.c:141

Definition at line 326 of file vf_sab.c.