libavfilter/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

Defines

#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_B1, VAR_B2, VAR_S1, VAR_S2,
  VAR_T1, VAR_T2, VAR_NB, VAR_N,
  VAR_T, VAR_S, VAR_VARS_NB, VAR_W,
  VAR_H, VAR_CW, VAR_CH, VAR_HSUB,
  VAR_VSUB, VARS_NB, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_A, VAR_SAR,
  VAR_DAR, VAR_HSUB, VAR_VSUB, VAR_X,
  VAR_Y, VAR_N, VAR_POS, VAR_T,
  VAR_VARS_NB, VAR_MAIN_W, VAR_w, VAR_W,
  VAR_MAIN_H, VAR_h, VAR_H, VAR_TW,
  VAR_TEXT_W, VAR_TH, VAR_TEXT_H, VAR_MAX_GLYPH_W,
  VAR_MAX_GLYPH_H, VAR_MAX_GLYPH_A, VAR_ASCENT, VAR_MAX_GLYPH_D,
  VAR_DESCENT, VAR_LINE_H, VAR_LH, VAR_SAR,
  VAR_DAR, VAR_HSUB, VAR_VSUB, VAR_X,
  VAR_Y, VAR_N, VAR_T, VAR_VARS_NB,
  VAR_W, VAR_H, VAR_VAL, VAR_MAXVAL,
  VAR_MINVAL, VAR_NEGVAL, VAR_CLIPVAL, VAR_VARS_NB,
  VAR_MAIN_W, VAR_MW, VAR_MAIN_H, VAR_MH,
  VAR_OVERLAY_W, VAR_OW, VAR_OVERLAY_H, VAR_OH,
  VAR_VARS_NB, 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_SAR, VAR_DAR, VAR_HSUB, VAR_VSUB,
  VARS_NB, VAR_IN_W, VAR_IW, VAR_IN_H,
  VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H,
  VAR_OH, VAR_A, VAR_SAR, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VARS_NB, 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_INTERLACED, VAR_N,
  VAR_POS, VAR_PREV_INPTS, VAR_PREV_OUTPTS, VAR_PTS,
  VAR_STARTPTS, VAR_TB, VAR_VARS_NB, VAR_AVTB,
  VAR_INTB, VAR_VARS_NB, VAR_X, VAR_Y,
  VAR_W, VAR_H, VAR_TIME, VAR_SPEED,
  VAR_TEMPO, VAR_ORDER, VAR_PATTERN, VAR_ROW,
  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 null_draw_slice (AVFilterLink *inlink, int y, int h, int slice_dir)
static void end_frame (AVFilterLink *inlink)

Variables

static const char *const 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.


Define 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 adpcm_encode_init(), altivec_uyvy_rgb32(), asf_read_file_properties(), aura_decode_frame(), av_adler32_update(), av_audio_convert(), av_normalize1_sf(), av_reduce(), avi_read_header(), avpriv_dirac_parse_sequence_header(), bfin_prepare_coefficients(), check_mv(), clipf_c_one(), config_input(), config_props(), decode_dc_coeffs(), decode_exponents(), decode_frame(), decode_header(), decode_hrd_parameters(), decode_main_header(), decode_mb_i(), decode_residual(), decode_residual_inter(), decode_scalefactors(), decode_slice_header(), decode_spectrum_and_dequant(), decode_vui_parameters(), draw_slice(), dv_init_enc_block(), ff_adts_decode_extradata(), ff_asf_get_packet(), ff_get_cpu_flags_x86(), ff_h263_decode_frame(), ff_h264_check_intra_pred_mode(), ff_h264_decode_seq_parameter_set(), ff_imdct_half_3dn2(), ff_interleave_add_packet(), ff_ivi_decode_blocks(), ff_mjpeg_decode_frame(), ff_mov_get_channel_label(), ff_mov_read_stsd_entries(), ff_yuv2packedX_altivec(), filter(), flt16_even(), flt16_round(), flt16_trunc(), idcin_read_packet(), init(), intra_predict(), parse_source_parameters(), pred_spatial_direct_motion(), pRNG(), process_ipmovie_chunk(), put_bits(), put_float(), qdm2_decode_init(), read_quant_tables(), rgb16_32ToUV_half_c_template(), rgb24toyv12_c(), rv30_decode_intra_types(), rv30_decode_mb_info(), rv34_mc(), set_palette(), sox_read_header(), svq3_decode_block(), svq3_decode_mb(), svq3_decode_slice_header(), tm2_decode_blocks(), tm2_hi_res_block(), tm2_low_res_block(), tm2_med_res_block(), tm2_motion_block(), tm2_null_res_block(), tm2_still_block(), tm2_update_block(), unpack_vlcs(), vector_clipf_c_opposite_sign(), VMUL4S(), wv_get_value(), xan_decode_chroma(), xan_decode_frame(), yuv2422_1_c_template(), yuv2422_2_c_template(), yuv2422_X_c_template(), yuv2rgb48_1_c_template(), yuv2rgb48_2_c_template(), yuv2rgb48_X_c_template(), yuv2rgb_1_c_template(), yuv2rgb_2_c_template(), yuv2rgb_full_X_c_template(), and yuv2rgb_X_c_template().

#define V   2

Definition at line 74 of file vf_boxblur.c.

#define Y   0


Enumeration Type Documentation

enum var_name

Enumerator:
VAR_B1 
VAR_B2 
VAR_S1 
VAR_S2 
VAR_T1 
VAR_T2 
VAR_NB 
VAR_N 
VAR_T 
VAR_S 
VAR_VARS_NB 
VAR_W 
VAR_H 
VAR_CW 
VAR_CH 
VAR_HSUB 
VAR_VSUB 
VARS_NB 
VAR_IN_W 
VAR_IW 
VAR_IN_H 
VAR_IH 
VAR_OUT_W 
VAR_OW 
VAR_OUT_H 
VAR_OH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AR_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_INTERLACED 
VAR_N 
VAR_POS 
VAR_PREV_INPTS 
VAR_PREV_OUTPTS 
VAR_PTS 
VAR_STARTPTS 
VAR_TB 
VAR_VARS_NB 
VAR_AVTB 
VAR_INTB 
VAR_VARS_NB 
VAR_X 
VAR_Y 
VAR_W 
VAR_H 
VAR_TIME 
VAR_SPEED 
VAR_TEMPO 
VAR_ORDER 
VAR_PATTERN 
VAR_ROW 
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 
) [inline, static]

Definition at line 208 of file vf_boxblur.c.

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] 
) [inline, static]

Definition at line 249 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 end_frame ( AVFilterLink inlink  )  [static]

Definition at line 303 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 275 of file vf_boxblur.c.

Referenced by end_frame().

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

Definition at line 77 of file vf_boxblur.c.

static void null_draw_slice ( AVFilterLink inlink,
int  y,
int  h,
int  slice_dir 
) [static]

Definition at line 301 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 288 of file vf_boxblur.c.

Referenced by end_frame().


Variable Documentation

Initial value:

 {
    .name          = "boxblur",
    .description   = NULL_IF_CONFIG_SMALL("Blur the input."),
    .priv_size     = sizeof(BoxBlurContext),
    .init          = init,
    .uninit        = uninit,
    .query_formats = query_formats,

    .inputs    = (const AVFilterPad[]) {{ .name       = "default",
                                    .type             = AVMEDIA_TYPE_VIDEO,
                                    .config_props     = config_input,
                                    .draw_slice       = null_draw_slice,
                                    .end_frame        = end_frame,
                                    .min_perms        = AV_PERM_READ },
                                  { .name = NULL}},
    .outputs   = (const AVFilterPad[]) {{ .name       = "default",
                                    .type             = AVMEDIA_TYPE_VIDEO, },
                                  { .name = NULL}},
}

Definition at line 331 of file vf_boxblur.c.

const char* const var_names[] [static]

Initial value:

 {
    "w",
    "h",
    "cw",
    "ch",
    "hsub",
    "vsub",
    NULL
}

Definition at line 33 of file vf_boxblur.c.


Generated on Fri Oct 26 02:46:12 2012 for FFmpeg by  doxygen 1.5.8