FFmpeg  4.3
Data Structures | Macros | Functions | Variables
vf_boxblur.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "boxblur.h"

Go to the source code of this file.

Data Structures

struct  BoxBlurContext
 

Macros

#define BLUR(type, depth)
 
#define OFFSET(x)   offsetof(BoxBlurContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

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, int pixsize)
 
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], int pixsize)
 
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], int pixsize)
 
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], int pixsize)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
 AVFILTER_DEFINE_CLASS (boxblur)
 

Variables

static const AVOption boxblur_options []
 
static const AVFilterPad avfilter_vf_boxblur_inputs []
 
static const AVFilterPad avfilter_vf_boxblur_outputs []
 
AVFilter ff_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

◆ BLUR

#define BLUR (   type,
  depth 
)
Value:
static inline void blur ## depth(type *dst, int dst_step, const type *src, \
int src_step, int len, int radius) \
{ \
const int length = radius*2 + 1; \
const int inv = ((1<<16) + length/2)/length; \
int x, sum = src[radius*src_step]; \
for (x = 0; x < radius; x++) \
sum += src[x*src_step]<<1; \
\
sum = sum*inv + (1<<15); \
for (x = 0; x <= radius; x++) { \
sum += (src[(radius+x)*src_step] - src[(radius-x)*src_step])*inv; \
dst[x*dst_step] = sum>>16; \
} \
for (; x < len-radius; x++) { \
sum += (src[(radius+x)*src_step] - src[(x-radius-1)*src_step])*inv; \
dst[x*dst_step] = sum >>16; \
} \
for (; x < len; x++) { \
sum += (src[(2*len-radius-x-1)*src_step] - src[(x-radius-1)*src_step])*inv; \
dst[x*dst_step] = sum>>16; \
} \
}

Definition at line 126 of file vf_boxblur.c.

◆ OFFSET

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

Definition at line 265 of file vf_boxblur.c.

◆ FLAGS

Definition at line 266 of file vf_boxblur.c.

Function Documentation

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 50 of file vf_boxblur.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 58 of file vf_boxblur.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 75 of file vf_boxblur.c.

◆ blur()

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

Definition at line 160 of file vf_boxblur.c.

Referenced by blur_power().

◆ 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],
int  pixsize 
)
inlinestatic

Definition at line 167 of file vf_boxblur.c.

Referenced by hblur(), and vblur().

◆ hblur()

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],
int  pixsize 
)
static

Definition at line 201 of file vf_boxblur.c.

Referenced by filter_frame().

◆ vblur()

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],
int  pixsize 
)
static

Definition at line 214 of file vf_boxblur.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 227 of file vf_boxblur.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( boxblur  )

Variable Documentation

◆ boxblur_options

const AVOption boxblur_options[]
static
Initial value:
= {
{ "luma_radius", "Radius of the luma blurring box", OFFSET(luma_param.radius_expr), AV_OPT_TYPE_STRING, {.str="2"}, .flags = FLAGS },
{ "lr", "Radius of the luma blurring box", OFFSET(luma_param.radius_expr), AV_OPT_TYPE_STRING, {.str="2"}, .flags = FLAGS },
{ "luma_power", "How many times should the boxblur be applied to luma", OFFSET(luma_param.power), AV_OPT_TYPE_INT, {.i64=2}, 0, INT_MAX, .flags = FLAGS },
{ "lp", "How many times should the boxblur be applied to luma", OFFSET(luma_param.power), AV_OPT_TYPE_INT, {.i64=2}, 0, INT_MAX, .flags = FLAGS },
{ "chroma_radius", "Radius of the chroma blurring box", OFFSET(chroma_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
{ "cr", "Radius of the chroma blurring box", OFFSET(chroma_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
{ "chroma_power", "How many times should the boxblur be applied to chroma", OFFSET(chroma_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
{ "cp", "How many times should the boxblur be applied to chroma", OFFSET(chroma_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
{ "alpha_radius", "Radius of the alpha blurring box", OFFSET(alpha_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
{ "ar", "Radius of the alpha blurring box", OFFSET(alpha_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
{ "alpha_power", "How many times should the boxblur be applied to alpha", OFFSET(alpha_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
{ "ap", "How many times should the boxblur be applied to alpha", OFFSET(alpha_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
{ NULL }
}

Definition at line 268 of file vf_boxblur.c.

◆ avfilter_vf_boxblur_inputs

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

Definition at line 289 of file vf_boxblur.c.

◆ avfilter_vf_boxblur_outputs

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

Definition at line 299 of file vf_boxblur.c.

◆ ff_vf_boxblur

AVFilter ff_vf_boxblur
Initial value:
= {
.name = "boxblur",
.description = NULL_IF_CONFIG_SMALL("Blur the input."),
.priv_size = sizeof(BoxBlurContext),
.priv_class = &boxblur_class,
}

Definition at line 307 of file vf_boxblur.c.

BoxBlurContext
Definition: vf_boxblur.c:38
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_boxblur.c:58
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_boxblur.c:50
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_boxblur.c:75
NULL
#define NULL
Definition: coverity.c:32
src
#define src
Definition: vp8dsp.c:254
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_boxblur.c:227
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
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
blur
static void blur(uint8_t *dst, int dst_step, const uint8_t *src, int src_step, int len, int radius, int pixsize)
Definition: vf_boxblur.c:160
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:186
OFFSET
#define OFFSET(x)
Definition: vf_boxblur.c:265
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
avfilter_vf_boxblur_inputs
static const AVFilterPad avfilter_vf_boxblur_inputs[]
Definition: vf_boxblur.c:289
len
int len
Definition: vorbis_enc_data.h:452
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FLAGS
#define FLAGS
Definition: vf_boxblur.c:266
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:564
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227
avfilter_vf_boxblur_outputs
static const AVFilterPad avfilter_vf_boxblur_outputs[]
Definition: vf_boxblur.c:299