Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
fcc0424c
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,发现更多精彩内容 >>
提交
fcc0424c
编写于
1月 30, 2020
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter/vf_ssim: improve precision
Use doubles for accumulating floats.
上级
c35382aa
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
24 deletion
+37
-24
libavfilter/ssim.h
libavfilter/ssim.h
+1
-1
libavfilter/vf_ssim.c
libavfilter/vf_ssim.c
+10
-10
libavfilter/x86/vf_ssim.asm
libavfilter/x86/vf_ssim.asm
+25
-12
libavfilter/x86/vf_ssim_init.c
libavfilter/x86/vf_ssim_init.c
+1
-1
未找到文件。
libavfilter/ssim.h
浏览文件 @
fcc0424c
...
...
@@ -28,7 +28,7 @@ typedef struct SSIMDSPContext {
void
(
*
ssim_4x4_line
)(
const
uint8_t
*
buf
,
ptrdiff_t
buf_stride
,
const
uint8_t
*
ref
,
ptrdiff_t
ref_stride
,
int
(
*
sums
)[
4
],
int
w
);
float
(
*
ssim_end_line
)(
const
int
(
*
sum0
)[
4
],
const
int
(
*
sum1
)[
4
],
int
w
);
double
(
*
ssim_end_line
)(
const
int
(
*
sum0
)[
4
],
const
int
(
*
sum1
)[
4
],
int
w
);
}
SSIMDSPContext
;
void
ff_ssim_init_x86
(
SSIMDSPContext
*
dsp
);
...
...
libavfilter/vf_ssim.c
浏览文件 @
fcc0424c
...
...
@@ -55,13 +55,13 @@ typedef struct SSIMContext {
uint64_t
nb_frames
;
double
ssim
[
4
],
ssim_total
;
char
comps
[
4
];
float
coefs
[
4
];
double
coefs
[
4
];
uint8_t
rgba_map
[
4
];
int
planewidth
[
4
];
int
planeheight
[
4
];
int
*
temp
;
int
is_rgb
;
float
(
*
ssim_plane
)(
SSIMDSPContext
*
dsp
,
double
(
*
ssim_plane
)(
SSIMDSPContext
*
dsp
,
uint8_t
*
main
,
int
main_stride
,
uint8_t
*
ref
,
int
ref_stride
,
int
width
,
int
height
,
void
*
temp
,
...
...
@@ -206,9 +206,9 @@ static float ssim_endn_16bit(const int64_t (*sum0)[4], const int64_t (*sum1)[4],
return
ssim
;
}
static
float
ssim_endn_8bit
(
const
int
(
*
sum0
)[
4
],
const
int
(
*
sum1
)[
4
],
int
width
)
static
double
ssim_endn_8bit
(
const
int
(
*
sum0
)[
4
],
const
int
(
*
sum1
)[
4
],
int
width
)
{
float
ssim
=
0
.
0
;
double
ssim
=
0
.
0
;
int
i
;
for
(
i
=
0
;
i
<
width
;
i
++
)
...
...
@@ -221,14 +221,14 @@ static float ssim_endn_8bit(const int (*sum0)[4], const int (*sum1)[4], int widt
#define SUM_LEN(w) (((w) >> 2) + 3)
static
float
ssim_plane_16bit
(
SSIMDSPContext
*
dsp
,
static
double
ssim_plane_16bit
(
SSIMDSPContext
*
dsp
,
uint8_t
*
main
,
int
main_stride
,
uint8_t
*
ref
,
int
ref_stride
,
int
width
,
int
height
,
void
*
temp
,
int
max
)
{
int
z
=
0
,
y
;
float
ssim
=
0
.
0
;
double
ssim
=
0
.
0
;
int64_t
(
*
sum0
)[
4
]
=
temp
;
int64_t
(
*
sum1
)[
4
]
=
sum0
+
SUM_LEN
(
width
);
...
...
@@ -249,14 +249,14 @@ static float ssim_plane_16bit(SSIMDSPContext *dsp,
return
ssim
/
((
height
-
1
)
*
(
width
-
1
));
}
static
float
ssim_plane
(
SSIMDSPContext
*
dsp
,
static
double
ssim_plane
(
SSIMDSPContext
*
dsp
,
uint8_t
*
main
,
int
main_stride
,
uint8_t
*
ref
,
int
ref_stride
,
int
width
,
int
height
,
void
*
temp
,
int
max
)
{
int
z
=
0
,
y
;
float
ssim
=
0
.
0
;
double
ssim
=
0
.
0
;
int
(
*
sum0
)[
4
]
=
temp
;
int
(
*
sum1
)[
4
]
=
sum0
+
SUM_LEN
(
width
);
...
...
@@ -279,7 +279,7 @@ static float ssim_plane(SSIMDSPContext *dsp,
static
double
ssim_db
(
double
ssim
,
double
weight
)
{
return
10
*
log10
(
weight
/
(
weight
-
ssim
))
;
return
(
fabs
(
weight
-
ssim
)
>
1e-9
)
?
10
.
0
*
log10
(
weight
/
(
weight
-
ssim
))
:
INFINITY
;
}
static
int
do_ssim
(
FFFrameSync
*
fs
)
...
...
@@ -288,7 +288,7 @@ static int do_ssim(FFFrameSync *fs)
SSIMContext
*
s
=
ctx
->
priv
;
AVFrame
*
master
,
*
ref
;
AVDictionary
**
metadata
;
float
c
[
4
]
,
ssimv
=
0
.
0
;
double
c
[
4
]
=
{
0
}
,
ssimv
=
0
.
0
;
int
ret
,
i
;
ret
=
ff_framesync_dualinput_get
(
fs
,
&
master
,
&
ref
);
...
...
libavfilter/x86/vf_ssim.asm
浏览文件 @
fcc0424c
...
...
@@ -169,8 +169,9 @@ SSIM_4X4_LINE 8
%endif
INIT_XMM
ss
e4
cglobal
ss
im_end_line
,
3
,
3
,
6
,
sum0
,
sum1
,
w
cglobal
ss
im_end_line
,
3
,
3
,
7
,
sum0
,
sum1
,
w
pxor
m0
,
m0
pxor
m6
,
m6
.loop:
mova
m1
,
[
sum0q
+
mmsize
*
0
]
mova
m2
,
[
sum0q
+
mmsize
*
1
]
...
...
@@ -214,34 +215,46 @@ cglobal ssim_end_line, 3, 3, 6, sum0, sum1, w
mulps
m4
,
m5
mulps
m3
,
m1
divps
m4
,
m3
; ssim_endl
addps
m0
,
m4
; ssim
mova
m5
,
m4
cvtps2pd
m3
,
m5
movhlps
m5
,
m5
cvtps2pd
m5
,
m5
addpd
m0
,
m3
; ssim
addpd
m6
,
m5
; ssim
add
sum0q
,
mmsize
*
4
add
sum1q
,
mmsize
*
4
sub
wd
,
4
jg
.loop
; subp
s
the ones we added too much
; subp
d
the ones we added too much
test
wd
,
wd
jz
.end
add
wd
,
4
test
wd
,
3
jz
.skip3
test
wd
,
2
jz
.skip2
psrldq
m4
,
8
.skip2:
test
wd
,
1
jz
.skip1
psrldq
m4
,
4
.skip3:
psrldq
m5
,
8
subpd
m6
,
m5
jmp
.end
.skip2:
psrldq
m5
,
8
subpd
m6
,
m5
subpd
m0
,
m3
jmp
.end
.skip1:
subps
m0
,
m4
psrldq
m3
,
16
subpd
m6
,
m5
.end:
addpd
m0
,
m6
movhlps
m4
,
m0
addps
m0
,
m4
movss
m4
,
m0
shufps
m0
,
m0
,
1
addss
m0
,
m4
addpd
m0
,
m4
%if ARCH_X86_32
movs
s
r0m
,
m0
movs
d
r0m
,
m0
fld
r0mp
%endif
RET
libavfilter/x86/vf_ssim_init.c
浏览文件 @
fcc0424c
...
...
@@ -28,7 +28,7 @@ void ff_ssim_4x4_line_ssse3(const uint8_t *buf, ptrdiff_t buf_stride,
void
ff_ssim_4x4_line_xop
(
const
uint8_t
*
buf
,
ptrdiff_t
buf_stride
,
const
uint8_t
*
ref
,
ptrdiff_t
ref_stride
,
int
(
*
sums
)[
4
],
int
w
);
float
ff_ssim_end_line_sse4
(
const
int
(
*
sum0
)[
4
],
const
int
(
*
sum1
)[
4
],
int
w
);
double
ff_ssim_end_line_sse4
(
const
int
(
*
sum0
)[
4
],
const
int
(
*
sum1
)[
4
],
int
w
);
void
ff_ssim_init_x86
(
SSIMDSPContext
*
dsp
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录