FFmpeg
Data Structures | Macros | Functions | Variables
vf_smartblur.c File Reference
#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

◆ RADIUS_MIN

#define RADIUS_MIN   0.1

Definition at line 36 of file vf_smartblur.c.

◆ RADIUS_MAX

#define RADIUS_MAX   5.0

Definition at line 37 of file vf_smartblur.c.

◆ STRENGTH_MIN

#define STRENGTH_MIN   -1.0

Definition at line 39 of file vf_smartblur.c.

◆ STRENGTH_MAX

#define STRENGTH_MAX   1.0

Definition at line 40 of file vf_smartblur.c.

◆ THRESHOLD_MIN

#define THRESHOLD_MIN   -30

Definition at line 42 of file vf_smartblur.c.

◆ THRESHOLD_MAX

#define THRESHOLD_MAX   30

Definition at line 43 of file vf_smartblur.c.

◆ OFFSET

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

Definition at line 62 of file vf_smartblur.c.

◆ FLAGS

Definition at line 63 of file vf_smartblur.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( smartblur  )

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 85 of file vf_smartblur.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 109 of file vf_smartblur.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 117 of file vf_smartblur.c.

◆ alloc_sws_context()

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().

◆ config_props()

static int config_props ( AVFilterLink inlink)
static

Definition at line 160 of file vf_smartblur.c.

◆ blur()

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().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame inpic 
)
static

Definition at line 241 of file vf_smartblur.c.

Variable Documentation

◆ smartblur_options

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.

◆ smartblur_inputs

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

Definition at line 276 of file vf_smartblur.c.

◆ smartblur_outputs

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

Definition at line 286 of file vf_smartblur.c.

◆ ff_vf_smartblur

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

config_props
static int config_props(AVFilterLink *inlink)
Definition: vf_smartblur.c:160
RADIUS_MAX
#define RADIUS_MAX
Definition: vf_smartblur.c:37
OFFSET
#define OFFSET(x)
Definition: vf_smartblur.c:62
chroma
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, int jobnr, int nb_jobs)
Definition: vf_waveform.c:1631
RADIUS_MIN
#define RADIUS_MIN
Definition: vf_smartblur.c:36
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_smartblur.c:85
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
Definition: vf_smartblur.c:241
THRESHOLD_MIN
#define THRESHOLD_MIN
Definition: vf_smartblur.c:42
inputs
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
Definition: filter_design.txt:243
STRENGTH_MIN
#define STRENGTH_MIN
Definition: vf_smartblur.c:39
smartblur_inputs
static const AVFilterPad smartblur_inputs[]
Definition: vf_smartblur.c:276
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_smartblur.c:109
FLAGS
#define FLAGS
Definition: vf_smartblur.c:63
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#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:125
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
smartblur_outputs
static const AVFilterPad smartblur_outputs[]
Definition: vf_smartblur.c:286
THRESHOLD_MAX
#define THRESHOLD_MAX
Definition: vf_smartblur.c:43
STRENGTH_MAX
#define STRENGTH_MAX
Definition: vf_smartblur.c:40
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_smartblur.c:117
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
SmartblurContext
Definition: vf_smartblur.c:53
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565