Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
51def31d
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
51def31d
编写于
2月 25, 2013
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vf_boxblur: switch to an AVOptions-based system.
上级
62dcdb02
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
52 addition
and
28 deletion
+52
-28
doc/filters.texi
doc/filters.texi
+14
-4
libavfilter/vf_boxblur.c
libavfilter/vf_boxblur.c
+38
-24
未找到文件。
doc/filters.texi
浏览文件 @
51def31d
...
...
@@ -550,8 +550,18 @@ Threshold below which a pixel value is considered black, defaults to 32.
Apply boxblur algorithm to the input video.
This filter accepts the parameters:
@var{luma_power}:@var{luma_radius}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power}
This filter accepts the following options:
@table @option
@item luma_radius
@item luma_power
@item chroma_radius
@item chroma_power
@item alpha_radius
@item alpha_power
@end table
Chroma and alpha parameters are optional, if not specified they default
to the corresponding values set for @var{luma_radius} and
...
...
@@ -589,7 +599,7 @@ Some examples follow:
Apply a boxblur filter with luma, chroma, and alpha radius
set to 2:
@example
boxblur=
2:
1
boxblur=
luma_radius=2:luma_power=
1
@end example
@item
...
...
@@ -601,7 +611,7 @@ boxblur=2:1:0:0:0:0
@item
Set luma and chroma radius to a fraction of the video dimension
@example
boxblur=
min(h\,w)/10:1:min(cw\,ch)/10:
1
boxblur=
luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=
1
@end example
@end itemize
...
...
libavfilter/vf_boxblur.c
浏览文件 @
51def31d
...
...
@@ -28,6 +28,7 @@
#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
...
...
@@ -60,12 +61,13 @@ typedef struct {
}
FilterParam
;
typedef
struct
{
const
AVClass
*
class
;
FilterParam
luma_param
;
FilterParam
chroma_param
;
FilterParam
alpha_param
;
char
luma_radius_expr
[
256
]
;
char
chroma_radius_expr
[
256
]
;
char
alpha_radius_expr
[
256
]
;
char
*
luma_radius_expr
;
char
*
chroma_radius_expr
;
char
*
alpha_radius_expr
;
int
hsub
,
vsub
;
int
radius
[
4
];
...
...
@@ -81,34 +83,23 @@ typedef struct {
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
BoxBlurContext
*
boxblur
=
ctx
->
priv
;
int
e
;
if
(
!
args
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Filter expects 2 or 4 or 6 arguments, none provided
\n
"
);
if
(
!
boxblur
->
luma_radius_expr
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Luma radius expression is not set.
\n
"
);
return
AVERROR
(
EINVAL
);
}
e
=
sscanf
(
args
,
"%255[^:]:%d:%255[^:]:%d:%255[^:]:%d"
,
boxblur
->
luma_radius_expr
,
&
boxblur
->
luma_param
.
power
,
boxblur
->
chroma_radius_expr
,
&
boxblur
->
chroma_param
.
power
,
boxblur
->
alpha_radius_expr
,
&
boxblur
->
alpha_param
.
power
);
if
(
e
!=
2
&&
e
!=
4
&&
e
!=
6
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Filter expects 2 or 4 or 6 params, provided %d
\n
"
,
e
);
return
AVERROR
(
EINVAL
);
}
if
(
e
<
4
)
{
if
(
!
boxblur
->
chroma_radius_expr
)
{
boxblur
->
chroma_radius_expr
=
av_strdup
(
boxblur
->
luma_radius_expr
);
if
(
!
boxblur
->
chroma_radius_expr
)
return
AVERROR
(
ENOMEM
);
boxblur
->
chroma_param
.
power
=
boxblur
->
luma_param
.
power
;
av_strlcpy
(
boxblur
->
chroma_radius_expr
,
boxblur
->
luma_radius_expr
,
sizeof
(
boxblur
->
chroma_radius_expr
));
}
if
(
e
<
6
)
{
if
(
!
boxblur
->
alpha_radius_expr
)
{
boxblur
->
alpha_radius_expr
=
av_strdup
(
boxblur
->
luma_radius_expr
);
if
(
!
boxblur
->
alpha_radius_expr
)
return
AVERROR
(
ENOMEM
);
boxblur
->
alpha_param
.
power
=
boxblur
->
luma_param
.
power
;
av_strlcpy
(
boxblur
->
alpha_radius_expr
,
boxblur
->
luma_radius_expr
,
sizeof
(
boxblur
->
alpha_radius_expr
));
}
return
0
;
...
...
@@ -342,6 +333,28 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
ff_filter_frame
(
outlink
,
out
);
}
#define OFFSET(x) offsetof(BoxBlurContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
options
[]
=
{
{
"luma_radius"
,
"Radius of the luma blurring box"
,
OFFSET
(
luma_radius_expr
),
AV_OPT_TYPE_STRING
,
.
flags
=
FLAGS
},
{
"luma_power"
,
"How many times should the boxblur be applied to luma"
,
OFFSET
(
luma_param
.
power
),
AV_OPT_TYPE_INT
,
{
.
i64
=
1
},
0
,
INT_MAX
,
FLAGS
},
{
"chroma_radius"
,
"Radius of the chroma blurring box"
,
OFFSET
(
chroma_radius_expr
),
AV_OPT_TYPE_STRING
,
.
flags
=
FLAGS
},
{
"chroma_power"
,
"How many times should the boxblur be applied to chroma"
,
OFFSET
(
chroma_param
.
power
),
AV_OPT_TYPE_INT
,
{
.
i64
=
1
},
0
,
INT_MAX
,
FLAGS
},
{
"alpha_radius"
,
"Radius of the alpha blurring box"
,
OFFSET
(
alpha_radius_expr
),
AV_OPT_TYPE_STRING
,
.
flags
=
FLAGS
},
{
"alpha_power"
,
"How many times should the boxblur be applied to alpha"
,
OFFSET
(
alpha_param
.
power
),
AV_OPT_TYPE_INT
,
{
.
i64
=
1
},
0
,
INT_MAX
,
FLAGS
},
{
NULL
},
};
static
const
AVClass
boxblur_class
=
{
.
class_name
=
"boxblur"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_boxblur_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -364,6 +377,7 @@ AVFilter avfilter_vf_boxblur = {
.
name
=
"boxblur"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Blur the input."
),
.
priv_size
=
sizeof
(
BoxBlurContext
),
.
priv_class
=
&
boxblur_class
,
.
init
=
init
,
.
uninit
=
uninit
,
.
query_formats
=
query_formats
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录