Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
c79e7534
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 搜索 >>
提交
c79e7534
编写于
8月 01, 2017
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter: add unpremultiply filter
Signed-off-by:
N
Paul B Mahol
<
onemda@gmail.com
>
上级
11933017
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
285 addition
and
46 deletion
+285
-46
Changelog
Changelog
+1
-0
doc/filters.texi
doc/filters.texi
+19
-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_premultiply.c
libavfilter/vf_premultiply.c
+262
-45
未找到文件。
Changelog
浏览文件 @
c79e7534
...
@@ -29,6 +29,7 @@ version <next>:
...
@@ -29,6 +29,7 @@ version <next>:
- limiter video filter
- limiter video filter
- libvmaf video filter
- libvmaf video filter
- Dolby E decoder and SMPTE 337M demuxer
- Dolby E decoder and SMPTE 337M demuxer
- unpremultiply video filter
version 3.3:
version 3.3:
- CrystalHD decoder moved to new decode API
- CrystalHD decoder moved to new decode API
...
...
doc/filters.texi
浏览文件 @
c79e7534
...
@@ -14532,6 +14532,25 @@ ffmpeg -i INPUT -vf trim=duration=1
...
@@ -14532,6 +14532,25 @@ ffmpeg -i INPUT -vf trim=duration=1
@end itemize
@end itemize
@section unpremultiply
Apply alpha unpremultiply effect to input video stream using first plane
of second stream as alpha.
Both streams must have same dimensions and same pixel format.
The filter accepts the following option:
@table @option
@item planes
Set which planes will be processed, unprocessed planes will be copied.
By default value 0xf, all planes will be processed.
If the format has 1 or 2 components, then luma is bit 0.
If the format has 3 or 4 components:
for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
If present, the alpha channel is always the last bit.
@end table
@anchor{unsharp}
@anchor{unsharp}
@section unsharp
@section unsharp
...
...
libavfilter/Makefile
浏览文件 @
c79e7534
...
@@ -314,6 +314,7 @@ OBJS-$(CONFIG_TILE_FILTER) += vf_tile.o
...
@@ -314,6 +314,7 @@ OBJS-$(CONFIG_TILE_FILTER) += vf_tile.o
OBJS-$(CONFIG_TINTERLACE_FILTER)
+=
vf_tinterlace.o
OBJS-$(CONFIG_TINTERLACE_FILTER)
+=
vf_tinterlace.o
OBJS-$(CONFIG_TRANSPOSE_FILTER)
+=
vf_transpose.o
OBJS-$(CONFIG_TRANSPOSE_FILTER)
+=
vf_transpose.o
OBJS-$(CONFIG_TRIM_FILTER)
+=
trim.o
OBJS-$(CONFIG_TRIM_FILTER)
+=
trim.o
OBJS-$(CONFIG_UNPREMULTIPLY_FILTER)
+=
vf_premultiply.o framesync2.o
OBJS-$(CONFIG_UNSHARP_FILTER)
+=
vf_unsharp.o
OBJS-$(CONFIG_UNSHARP_FILTER)
+=
vf_unsharp.o
OBJS-$(CONFIG_USPP_FILTER)
+=
vf_uspp.o
OBJS-$(CONFIG_USPP_FILTER)
+=
vf_uspp.o
OBJS-$(CONFIG_VAGUEDENOISER_FILTER)
+=
vf_vaguedenoiser.o
OBJS-$(CONFIG_VAGUEDENOISER_FILTER)
+=
vf_vaguedenoiser.o
...
...
libavfilter/allfilters.c
浏览文件 @
c79e7534
...
@@ -325,6 +325,7 @@ static void register_all(void)
...
@@ -325,6 +325,7 @@ static void register_all(void)
REGISTER_FILTER
(
TINTERLACE
,
tinterlace
,
vf
);
REGISTER_FILTER
(
TINTERLACE
,
tinterlace
,
vf
);
REGISTER_FILTER
(
TRANSPOSE
,
transpose
,
vf
);
REGISTER_FILTER
(
TRANSPOSE
,
transpose
,
vf
);
REGISTER_FILTER
(
TRIM
,
trim
,
vf
);
REGISTER_FILTER
(
TRIM
,
trim
,
vf
);
REGISTER_FILTER
(
UNPREMULTIPLY
,
unpremultiply
,
vf
);
REGISTER_FILTER
(
UNSHARP
,
unsharp
,
vf
);
REGISTER_FILTER
(
UNSHARP
,
unsharp
,
vf
);
REGISTER_FILTER
(
USPP
,
uspp
,
vf
);
REGISTER_FILTER
(
USPP
,
uspp
,
vf
);
REGISTER_FILTER
(
VAGUEDENOISER
,
vaguedenoiser
,
vf
);
REGISTER_FILTER
(
VAGUEDENOISER
,
vaguedenoiser
,
vf
);
...
...
libavfilter/version.h
浏览文件 @
c79e7534
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 9
5
#define LIBAVFILTER_VERSION_MINOR 9
6
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
libavfilter/vf_premultiply.c
浏览文件 @
c79e7534
...
@@ -33,7 +33,8 @@ typedef struct PreMultiplyContext {
...
@@ -33,7 +33,8 @@ typedef struct PreMultiplyContext {
int
linesize
[
4
];
int
linesize
[
4
];
int
nb_planes
;
int
nb_planes
;
int
planes
;
int
planes
;
int
half
,
depth
,
offset
;
int
inverse
;
int
half
,
depth
,
offset
,
max
;
FFFrameSync
fs
;
FFFrameSync
fs
;
void
(
*
premultiply
[
4
])(
const
uint8_t
*
msrc
,
const
uint8_t
*
asrc
,
void
(
*
premultiply
[
4
])(
const
uint8_t
*
msrc
,
const
uint8_t
*
asrc
,
...
@@ -47,11 +48,12 @@ typedef struct PreMultiplyContext {
...
@@ -47,11 +48,12 @@ typedef struct PreMultiplyContext {
#define OFFSET(x) offsetof(PreMultiplyContext, x)
#define OFFSET(x) offsetof(PreMultiplyContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
premultiply_
options
[]
=
{
static
const
AVOption
options
[]
=
{
{
"planes"
,
"set planes"
,
OFFSET
(
planes
),
AV_OPT_TYPE_INT
,
{.
i64
=
0xF
},
0
,
0xF
,
FLAGS
},
{
"planes"
,
"set planes"
,
OFFSET
(
planes
),
AV_OPT_TYPE_INT
,
{.
i64
=
0xF
},
0
,
0xF
,
FLAGS
},
{
NULL
}
{
NULL
}
};
};
#define premultiply_options options
AVFILTER_DEFINE_CLASS
(
premultiply
);
AVFILTER_DEFINE_CLASS
(
premultiply
);
static
int
query_formats
(
AVFilterContext
*
ctx
)
static
int
query_formats
(
AVFilterContext
*
ctx
)
...
@@ -199,6 +201,153 @@ static void premultiply16offset(const uint8_t *mmsrc, const uint8_t *aasrc,
...
@@ -199,6 +201,153 @@ static void premultiply16offset(const uint8_t *mmsrc, const uint8_t *aasrc,
}
}
}
}
static
void
unpremultiply8
(
const
uint8_t
*
msrc
,
const
uint8_t
*
asrc
,
uint8_t
*
dst
,
ptrdiff_t
mlinesize
,
ptrdiff_t
alinesize
,
ptrdiff_t
dlinesize
,
int
w
,
int
h
,
int
half
,
int
max
,
int
offset
)
{
int
x
,
y
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
if
(
asrc
[
x
]
>
0
&&
asrc
[
x
]
<
255
)
dst
[
x
]
=
FFMIN
(
msrc
[
x
]
*
255
/
asrc
[
x
],
255
);
else
dst
[
x
]
=
msrc
[
x
];
}
dst
+=
dlinesize
;
msrc
+=
mlinesize
;
asrc
+=
alinesize
;
}
}
static
void
unpremultiply8yuv
(
const
uint8_t
*
msrc
,
const
uint8_t
*
asrc
,
uint8_t
*
dst
,
ptrdiff_t
mlinesize
,
ptrdiff_t
alinesize
,
ptrdiff_t
dlinesize
,
int
w
,
int
h
,
int
half
,
int
max
,
int
offset
)
{
int
x
,
y
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
if
(
asrc
[
x
]
>
0
&&
asrc
[
x
]
<
255
)
dst
[
x
]
=
FFMIN
((
msrc
[
x
]
-
128
)
*
255
/
asrc
[
x
]
+
128
,
255
);
else
dst
[
x
]
=
msrc
[
x
];
}
dst
+=
dlinesize
;
msrc
+=
mlinesize
;
asrc
+=
alinesize
;
}
}
static
void
unpremultiply8offset
(
const
uint8_t
*
msrc
,
const
uint8_t
*
asrc
,
uint8_t
*
dst
,
ptrdiff_t
mlinesize
,
ptrdiff_t
alinesize
,
ptrdiff_t
dlinesize
,
int
w
,
int
h
,
int
half
,
int
max
,
int
offset
)
{
int
x
,
y
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
if
(
asrc
[
x
]
>
0
&&
asrc
[
x
]
<
255
)
dst
[
x
]
=
FFMIN
((
msrc
[
x
]
-
offset
)
*
255
/
asrc
[
x
]
+
offset
,
255
);
else
dst
[
x
]
=
msrc
[
x
];
}
dst
+=
dlinesize
;
msrc
+=
mlinesize
;
asrc
+=
alinesize
;
}
}
static
void
unpremultiply16
(
const
uint8_t
*
mmsrc
,
const
uint8_t
*
aasrc
,
uint8_t
*
ddst
,
ptrdiff_t
mlinesize
,
ptrdiff_t
alinesize
,
ptrdiff_t
dlinesize
,
int
w
,
int
h
,
int
half
,
int
max
,
int
offset
)
{
const
uint16_t
*
msrc
=
(
const
uint16_t
*
)
mmsrc
;
const
uint16_t
*
asrc
=
(
const
uint16_t
*
)
aasrc
;
uint16_t
*
dst
=
(
uint16_t
*
)
ddst
;
int
x
,
y
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
if
(
asrc
[
x
]
>
0
&&
asrc
[
x
]
<
max
)
dst
[
x
]
=
FFMIN
(
msrc
[
x
]
*
(
unsigned
)
max
/
asrc
[
x
],
max
);
else
dst
[
x
]
=
msrc
[
x
];
}
dst
+=
dlinesize
/
2
;
msrc
+=
mlinesize
/
2
;
asrc
+=
alinesize
/
2
;
}
}
static
void
unpremultiply16yuv
(
const
uint8_t
*
mmsrc
,
const
uint8_t
*
aasrc
,
uint8_t
*
ddst
,
ptrdiff_t
mlinesize
,
ptrdiff_t
alinesize
,
ptrdiff_t
dlinesize
,
int
w
,
int
h
,
int
half
,
int
max
,
int
offset
)
{
const
uint16_t
*
msrc
=
(
const
uint16_t
*
)
mmsrc
;
const
uint16_t
*
asrc
=
(
const
uint16_t
*
)
aasrc
;
uint16_t
*
dst
=
(
uint16_t
*
)
ddst
;
int
x
,
y
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
if
(
asrc
[
x
]
>
0
&&
asrc
[
x
]
<
max
)
dst
[
x
]
=
FFMAX
(
FFMIN
((
msrc
[
x
]
-
half
)
*
max
/
asrc
[
x
],
half
-
1
),
-
half
)
+
half
;
else
dst
[
x
]
=
msrc
[
x
];
}
dst
+=
dlinesize
/
2
;
msrc
+=
mlinesize
/
2
;
asrc
+=
alinesize
/
2
;
}
}
static
void
unpremultiply16offset
(
const
uint8_t
*
mmsrc
,
const
uint8_t
*
aasrc
,
uint8_t
*
ddst
,
ptrdiff_t
mlinesize
,
ptrdiff_t
alinesize
,
ptrdiff_t
dlinesize
,
int
w
,
int
h
,
int
half
,
int
max
,
int
offset
)
{
const
uint16_t
*
msrc
=
(
const
uint16_t
*
)
mmsrc
;
const
uint16_t
*
asrc
=
(
const
uint16_t
*
)
aasrc
;
uint16_t
*
dst
=
(
uint16_t
*
)
ddst
;
int
x
,
y
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
if
(
asrc
[
x
]
>
0
&&
asrc
[
x
]
<
max
)
dst
[
x
]
=
FFMAX
(
FFMIN
((
msrc
[
x
]
-
offset
)
*
(
unsigned
)
max
/
asrc
[
x
]
+
offset
,
max
),
0
);
else
dst
[
x
]
=
msrc
[
x
];
}
dst
+=
dlinesize
/
2
;
msrc
+=
mlinesize
/
2
;
asrc
+=
alinesize
/
2
;
}
}
static
int
process_frame
(
FFFrameSync
*
fs
)
static
int
process_frame
(
FFFrameSync
*
fs
)
{
{
AVFilterContext
*
ctx
=
fs
->
parent
;
AVFilterContext
*
ctx
=
fs
->
parent
;
...
@@ -226,48 +375,80 @@ static int process_frame(FFFrameSync *fs)
...
@@ -226,48 +375,80 @@ static int process_frame(FFFrameSync *fs)
full
=
base
->
color_range
==
AVCOL_RANGE_JPEG
;
full
=
base
->
color_range
==
AVCOL_RANGE_JPEG
;
limited
=
base
->
color_range
==
AVCOL_RANGE_MPEG
;
limited
=
base
->
color_range
==
AVCOL_RANGE_MPEG
;
switch
(
outlink
->
format
)
{
if
(
s
->
inverse
)
{
case
AV_PIX_FMT_YUV444P
:
switch
(
outlink
->
format
)
{
s
->
premultiply
[
0
]
=
full
?
premultiply8
:
premultiply8offset
;
case
AV_PIX_FMT_YUV444P
:
s
->
premultiply
[
1
]
=
premultiply8yuv
;
s
->
premultiply
[
0
]
=
full
?
unpremultiply8
:
unpremultiply8offset
;
s
->
premultiply
[
2
]
=
premultiply8yuv
;
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
unpremultiply8yuv
;
break
;
break
;
case
AV_PIX_FMT_YUVJ444P
:
case
AV_PIX_FMT_YUVJ444P
:
s
->
premultiply
[
0
]
=
premultiply8
;
s
->
premultiply
[
0
]
=
unpremultiply8
;
s
->
premultiply
[
1
]
=
premultiply8yuv
;
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
unpremultiply8yuv
;
s
->
premultiply
[
2
]
=
premultiply8yuv
;
break
;
break
;
case
AV_PIX_FMT_GBRP
:
case
AV_PIX_FMT_GBRP
:
s
->
premultiply
[
0
]
=
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
limited
?
unpremultiply8offset
:
unpremultiply8
;
s
->
premultiply
[
0
]
=
limited
?
premultiply8offset
:
premultiply8
;
break
;
s
->
premultiply
[
1
]
=
limited
?
premultiply8offset
:
premultiply8
;
case
AV_PIX_FMT_YUV444P9
:
s
->
premultiply
[
2
]
=
limited
?
premultiply8offset
:
premultiply8
;
case
AV_PIX_FMT_YUV444P10
:
break
;
case
AV_PIX_FMT_YUV444P12
:
case
AV_PIX_FMT_YUV444P9
:
case
AV_PIX_FMT_YUV444P14
:
case
AV_PIX_FMT_YUV444P10
:
case
AV_PIX_FMT_YUV444P16
:
case
AV_PIX_FMT_YUV444P12
:
s
->
premultiply
[
0
]
=
full
?
unpremultiply16
:
unpremultiply16offset
;
case
AV_PIX_FMT_YUV444P14
:
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
unpremultiply16yuv
;
case
AV_PIX_FMT_YUV444P16
:
break
;
s
->
premultiply
[
0
]
=
full
?
premultiply16
:
premultiply16offset
;
case
AV_PIX_FMT_GBRP9
:
s
->
premultiply
[
1
]
=
premultiply16yuv
;
case
AV_PIX_FMT_GBRP10
:
s
->
premultiply
[
2
]
=
premultiply16yuv
;
case
AV_PIX_FMT_GBRP12
:
break
;
case
AV_PIX_FMT_GBRP14
:
case
AV_PIX_FMT_GBRP9
:
case
AV_PIX_FMT_GBRP16
:
case
AV_PIX_FMT_GBRP10
:
s
->
premultiply
[
0
]
=
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
limited
?
unpremultiply16offset
:
unpremultiply16
;
case
AV_PIX_FMT_GBRP12
:
break
;
case
AV_PIX_FMT_GBRP14
:
case
AV_PIX_FMT_GRAY8
:
case
AV_PIX_FMT_GBRP16
:
s
->
premultiply
[
0
]
=
limited
?
unpremultiply8offset
:
unpremultiply8
;
s
->
premultiply
[
0
]
=
limited
?
premultiply16offset
:
premultiply16
;
break
;
s
->
premultiply
[
1
]
=
limited
?
premultiply16offset
:
premultiply16
;
case
AV_PIX_FMT_GRAY10
:
s
->
premultiply
[
2
]
=
limited
?
premultiply16offset
:
premultiply16
;
case
AV_PIX_FMT_GRAY12
:
break
;
case
AV_PIX_FMT_GRAY16
:
case
AV_PIX_FMT_GRAY8
:
s
->
premultiply
[
0
]
=
limited
?
unpremultiply16offset
:
unpremultiply16
;
s
->
premultiply
[
0
]
=
limited
?
premultiply8offset
:
premultiply8
;
break
;
break
;
}
case
AV_PIX_FMT_GRAY10
:
}
else
{
case
AV_PIX_FMT_GRAY12
:
switch
(
outlink
->
format
)
{
case
AV_PIX_FMT_GRAY16
:
case
AV_PIX_FMT_YUV444P
:
s
->
premultiply
[
0
]
=
limited
?
premultiply16offset
:
premultiply16
;
s
->
premultiply
[
0
]
=
full
?
premultiply8
:
premultiply8offset
;
break
;
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
premultiply8yuv
;
break
;
case
AV_PIX_FMT_YUVJ444P
:
s
->
premultiply
[
0
]
=
premultiply8
;
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
premultiply8yuv
;
break
;
case
AV_PIX_FMT_GBRP
:
s
->
premultiply
[
0
]
=
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
limited
?
premultiply8offset
:
premultiply8
;
break
;
case
AV_PIX_FMT_YUV444P9
:
case
AV_PIX_FMT_YUV444P10
:
case
AV_PIX_FMT_YUV444P12
:
case
AV_PIX_FMT_YUV444P14
:
case
AV_PIX_FMT_YUV444P16
:
s
->
premultiply
[
0
]
=
full
?
premultiply16
:
premultiply16offset
;
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
premultiply16yuv
;
break
;
case
AV_PIX_FMT_GBRP9
:
case
AV_PIX_FMT_GBRP10
:
case
AV_PIX_FMT_GBRP12
:
case
AV_PIX_FMT_GBRP14
:
case
AV_PIX_FMT_GBRP16
:
s
->
premultiply
[
0
]
=
s
->
premultiply
[
1
]
=
s
->
premultiply
[
2
]
=
limited
?
premultiply16offset
:
premultiply16
;
break
;
case
AV_PIX_FMT_GRAY8
:
s
->
premultiply
[
0
]
=
limited
?
premultiply8offset
:
premultiply8
;
break
;
case
AV_PIX_FMT_GRAY10
:
case
AV_PIX_FMT_GRAY12
:
case
AV_PIX_FMT_GRAY16
:
s
->
premultiply
[
0
]
=
limited
?
premultiply16offset
:
premultiply16
;
break
;
}
}
}
for
(
p
=
0
;
p
<
s
->
nb_planes
;
p
++
)
{
for
(
p
=
0
;
p
<
s
->
nb_planes
;
p
++
)
{
...
@@ -282,7 +463,7 @@ static int process_frame(FFFrameSync *fs)
...
@@ -282,7 +463,7 @@ static int process_frame(FFFrameSync *fs)
base
->
linesize
[
p
],
alpha
->
linesize
[
0
],
base
->
linesize
[
p
],
alpha
->
linesize
[
0
],
out
->
linesize
[
p
],
out
->
linesize
[
p
],
s
->
width
[
p
],
s
->
height
[
p
],
s
->
width
[
p
],
s
->
height
[
p
],
s
->
half
,
s
->
depth
,
s
->
offset
);
s
->
half
,
s
->
inverse
?
s
->
max
:
s
->
depth
,
s
->
offset
);
}
}
}
}
out
->
pts
=
av_rescale_q
(
base
->
pts
,
s
->
fs
.
time_base
,
outlink
->
time_base
);
out
->
pts
=
av_rescale_q
(
base
->
pts
,
s
->
fs
.
time_base
,
outlink
->
time_base
);
...
@@ -310,6 +491,7 @@ static int config_input(AVFilterLink *inlink)
...
@@ -310,6 +491,7 @@ static int config_input(AVFilterLink *inlink)
s
->
width
[
0
]
=
s
->
width
[
3
]
=
inlink
->
w
;
s
->
width
[
0
]
=
s
->
width
[
3
]
=
inlink
->
w
;
s
->
depth
=
desc
->
comp
[
0
].
depth
;
s
->
depth
=
desc
->
comp
[
0
].
depth
;
s
->
max
=
(
1
<<
s
->
depth
)
-
1
;
s
->
half
=
(
1
<<
s
->
depth
)
/
2
;
s
->
half
=
(
1
<<
s
->
depth
)
/
2
;
s
->
offset
=
16
<<
(
s
->
depth
-
8
);
s
->
offset
=
16
<<
(
s
->
depth
-
8
);
...
@@ -369,6 +551,16 @@ static int activate(AVFilterContext *ctx)
...
@@ -369,6 +551,16 @@ static int activate(AVFilterContext *ctx)
return
ff_framesync2_activate
(
&
s
->
fs
);
return
ff_framesync2_activate
(
&
s
->
fs
);
}
}
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
PreMultiplyContext
*
s
=
ctx
->
priv
;
if
(
!
strcmp
(
ctx
->
filter
->
name
,
"unpremultiply"
))
s
->
inverse
=
1
;
return
0
;
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
{
PreMultiplyContext
*
s
=
ctx
->
priv
;
PreMultiplyContext
*
s
=
ctx
->
priv
;
...
@@ -398,6 +590,8 @@ static const AVFilterPad premultiply_outputs[] = {
...
@@ -398,6 +590,8 @@ static const AVFilterPad premultiply_outputs[] = {
{
NULL
}
{
NULL
}
};
};
#if CONFIG_PREMULTIPLY_FILTER
AVFilter
ff_vf_premultiply
=
{
AVFilter
ff_vf_premultiply
=
{
.
name
=
"premultiply"
,
.
name
=
"premultiply"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"PreMultiply first stream with first plane of second stream."
),
.
description
=
NULL_IF_CONFIG_SMALL
(
"PreMultiply first stream with first plane of second stream."
),
...
@@ -410,3 +604,26 @@ AVFilter ff_vf_premultiply = {
...
@@ -410,3 +604,26 @@ AVFilter ff_vf_premultiply = {
.
priv_class
=
&
premultiply_class
,
.
priv_class
=
&
premultiply_class
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
,
};
};
#endif
/* CONFIG_PREMULTIPLY_FILTER */
#if CONFIG_UNPREMULTIPLY_FILTER
#define unpremultiply_options options
AVFILTER_DEFINE_CLASS
(
unpremultiply
);
AVFilter
ff_vf_unpremultiply
=
{
.
name
=
"unpremultiply"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"UnPreMultiply first stream with first plane of second stream."
),
.
priv_size
=
sizeof
(
PreMultiplyContext
),
.
init
=
init
,
.
uninit
=
uninit
,
.
query_formats
=
query_formats
,
.
activate
=
activate
,
.
inputs
=
premultiply_inputs
,
.
outputs
=
premultiply_outputs
,
.
priv_class
=
&
unpremultiply_class
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
,
};
#endif
/* CONFIG_UNPREMULTIPLY_FILTER */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录