Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
20b46f8f
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,发现更多精彩内容 >>
提交
20b46f8f
编写于
2月 25, 2013
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vf_lut: switch to an AVOptions-based system.
上级
ee0e8d4b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
59 deletion
+50
-59
doc/filters.texi
doc/filters.texi
+10
-18
libavfilter/vf_lut.c
libavfilter/vf_lut.c
+40
-41
未找到文件。
doc/filters.texi
浏览文件 @
20b46f8f
...
...
@@ -1243,40 +1243,32 @@ to an output value, and apply it to input video.
@var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
to an RGB input video.
These filters accept in input a ":"-separated list of options, which
specify the expressions used for computing the lookup table for the
corresponding pixel component values.
The @var{lut} filter requires either YUV or RGB pixel formats in
input, and accepts the options:
These filters accept the following options:
@table @option
@item @var{c0} (first pixel component)
@item @var{c1} (second pixel component)
@item @var{c2} (third pixel component)
@item @var{c3} (fourth pixel component, corresponds to the alpha component)
@end table
The exact component associated to each option depends on the format in
input.
The @var{lutrgb} filter requires RGB pixel formats in input, and
accepts the options:
@table @option
@item @var{r} (red component)
@item @var{g} (green component)
@item @var{b} (blue component)
@item @var{a} (alpha component)
@end table
The @var{lutyuv} filter requires YUV pixel formats in input, and
accepts the options:
@table @option
@item @var{y} (Y/luminance component)
@item @var{u} (U/Cb component)
@item @var{v} (V/Cr component)
@item @var{a} (alpha component)
@end table
Each of them specifies the expression to use for computing the lookup table for
the corresponding pixel component values.
The exact component associated to each of the @var{c*} options depends on the
format in input.
The @var{lut} filter requires either YUV or RGB pixel formats in input,
@var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
The expressions can contain the following constants and functions:
@table @option
...
...
libavfilter/vf_lut.c
浏览文件 @
20b46f8f
...
...
@@ -84,40 +84,26 @@ typedef struct {
#define A 3
#define OFFSET(x) offsetof(LutContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
lut_options
[]
=
{
{
"c0"
,
"set component #0 expression"
,
OFFSET
(
comp_expr_str
[
0
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"c1"
,
"set component #1 expression"
,
OFFSET
(
comp_expr_str
[
1
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"c2"
,
"set component #2 expression"
,
OFFSET
(
comp_expr_str
[
2
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"c3"
,
"set component #3 expression"
,
OFFSET
(
comp_expr_str
[
3
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"y"
,
"set Y expression"
,
OFFSET
(
comp_expr_str
[
Y
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"u"
,
"set U expression"
,
OFFSET
(
comp_expr_str
[
U
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"v"
,
"set V expression"
,
OFFSET
(
comp_expr_str
[
V
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"r"
,
"set R expression"
,
OFFSET
(
comp_expr_str
[
R
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"g"
,
"set G expression"
,
OFFSET
(
comp_expr_str
[
G
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"b"
,
"set B expression"
,
OFFSET
(
comp_expr_str
[
B
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
"a"
,
"set A expression"
,
OFFSET
(
comp_expr_str
[
A
]),
AV_OPT_TYPE_STRING
,
{.
str
=
"val"
},
CHAR_MIN
,
CHAR_MAX
},
{
NULL
},
};
static
const
char
*
lut_get_name
(
void
*
ctx
)
{
return
"lut"
;
}
static
const
AVClass
lut_class
=
{
"LutContext"
,
lut_get_name
,
lut_options
{
"c0"
,
"set component #0 expression"
,
OFFSET
(
comp_expr_str
[
0
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"c1"
,
"set component #1 expression"
,
OFFSET
(
comp_expr_str
[
1
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"c2"
,
"set component #2 expression"
,
OFFSET
(
comp_expr_str
[
2
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"c3"
,
"set component #3 expression"
,
OFFSET
(
comp_expr_str
[
3
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"y"
,
"set Y expression"
,
OFFSET
(
comp_expr_str
[
Y
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"u"
,
"set U expression"
,
OFFSET
(
comp_expr_str
[
U
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"v"
,
"set V expression"
,
OFFSET
(
comp_expr_str
[
V
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"r"
,
"set R expression"
,
OFFSET
(
comp_expr_str
[
R
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"g"
,
"set G expression"
,
OFFSET
(
comp_expr_str
[
G
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"b"
,
"set B expression"
,
OFFSET
(
comp_expr_str
[
B
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
"a"
,
"set A expression"
,
OFFSET
(
comp_expr_str
[
A
]),
AV_OPT_TYPE_STRING
,
{
.
str
=
"val"
},
.
flags
=
FLAGS
},
{
NULL
},
};
static
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
LutContext
*
lut
=
ctx
->
priv
;
int
ret
;
lut
->
class
=
&
lut_class
;
av_opt_set_defaults
(
lut
);
lut
->
var_values
[
VAR_PHI
]
=
M_PHI
;
lut
->
var_values
[
VAR_PI
]
=
M_PI
;
...
...
@@ -125,8 +111,6 @@ static int init(AVFilterContext *ctx, const char *args)
lut
->
is_rgb
=
!
strcmp
(
ctx
->
filter
->
name
,
"lutrgb"
);
lut
->
is_yuv
=
!
strcmp
(
ctx
->
filter
->
name
,
"lutyuv"
);
if
(
args
&&
(
ret
=
av_set_options_string
(
lut
,
args
,
"="
,
":"
))
<
0
)
return
ret
;
return
0
;
}
...
...
@@ -363,11 +347,18 @@ static const AVFilterPad outputs[] = {
.
type
=
AVMEDIA_TYPE_VIDEO
,
},
{
.
name
=
NULL
}
};
#define DEFINE_LUT_FILTER(name_, description_, init_) \
#define DEFINE_LUT_FILTER(name_, description_, init_, options) \
static const AVClass name_ ## _class = { \
.class_name = #name_, \
.item_name = av_default_item_name, \
.option = options, \
.version = LIBAVUTIL_VERSION_INT, \
}; \
AVFilter avfilter_vf_##name_ = { \
.name = #name_, \
.description = NULL_IF_CONFIG_SMALL(description_), \
.priv_size = sizeof(LutContext), \
.priv_class = &name_ ## _class, \
\
.init = init_, \
.uninit = uninit, \
...
...
@@ -378,33 +369,41 @@ static const AVFilterPad outputs[] = {
}
#if CONFIG_LUT_FILTER
DEFINE_LUT_FILTER
(
lut
,
"Compute and apply a lookup table to the RGB/YUV input video."
,
init
);
DEFINE_LUT_FILTER
(
lut
,
"Compute and apply a lookup table to the RGB/YUV input video."
,
init
,
lut_options
);
#endif
#if CONFIG_LUTYUV_FILTER
DEFINE_LUT_FILTER
(
lutyuv
,
"Compute and apply a lookup table to the YUV input video."
,
init
);
DEFINE_LUT_FILTER
(
lutyuv
,
"Compute and apply a lookup table to the YUV input video."
,
init
,
lut_options
);
#endif
#if CONFIG_LUTRGB_FILTER
DEFINE_LUT_FILTER
(
lutrgb
,
"Compute and apply a lookup table to the RGB input video."
,
init
);
DEFINE_LUT_FILTER
(
lutrgb
,
"Compute and apply a lookup table to the RGB input video."
,
init
,
lut_options
);
#endif
#if CONFIG_NEGATE_FILTER
static
const
AVOption
negate_options
[]
=
{
{
"negate_alpha"
,
NULL
,
OFFSET
(
negate_alpha
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
.
flags
=
FLAGS
},
{
NULL
},
};
static
int
negate_init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
LutContext
*
lut
=
ctx
->
priv
;
char
lut_params
[
64
];
if
(
args
)
sscanf
(
args
,
"%d"
,
&
lut
->
negate_alpha
);
int
i
;
av_log
(
ctx
,
AV_LOG_DEBUG
,
"negate_alpha:%d
\n
"
,
lut
->
negate_alpha
);
snprintf
(
lut_params
,
sizeof
(
lut_params
),
"c0=negval:c1=negval:c2=negval:a=%s"
,
lut
->
negate_alpha
?
"negval"
:
"val"
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
lut
->
comp_expr_str
[
i
]
=
av_strdup
((
i
==
3
&&
lut
->
negate_alpha
)
?
"val"
:
"negval"
);
if
(
!
lut
->
comp_expr_str
[
i
])
{
uninit
(
ctx
);
return
AVERROR
(
ENOMEM
);
}
}
return
init
(
ctx
,
lut_params
);
return
init
(
ctx
,
NULL
);
}
DEFINE_LUT_FILTER
(
negate
,
"Negate input video."
,
negate_init
);
DEFINE_LUT_FILTER
(
negate
,
"Negate input video."
,
negate_init
,
negate_options
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录