Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
a8fbb7b6
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,发现更多精彩内容 >>
提交
a8fbb7b6
编写于
7月 15, 2015
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter: add random video filter
Signed-off-by:
N
Paul B Mahol
<
onemda@gmail.com
>
上级
eb468b0b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
166 addition
and
1 deletion
+166
-1
Changelog
Changelog
+1
-0
doc/filters.texi
doc/filters.texi
+18
-0
libavfilter/Makefile
libavfilter/Makefile
+1
-0
libavfilter/allfilters.c
libavfilter/allfilters.c
+1
-0
libavfilter/version.h
libavfilter/version.h
+1
-1
libavfilter/vf_random.c
libavfilter/vf_random.c
+144
-0
未找到文件。
Changelog
浏览文件 @
a8fbb7b6
...
...
@@ -19,6 +19,7 @@ version <next>:
- erosion, dilation, deflate and inflate video filters
- Dynamic Audio Normalizer as dynaudnorm filter
- Reverse filter
- Random filter
version 2.7:
...
...
doc/filters.texi
浏览文件 @
a8fbb7b6
...
...
@@ -8279,6 +8279,24 @@ qp=2+2*sin(PI*qp)
@end example
@end itemize
@section random
Flush video frames from internal cache of frames into a random order.
No frame is discarded.
Inspired by @ref{frei0r} nervous filter.
@table @option
@item frames
Set size in number of frames of internal cache, in range from @code{2} to
@code{512}. Default is @code{30}.
@item seed
Set seed for random number generator, must be an integer included between
@code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
less than @code{0}, the filter will try to use a good random seed on a
best effort basis.
@end table
@section removegrain
The removegrain filter is a spatial denoiser for progressive video.
...
...
libavfilter/Makefile
浏览文件 @
a8fbb7b6
...
...
@@ -183,6 +183,7 @@ OBJS-$(CONFIG_PP7_FILTER) += vf_pp7.o
OBJS-$(CONFIG_PSNR_FILTER)
+=
vf_psnr.o dualinput.o framesync.o
OBJS-$(CONFIG_PULLUP_FILTER)
+=
vf_pullup.o
OBJS-$(CONFIG_QP_FILTER)
+=
vf_qp.o
OBJS-$(CONFIG_RANDOM_FILTER)
+=
vf_random.o
OBJS-$(CONFIG_REMOVEGRAIN_FILTER)
+=
vf_removegrain.o
OBJS-$(CONFIG_REMOVELOGO_FILTER)
+=
bbox.o lswsutils.o lavfutils.o vf_removelogo.o
OBJS-$(CONFIG_REPEATFIELDS_FILTER)
+=
vf_repeatfields.o
...
...
libavfilter/allfilters.c
浏览文件 @
a8fbb7b6
...
...
@@ -198,6 +198,7 @@ void avfilter_register_all(void)
REGISTER_FILTER
(
PSNR
,
psnr
,
vf
);
REGISTER_FILTER
(
PULLUP
,
pullup
,
vf
);
REGISTER_FILTER
(
QP
,
qp
,
vf
);
REGISTER_FILTER
(
RANDOM
,
random
,
vf
);
REGISTER_FILTER
(
REMOVEGRAIN
,
removegrain
,
vf
);
REGISTER_FILTER
(
REMOVELOGO
,
removelogo
,
vf
);
REGISTER_FILTER
(
REPEATFIELDS
,
repeatfields
,
vf
);
...
...
libavfilter/version.h
浏览文件 @
a8fbb7b6
...
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MINOR 2
4
#define LIBAVFILTER_VERSION_MINOR 2
5
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
libavfilter/vf_random.c
0 → 100644
浏览文件 @
a8fbb7b6
/*
* Copyright (c) 2015 Paul B Mahol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/lfg.h"
#include "libavutil/opt.h"
#include "libavutil/random_seed.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#define MAX_FRAMES 512
typedef
struct
RandomContext
{
const
AVClass
*
class
;
AVLFG
lfg
;
int
nb_frames
;
int64_t
random_seed
;
int
nb_frames_filled
;
AVFrame
*
frames
[
MAX_FRAMES
];
int64_t
pts
[
MAX_FRAMES
];
int
flush_idx
;
}
RandomContext
;
#define OFFSET(x) offsetof(RandomContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
static
const
AVOption
random_options
[]
=
{
{
"frames"
,
"set number of frames in cache"
,
OFFSET
(
nb_frames
),
AV_OPT_TYPE_INT
,
{.
i64
=
30
},
2
,
MAX_FRAMES
,
FLAGS
},
{
"seed"
,
"set the seed"
,
OFFSET
(
random_seed
),
AV_OPT_TYPE_INT64
,
{.
i64
=-
1
},
-
1
,
UINT32_MAX
,
FLAGS
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
random
);
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
RandomContext
*
s
=
ctx
->
priv
;
uint32_t
seed
;
if
(
s
->
random_seed
<
0
)
s
->
random_seed
=
av_get_random_seed
();
seed
=
s
->
random_seed
;
av_lfg_init
(
&
s
->
lfg
,
seed
);
return
0
;
}
static
int
config_output
(
AVFilterLink
*
outlink
)
{
outlink
->
flags
|=
FF_LINK_FLAG_REQUEST_LOOP
;
return
0
;
}
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
in
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
RandomContext
*
s
=
ctx
->
priv
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFrame
*
out
;
int
idx
;
if
(
s
->
nb_frames_filled
<
s
->
nb_frames
)
{
s
->
frames
[
s
->
nb_frames_filled
]
=
in
;
s
->
pts
[
s
->
nb_frames_filled
++
]
=
in
->
pts
;
return
0
;
}
idx
=
av_lfg_get
(
&
s
->
lfg
)
%
s
->
nb_frames
;
out
=
s
->
frames
[
idx
];
out
->
pts
=
s
->
pts
[
0
];
memmove
(
&
s
->
pts
[
0
],
&
s
->
pts
[
1
],
(
s
->
nb_frames
-
1
)
*
sizeof
(
s
->
pts
[
0
]));
s
->
frames
[
idx
]
=
in
;
s
->
pts
[
s
->
nb_frames
-
1
]
=
in
->
pts
;
return
ff_filter_frame
(
outlink
,
out
);
}
static
int
request_frame
(
AVFilterLink
*
outlink
)
{
AVFilterContext
*
ctx
=
outlink
->
src
;
RandomContext
*
s
=
ctx
->
priv
;
int
ret
;
ret
=
ff_request_frame
(
ctx
->
inputs
[
0
]);
if
(
ret
==
AVERROR_EOF
&&
!
ctx
->
is_disabled
&&
s
->
nb_frames
>
0
)
{
AVFrame
*
out
=
s
->
frames
[
s
->
nb_frames
-
1
];
out
->
pts
=
s
->
pts
[
s
->
flush_idx
++
];
ret
=
ff_filter_frame
(
outlink
,
out
);
s
->
frames
[
s
->
nb_frames
-
1
]
=
NULL
;
s
->
nb_frames
--
;
}
return
ret
;
}
static
const
AVFilterPad
random_inputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
filter_frame
=
filter_frame
,
},
{
NULL
}
};
static
const
AVFilterPad
random_outputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
request_frame
=
request_frame
,
.
config_props
=
config_output
,
},
{
NULL
}
};
AVFilter
ff_vf_random
=
{
.
name
=
"random"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Return random frames."
),
.
priv_size
=
sizeof
(
RandomContext
),
.
priv_class
=
&
random_class
,
.
init
=
init
,
.
inputs
=
random_inputs
,
.
outputs
=
random_outputs
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录