Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
8c2f81a1
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,发现更多精彩内容 >>
提交
8c2f81a1
编写于
11月 21, 2019
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter/vf_hqdn3d: add support for commands
上级
3a61297a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
9 deletion
+38
-9
doc/filters.texi
doc/filters.texi
+7
-0
libavfilter/vf_hqdn3d.c
libavfilter/vf_hqdn3d.c
+31
-9
未找到文件。
doc/filters.texi
浏览文件 @
8c2f81a1
...
...
@@ -11765,6 +11765,13 @@ A floating point number which specifies chroma temporal strength. It defaults to
@var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
@end table
@subsection Commands
This filter supports same @ref{commands} as options.
The command accepts the same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
@anchor{hwdownload}
@section hwdownload
...
...
libavfilter/vf_hqdn3d.c
浏览文件 @
8c2f81a1
...
...
@@ -172,13 +172,10 @@ static int denoise_depth(HQDN3DContext *s,
} \
} while (0)
static
int16_t
*
precalc_coefs
(
double
dist25
,
int
depth
)
static
void
precalc_coefs
(
double
dist25
,
int
depth
,
int16_t
*
ct
)
{
int
i
;
double
gamma
,
simil
,
C
;
int16_t
*
ct
=
av_malloc
((
512
<<
LUT_BITS
)
*
sizeof
(
int16_t
));
if
(
!
ct
)
return
NULL
;
gamma
=
log
(
0
.
25
)
/
log
(
1
.
0
-
FFMIN
(
dist25
,
252
.
0
)
/
255
.
0
-
0
.
00001
);
...
...
@@ -190,7 +187,6 @@ static int16_t *precalc_coefs(double dist25, int depth)
}
ct
[
0
]
=
!!
dist25
;
return
ct
;
}
#define PARAM1_DEFAULT 4.0
...
...
@@ -254,17 +250,26 @@ static int query_formats(AVFilterContext *ctx)
return
ff_set_common_formats
(
ctx
,
fmts_list
);
}
static
void
calc_coefs
(
AVFilterContext
*
ctx
)
{
HQDN3DContext
*
s
=
ctx
->
priv
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
precalc_coefs
(
s
->
strength
[
i
],
s
->
depth
,
s
->
coefs
[
i
]);
}
static
int
config_input
(
AVFilterLink
*
inlink
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
HQDN3DContext
*
s
=
inlink
->
dst
->
priv
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
int
i
;
int
i
,
depth
;
uninit
(
inlink
->
dst
);
s
->
hsub
=
desc
->
log2_chroma_w
;
s
->
vsub
=
desc
->
log2_chroma_h
;
s
->
depth
=
desc
->
comp
[
0
].
depth
;
s
->
depth
=
de
pth
=
de
sc
->
comp
[
0
].
depth
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
s
->
line
[
i
]
=
av_malloc_array
(
inlink
->
w
,
sizeof
(
*
s
->
line
[
i
]));
...
...
@@ -273,11 +278,13 @@ static int config_input(AVFilterLink *inlink)
}
for
(
i
=
0
;
i
<
4
;
i
++
)
{
s
->
coefs
[
i
]
=
precalc_coefs
(
s
->
strength
[
i
],
s
->
depth
);
s
->
coefs
[
i
]
=
av_malloc
((
512
<<
LUT_BITS
)
*
sizeof
(
int16_t
)
);
if
(
!
s
->
coefs
[
i
])
return
AVERROR
(
ENOMEM
);
}
calc_coefs
(
ctx
);
if
(
ARCH_X86
)
ff_hqdn3d_init_x86
(
s
);
...
...
@@ -346,8 +353,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
ff_filter_frame
(
outlink
,
out
);
}
static
int
process_command
(
AVFilterContext
*
ctx
,
const
char
*
cmd
,
const
char
*
args
,
char
*
res
,
int
res_len
,
int
flags
)
{
int
ret
;
ret
=
ff_filter_process_command
(
ctx
,
cmd
,
args
,
res
,
res_len
,
flags
);
if
(
ret
<
0
)
return
ret
;
calc_coefs
(
ctx
);
return
0
;
}
#define OFFSET(x) offsetof(HQDN3DContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
| AV_OPT_FLAG_RUNTIME_PARAM
static
const
AVOption
hqdn3d_options
[]
=
{
{
"luma_spatial"
,
"spatial luma strength"
,
OFFSET
(
strength
[
LUMA_SPATIAL
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
0
.
0
},
0
,
DBL_MAX
,
FLAGS
},
{
"chroma_spatial"
,
"spatial chroma strength"
,
OFFSET
(
strength
[
CHROMA_SPATIAL
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
0
.
0
},
0
,
DBL_MAX
,
FLAGS
},
...
...
@@ -388,4 +409,5 @@ AVFilter ff_vf_hqdn3d = {
.
inputs
=
avfilter_vf_hqdn3d_inputs
,
.
outputs
=
avfilter_vf_hqdn3d_outputs
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
|
AVFILTER_FLAG_SLICE_THREADS
,
.
process_command
=
process_command
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录