Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
85195f6a
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 搜索 >>
提交
85195f6a
编写于
9月 26, 2020
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter/vf_histogram: add slide modes for thistogram
上级
a162e78c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
64 addition
and
1 deletion
+64
-1
doc/filters.texi
doc/filters.texi
+23
-0
libavfilter/vf_histogram.c
libavfilter/vf_histogram.c
+41
-1
未找到文件。
doc/filters.texi
浏览文件 @
85195f6a
...
...
@@ -18270,6 +18270,29 @@ Show envelope. Default is disabled.
@item ecolor, ec
Set envelope color. Default is @code{gold}.
@item slide
Set slide mode.
Available values for slide is:
@table @samp
@item frame
Draw new frame when right border is reached.
@item replace
Replace old columns with new ones.
@item scroll
Scroll from right to left.
@item rscroll
Scroll from left to right.
@item picture
Draw single picture.
@end table
Default is @code{replace}.
@end table
@section threshold
...
...
libavfilter/vf_histogram.c
浏览文件 @
85195f6a
...
...
@@ -34,6 +34,7 @@ typedef struct HistogramContext {
const
AVClass
*
class
;
///< AVClass context for log and options purpose
int
thistogram
;
int
envelope
;
int
slide
;
unsigned
histogram
[
256
*
256
];
int
histogram_size
;
int
width
;
...
...
@@ -354,8 +355,25 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
max_hval_log
=
log2
(
max_hval
+
1
);
if
(
s
->
thistogram
)
{
const
int
bpp
=
1
+
(
s
->
histogram_size
>
256
);
int
minh
=
s
->
histogram_size
-
1
,
maxh
=
0
;
if
(
s
->
slide
==
2
)
{
s
->
x_pos
=
out
->
width
-
1
;
for
(
j
=
0
;
j
<
outlink
->
h
;
j
++
)
{
memmove
(
out
->
data
[
p
]
+
j
*
out
->
linesize
[
p
]
,
out
->
data
[
p
]
+
j
*
out
->
linesize
[
p
]
+
bpp
,
(
outlink
->
w
-
1
)
*
bpp
);
}
}
else
if
(
s
->
slide
==
3
)
{
s
->
x_pos
=
0
;
for
(
j
=
0
;
j
<
outlink
->
h
;
j
++
)
{
memmove
(
out
->
data
[
p
]
+
j
*
out
->
linesize
[
p
]
+
bpp
,
out
->
data
[
p
]
+
j
*
out
->
linesize
[
p
],
(
outlink
->
w
-
1
)
*
bpp
);
}
}
for
(
int
i
=
0
;
i
<
s
->
histogram_size
;
i
++
)
{
int
idx
=
s
->
histogram_size
-
i
-
1
;
int
value
=
s
->
start
[
p
];
...
...
@@ -443,8 +461,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out
->
pts
=
in
->
pts
;
av_frame_free
(
&
in
);
s
->
x_pos
++
;
if
(
s
->
x_pos
>=
s
->
width
)
if
(
s
->
x_pos
>=
s
->
width
)
{
s
->
x_pos
=
0
;
if
(
s
->
thistogram
&&
(
s
->
slide
==
4
||
s
->
slide
==
0
))
{
s
->
out
=
NULL
;
goto
end
;
}
}
else
if
(
s
->
thistogram
&&
s
->
slide
==
4
)
{
return
0
;
}
if
(
s
->
thistogram
)
{
AVFrame
*
clone
=
av_frame_clone
(
out
);
...
...
@@ -453,6 +478,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
AVERROR
(
ENOMEM
);
return
ff_filter_frame
(
outlink
,
clone
);
}
end:
return
ff_filter_frame
(
outlink
,
out
);
}
...
...
@@ -491,6 +517,13 @@ AVFilter ff_vf_histogram = {
#if CONFIG_THISTOGRAM_FILTER
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
HistogramContext
*
s
=
ctx
->
priv
;
av_frame_free
(
&
s
->
out
);
}
static
const
AVOption
thistogram_options
[]
=
{
{
"width"
,
"set width"
,
OFFSET
(
width
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
8192
,
FLAGS
},
{
"w"
,
"set width"
,
OFFSET
(
width
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
8192
,
FLAGS
},
...
...
@@ -501,6 +534,12 @@ static const AVOption thistogram_options[] = {
{
"e"
,
"display envelope"
,
OFFSET
(
envelope
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"ecolor"
,
"set envelope color"
,
OFFSET
(
envelope_rgba
),
AV_OPT_TYPE_COLOR
,
{.
str
=
"gold"
},
0
,
0
,
FLAGS
},
{
"ec"
,
"set envelope color"
,
OFFSET
(
envelope_rgba
),
AV_OPT_TYPE_COLOR
,
{.
str
=
"gold"
},
0
,
0
,
FLAGS
},
{
"slide"
,
"set slide mode"
,
OFFSET
(
slide
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
4
,
FLAGS
,
"slide"
},
{
"frame"
,
"draw new frames"
,
OFFSET
(
slide
),
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"slide"
},
{
"replace"
,
"replace old columns with new"
,
OFFSET
(
slide
),
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"slide"
},
{
"scroll"
,
"scroll from right to left"
,
OFFSET
(
slide
),
AV_OPT_TYPE_CONST
,
{.
i64
=
2
},
0
,
0
,
FLAGS
,
"slide"
},
{
"rscroll"
,
"scroll from left to right"
,
OFFSET
(
slide
),
AV_OPT_TYPE_CONST
,
{.
i64
=
3
},
0
,
0
,
FLAGS
,
"slide"
},
{
"picture"
,
"display graph in single frame"
,
OFFSET
(
slide
),
AV_OPT_TYPE_CONST
,
{.
i64
=
4
},
0
,
0
,
FLAGS
,
"slide"
},
{
NULL
}
};
...
...
@@ -513,6 +552,7 @@ AVFilter ff_vf_thistogram = {
.
query_formats
=
query_formats
,
.
inputs
=
inputs
,
.
outputs
=
outputs
,
.
uninit
=
uninit
,
.
priv_class
=
&
thistogram_class
,
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录