vf_boxblur.c File Reference

Apply a boxblur filter to the input video. More...

#include "libavutil/avstring.h"
#include "libavutil/eval.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"

Go to the source code of this file.

Data Structures

struct  FilterParam
struct  BoxBlurContext

Macros

#define Y   0
#define U   1
#define V   2
#define A   3
#define EVAL_RADIUS_EXPR(comp)
#define CHECK_RADIUS_VAL(w_, h_, comp)

Enumerations

enum  var_name {
  VAR_W, VAR_H, VAR_CW, VAR_CH,
  VAR_HSUB, VAR_VSUB, VARS_NB, VAR_E,
  VAR_PHI, VAR_PI, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_X, VAR_Y,
  VAR_N, VAR_POS, VAR_T, VAR_VARS_NB,
  VAR_E, VAR_PHI, VAR_PI, VAR_MAIN_W,
  VAR_MW, VAR_MAIN_H, VAR_MH, VAR_TEXT_W,
  VAR_TW, VAR_TEXT_H, VAR_TH, VAR_X,
  VAR_Y, VAR_N, VAR_T, VAR_VARS_NB,
  VAR_E, VAR_PHI, VAR_PI, VAR_W,
  VAR_H, VAR_VAL, VAR_MAXVAL, VAR_MINVAL,
  VAR_NEGVAL, VAR_CLIPVAL, VAR_VARS_NB, VAR_E,
  VAR_PHI, VAR_PI, VAR_MAIN_W, VAR_MW,
  VAR_MAIN_H, VAR_MH, VAR_OVERLAY_W, VAR_OW,
  VAR_OVERLAY_H, VAR_OH, VAR_VARS_NB, VAR_PI,
  VAR_PHI, VAR_E, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_X, VAR_Y,
  VAR_A, VAR_HSUB, VAR_VSUB, VARS_NB,
  VAR_PI, VAR_PHI, VAR_E, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_A,
  VAR_DAR, VAR_SAR, VAR_HSUB, VAR_VSUB,
  VARS_NB, VAR_E, VAR_PHI, VAR_PI,
  VAR_TB, VAR_PTS, VAR_START_PTS, VAR_PREV_PTS,
  VAR_PREV_SELECTED_PTS, VAR_T, VAR_START_T, VAR_PREV_T,
  VAR_PREV_SELECTED_T, VAR_PICT_TYPE, VAR_PICT_TYPE_I, VAR_PICT_TYPE_P,
  VAR_PICT_TYPE_B, VAR_PICT_TYPE_S, VAR_PICT_TYPE_SI, VAR_PICT_TYPE_SP,
  VAR_PICT_TYPE_BI, VAR_INTERLACE_TYPE, VAR_INTERLACE_TYPE_P, VAR_INTERLACE_TYPE_T,
  VAR_INTERLACE_TYPE_B, VAR_N, VAR_SELECTED_N, VAR_PREV_SELECTED_N,
  VAR_KEY, VAR_POS, VAR_VARS_NB, VAR_E,
  VAR_INTERLACED, VAR_N, VAR_PHI, VAR_PI,
  VAR_POS, VAR_PREV_INPTS, VAR_PREV_OUTPTS, VAR_PTS,
  VAR_STARTPTS, VAR_TB, VAR_VARS_NB, VAR_E,
  VAR_PHI, VAR_PI, VAR_AVTB, VAR_INTB,
  VAR_VARS_NB, VAR_E, VAR_PHI, VAR_PI,
  VAR_AVTB, VAR_VARS_NB
}

Functions

static av_cold int init (AVFilterContext *ctx, const char *args, void *opaque)
static av_cold void uninit (AVFilterContext *ctx)
static int query_formats (AVFilterContext *ctx)
static int config_input (AVFilterLink *inlink)
static void blur (uint8_t *dst, int dst_step, const uint8_t *src, int src_step, int len, int radius)
static void blur_power (uint8_t *dst, int dst_step, const uint8_t *src, int src_step, int len, int radius, int power, uint8_t *temp[2])
static void hblur (uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int w, int h, int radius, int power, uint8_t *temp[2])
static void vblur (uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int w, int h, int radius, int power, uint8_t *temp[2])
static void draw_slice (AVFilterLink *inlink, int y0, int h0, int slice_dir)

Variables

static const char * var_names []
AVFilter avfilter_vf_boxblur

Detailed Description

Apply a boxblur filter to the input video.

Ported from MPlayer libmpcodecs/vf_boxblur.c.

Definition in file vf_boxblur.c.

Macro Definition Documentation

#define A   3

Definition at line 75 of file vf_boxblur.c.

#define CHECK_RADIUS_VAL (   w_,
  h_,
  comp 
)
Value:
if (boxblur->comp##_param.radius < 0 || \
2*boxblur->comp##_param.radius > FFMIN(w_, h_)) { \
av_log(ctx, AV_LOG_ERROR, \
"Invalid " #comp " radius value %d, must be >= 0 and <= %d\n", \
boxblur->comp##_param.radius, FFMIN(w_, h_)/2); \
return AVERROR(EINVAL); \
}

Referenced by config_input().

#define EVAL_RADIUS_EXPR (   comp)
Value:
expr = boxblur->comp##_radius_expr; \
ret = av_expr_parse_and_eval(&res, expr, var_names, var_values, \
NULL, NULL, NULL, NULL, NULL, 0, ctx); \
boxblur->comp##_param.radius = res; \
if (ret < 0) { \
av_log(NULL, AV_LOG_ERROR, \
"Error when evaluating " #comp " radius expression '%s'\n", expr); \
return ret; \
}

Referenced by config_input().

#define U   1

Definition at line 73 of file vf_boxblur.c.

Referenced by config_input(), and config_props().

#define V   2

Definition at line 74 of file vf_boxblur.c.

#define Y   0

Definition at line 72 of file vf_boxblur.c.

Referenced by config_input(), and config_props().

Enumeration Type Documentation

enum var_name
Enumerator:
VAR_W 
VAR_H 
VAR_CW 
VAR_CH 
VAR_HSUB 
VAR_VSUB 
VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_IN_W 
VAR_IW 
VAR_IN_H 
VAR_IH 
VAR_OUT_W 
VAR_OW 
VAR_OUT_H 
VAR_OH 
VAR_X 
VAR_Y 
VAR_N 
VAR_POS 
VAR_T 
VAR_VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_MAIN_W 
VAR_MW 
VAR_MAIN_H 
VAR_MH 
VAR_TEXT_W 
VAR_TW 
VAR_TEXT_H 
VAR_TH 
VAR_X 
VAR_Y 
VAR_N 
VAR_T 
VAR_VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_W 
V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PHI 
VAR_PI 
VAR_AVTB 
VAR_INTB 
VAR_VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_AVTB 
VAR_VARS_NB 

Definition at line 43 of file vf_boxblur.c.

Function Documentation

static void blur ( uint8_t *  dst,
int  dst_step,
const uint8_t *  src,
int  src_step,
int  len,
int  radius 
)
inlinestatic

Definition at line 213 of file vf_boxblur.c.

Referenced by blur_power().

static void blur_power ( uint8_t *  dst,
int  dst_step,
const uint8_t *  src,
int  src_step,
int  len,
int  radius,
int  power,
uint8_t *  temp[2] 
)
inlinestatic

Definition at line 254 of file vf_boxblur.c.

Referenced by hblur(), and vblur().

static int config_input ( AVFilterLink inlink)
static

Definition at line 136 of file vf_boxblur.c.

static void draw_slice ( AVFilterLink inlink,
int  y0,
int  h0,
int  slice_dir 
)
static

Definition at line 306 of file vf_boxblur.c.

static void hblur ( uint8_t *  dst,
int  dst_linesize,
const uint8_t *  src,
int  src_linesize,
int  w,
int  h,
int  radius,
int  power,
uint8_t *  temp[2] 
)
static

Definition at line 280 of file vf_boxblur.c.

Referenced by draw_slice().

static av_cold int init ( AVFilterContext ctx,
const char *  args,
void opaque 
)
static

Definition at line 77 of file vf_boxblur.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 121 of file vf_boxblur.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 113 of file vf_boxblur.c.

static void vblur ( uint8_t *  dst,
int  dst_linesize,
const uint8_t *  src,
int  src_linesize,
int  w,
int  h,
int  radius,
int  power,
uint8_t *  temp[2] 
)
static

Definition at line 293 of file vf_boxblur.c.

Referenced by draw_slice().

Variable Documentation

AVFilter avfilter_vf_boxblur
Initial value:
{
.name = "boxblur",
.description = NULL_IF_CONFIG_SMALL("Blur the input."),
.priv_size = sizeof(BoxBlurContext),
.init = init,
.inputs = (AVFilterPad[]) {{ .name = "default",
.config_props = config_input,
.draw_slice = draw_slice,
.min_perms = AV_PERM_READ },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO, },
{ .name = NULL}},
}

Definition at line 333 of file vf_boxblur.c.

const char* var_names[]
static
Initial value:
{
"w",
"h",
"cw",
"ch",
"hsub",
"vsub",
}

Definition at line 33 of file vf_boxblur.c.