Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
d7646937
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,体验更适合开发者的 AI 搜索 >>
提交
d7646937
编写于
12月 11, 2020
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter/vf_convolution: add support for commands
上级
7adb747f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
19 deletion
+63
-19
doc/filters.texi
doc/filters.texi
+16
-0
libavfilter/vf_convolution.c
libavfilter/vf_convolution.c
+47
-19
未找到文件。
doc/filters.texi
浏览文件 @
d7646937
...
...
@@ -8544,6 +8544,10 @@ Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
Default is @var{square}.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@subsection Examples
@itemize
...
...
@@ -15947,6 +15951,10 @@ Set value which will be multiplied with filtered result.
Set value which will be added to filtered result.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section pseudocolor
Alter frame colors in video with pseudocolors.
...
...
@@ -16539,6 +16547,10 @@ Set value which will be multiplied with filtered result.
Set value which will be added to filtered result.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section rotate
Rotate video by an arbitrary angle expressed in radians.
...
...
@@ -18125,6 +18137,10 @@ Set value which will be multiplied with filtered result.
Set value which will be added to filtered result.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@anchor{spp}
@section spp
...
...
libavfilter/vf_convolution.c
浏览文件 @
d7646937
...
...
@@ -31,7 +31,7 @@
#include "video.h"
#define OFFSET(x) offsetof(ConvolutionContext, 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
convolution_options
[]
=
{
{
"0m"
,
"set matrix for 1st plane"
,
OFFSET
(
matrix_str
[
0
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"0 0 0 0 1 0 0 0 0"
},
0
,
0
,
FLAGS
},
...
...
@@ -644,20 +644,25 @@ static av_cold int init(AVFilterContext *ctx)
float
sum
=
0
;
p
=
s
->
matrix_str
[
i
];
while
(
s
->
matrix_length
[
i
]
<
49
)
{
if
(
!
(
arg
=
av_strtok
(
p
,
" "
,
&
saveptr
)))
break
;
p
=
NULL
;
sscanf
(
arg
,
"%d"
,
&
matrix
[
s
->
matrix_length
[
i
]]);
sum
+=
matrix
[
s
->
matrix_length
[
i
]];
s
->
matrix_length
[
i
]
++
;
if
(
p
)
{
s
->
matrix_length
[
i
]
=
0
;
while
(
s
->
matrix_length
[
i
]
<
49
)
{
if
(
!
(
arg
=
av_strtok
(
p
,
" |"
,
&
saveptr
)))
break
;
p
=
NULL
;
sscanf
(
arg
,
"%d"
,
&
matrix
[
s
->
matrix_length
[
i
]]);
sum
+=
matrix
[
s
->
matrix_length
[
i
]];
s
->
matrix_length
[
i
]
++
;
}
if
(
!
(
s
->
matrix_length
[
i
]
&
1
))
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"number of matrix elements must be odd
\n
"
);
return
AVERROR
(
EINVAL
);
}
}
if
(
!
(
s
->
matrix_length
[
i
]
&
1
))
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"number of matrix elements must be odd
\n
"
);
return
AVERROR
(
EINVAL
);
}
if
(
s
->
mode
[
i
]
==
MATRIX_ROW
)
{
s
->
filter
[
i
]
=
filter_row
;
s
->
setup
[
i
]
=
setup_row
;
...
...
@@ -668,24 +673,31 @@ static av_cold int init(AVFilterContext *ctx)
s
->
size
[
i
]
=
s
->
matrix_length
[
i
];
}
else
if
(
s
->
matrix_length
[
i
]
==
9
)
{
s
->
size
[
i
]
=
3
;
if
(
!
memcmp
(
matrix
,
same3x3
,
sizeof
(
same3x3
)))
if
(
!
memcmp
(
matrix
,
same3x3
,
sizeof
(
same3x3
)))
{
s
->
copy
[
i
]
=
1
;
else
}
else
{
s
->
filter
[
i
]
=
filter_3x3
;
s
->
copy
[
i
]
=
0
;
}
s
->
setup
[
i
]
=
setup_3x3
;
}
else
if
(
s
->
matrix_length
[
i
]
==
25
)
{
s
->
size
[
i
]
=
5
;
if
(
!
memcmp
(
matrix
,
same5x5
,
sizeof
(
same5x5
)))
if
(
!
memcmp
(
matrix
,
same5x5
,
sizeof
(
same5x5
)))
{
s
->
copy
[
i
]
=
1
;
else
}
else
{
s
->
filter
[
i
]
=
filter_5x5
;
s
->
copy
[
i
]
=
0
;
}
s
->
setup
[
i
]
=
setup_5x5
;
}
else
if
(
s
->
matrix_length
[
i
]
==
49
)
{
s
->
size
[
i
]
=
7
;
if
(
!
memcmp
(
matrix
,
same7x7
,
sizeof
(
same7x7
)))
if
(
!
memcmp
(
matrix
,
same7x7
,
sizeof
(
same7x7
)))
{
s
->
copy
[
i
]
=
1
;
else
}
else
{
s
->
filter
[
i
]
=
filter_7x7
;
s
->
copy
[
i
]
=
0
;
}
s
->
setup
[
i
]
=
setup_7x7
;
}
else
{
return
AVERROR
(
EINVAL
);
...
...
@@ -737,6 +749,18 @@ static av_cold int init(AVFilterContext *ctx)
return
0
;
}
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
;
return
init
(
ctx
);
}
static
const
AVFilterPad
convolution_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -767,6 +791,7 @@ AVFilter ff_vf_convolution = {
.
inputs
=
convolution_inputs
,
.
outputs
=
convolution_outputs
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
|
AVFILTER_FLAG_SLICE_THREADS
,
.
process_command
=
process_command
,
};
#endif
/* CONFIG_CONVOLUTION_FILTER */
...
...
@@ -792,6 +817,7 @@ AVFilter ff_vf_prewitt = {
.
inputs
=
convolution_inputs
,
.
outputs
=
convolution_outputs
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
|
AVFILTER_FLAG_SLICE_THREADS
,
.
process_command
=
process_command
,
};
#endif
/* CONFIG_PREWITT_FILTER */
...
...
@@ -817,6 +843,7 @@ AVFilter ff_vf_sobel = {
.
inputs
=
convolution_inputs
,
.
outputs
=
convolution_outputs
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
|
AVFILTER_FLAG_SLICE_THREADS
,
.
process_command
=
process_command
,
};
#endif
/* CONFIG_SOBEL_FILTER */
...
...
@@ -842,6 +869,7 @@ AVFilter ff_vf_roberts = {
.
inputs
=
convolution_inputs
,
.
outputs
=
convolution_outputs
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
|
AVFILTER_FLAG_SLICE_THREADS
,
.
process_command
=
process_command
,
};
#endif
/* CONFIG_ROBERTS_FILTER */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录