Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
B1ack1e
FFmpeg
提交
b83e9efc
F
FFmpeg
项目概览
B1ack1e
/
FFmpeg
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FFmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b83e9efc
编写于
2月 25, 2013
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vf_unsharp: switch to an AVOptions-based system.
上级
0c2466de
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
32 addition
and
24 deletion
+32
-24
doc/filters.texi
doc/filters.texi
+5
-6
libavfilter/vf_unsharp.c
libavfilter/vf_unsharp.c
+27
-18
未找到文件。
doc/filters.texi
浏览文件 @
b83e9efc
...
...
@@ -2157,11 +2157,6 @@ l.r l.L
Sharpen or blur the input video.
It accepts the following parameters:
@var{luma_msize_x}:@var{luma_msize_y}:@var{luma_amount}:@var{chroma_msize_x}:@var{chroma_msize_y}:@var{chroma_amount}
Negative values for the amount will blur the input video, while positive
values will sharpen. All parameters are optional and default to the
equivalent of the string '5:5:1.0:5:5:0.0'.
@table @option
...
...
@@ -2191,9 +2186,13 @@ and 5.0, default value is 0.0.
@end table
Negative values for the amount will blur the input video, while positive
values will sharpen. All parameters are optional and default to the
equivalent of the string '5:5:1.0:5:5:0.0'.
@example
# Strong luma sharpen effect parameters
unsharp=
7:7:
2.5
unsharp=
luma_msize_x=7:luma_msize_y=7:luma_amount=
2.5
# Strong blur of both luma and chroma parameters
unsharp=7:7:-2:7:7:-2
...
...
libavfilter/vf_unsharp.c
浏览文件 @
b83e9efc
...
...
@@ -42,6 +42,7 @@
#include "video.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#define MIN_SIZE 3
...
...
@@ -62,6 +63,9 @@ typedef struct FilterParam {
}
FilterParam
;
typedef
struct
{
const
AVClass
*
class
;
int
lmsize_x
,
lmsize_y
,
cmsize_x
,
cmsize_y
;
float
lamount
,
camount
;
FilterParam
luma
;
///< luma parameters (width, height, amount)
FilterParam
chroma
;
///< chroma parameters (width, height, amount)
int
hsub
,
vsub
;
...
...
@@ -120,7 +124,7 @@ static void apply_unsharp( uint8_t *dst, int dst_stride,
}
}
static
void
set_filter_param
(
FilterParam
*
fp
,
int
msize_x
,
int
msize_y
,
double
amount
)
static
void
set_filter_param
(
FilterParam
*
fp
,
int
msize_x
,
int
msize_y
,
float
amount
)
{
fp
->
msize_x
=
msize_x
;
fp
->
msize_y
=
msize_y
;
...
...
@@ -135,24 +139,9 @@ static void set_filter_param(FilterParam *fp, int msize_x, int msize_y, double a
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
UnsharpContext
*
unsharp
=
ctx
->
priv
;
int
lmsize_x
=
5
,
cmsize_x
=
5
;
int
lmsize_y
=
5
,
cmsize_y
=
5
;
double
lamount
=
1
.
0
f
,
camount
=
0
.
0
f
;
if
(
args
)
sscanf
(
args
,
"%d:%d:%lf:%d:%d:%lf"
,
&
lmsize_x
,
&
lmsize_y
,
&
lamount
,
&
cmsize_x
,
&
cmsize_y
,
&
camount
);
if
((
lamount
&&
(
lmsize_x
<
2
||
lmsize_y
<
2
))
||
(
camount
&&
(
cmsize_x
<
2
||
cmsize_y
<
2
)))
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid value <2 for lmsize_x:%d or lmsize_y:%d or cmsize_x:%d or cmsize_y:%d
\n
"
,
lmsize_x
,
lmsize_y
,
cmsize_x
,
cmsize_y
);
return
AVERROR
(
EINVAL
);
}
set_filter_param
(
&
unsharp
->
luma
,
lmsize_x
,
lmsize_y
,
lamount
);
set_filter_param
(
&
unsharp
->
chroma
,
cmsize_x
,
cmsize_y
,
camount
);
set_filter_param
(
&
unsharp
->
luma
,
unsharp
->
lmsize_x
,
unsharp
->
lmsize_y
,
unsharp
->
lamount
);
set_filter_param
(
&
unsharp
->
chroma
,
unsharp
->
cmsize_x
,
unsharp
->
cmsize_y
,
unsharp
->
camount
);
return
0
;
}
...
...
@@ -237,6 +226,25 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
return
ff_filter_frame
(
outlink
,
out
);
}
#define OFFSET(x) offsetof(UnsharpContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
options
[]
=
{
{
"luma_msize_x"
,
"luma matrix horizontal size"
,
OFFSET
(
lmsize_x
),
AV_OPT_TYPE_INT
,
{
.
i64
=
5
},
MIN_SIZE
,
MAX_SIZE
,
FLAGS
},
{
"luma_msize_y"
,
"luma matrix vertical size"
,
OFFSET
(
lmsize_y
),
AV_OPT_TYPE_INT
,
{
.
i64
=
5
},
MIN_SIZE
,
MAX_SIZE
,
FLAGS
},
{
"luma_amount"
,
"luma effect strength"
,
OFFSET
(
lamount
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
1
},
-
2
,
5
,
FLAGS
},
{
"chroma_msize_x"
,
"chroma matrix horizontal size"
,
OFFSET
(
cmsize_x
),
AV_OPT_TYPE_INT
,
{
.
i64
=
5
},
MIN_SIZE
,
MAX_SIZE
,
FLAGS
},
{
"chroma_msize_y"
,
"chroma matrix vertical size"
,
OFFSET
(
cmsize_y
),
AV_OPT_TYPE_INT
,
{
.
i64
=
5
},
MIN_SIZE
,
MAX_SIZE
,
FLAGS
},
{
"chroma_amount"
,
"chroma effect strength"
,
OFFSET
(
camount
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
-
2
,
5
,
FLAGS
},
{
NULL
},
};
static
const
AVClass
unsharp_class
=
{
.
class_name
=
"unsharp"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_unsharp_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -260,6 +268,7 @@ AVFilter avfilter_vf_unsharp = {
.
description
=
NULL_IF_CONFIG_SMALL
(
"Sharpen or blur the input video."
),
.
priv_size
=
sizeof
(
UnsharpContext
),
.
priv_class
=
&
unsharp_class
,
.
init
=
init
,
.
uninit
=
uninit
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录