Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
0cef06df
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,发现更多精彩内容 >>
提交
0cef06df
编写于
7月 31, 2015
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
checkasm: add HEVC MC tests
上级
a853388d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
325 addition
and
0 deletion
+325
-0
tests/checkasm/Makefile
tests/checkasm/Makefile
+1
-0
tests/checkasm/checkasm.c
tests/checkasm/checkasm.c
+3
-0
tests/checkasm/checkasm.h
tests/checkasm/checkasm.h
+1
-0
tests/checkasm/hevc_mc.c
tests/checkasm/hevc_mc.c
+320
-0
未找到文件。
tests/checkasm/Makefile
浏览文件 @
0cef06df
...
...
@@ -2,6 +2,7 @@
AVCODECOBJS-$(CONFIG_BSWAPDSP)
+=
bswapdsp.o
AVCODECOBJS-$(CONFIG_H264PRED)
+=
h264pred.o
AVCODECOBJS-$(CONFIG_H264QPEL)
+=
h264qpel.o
AVCODECOBJS-$(CONFIG_HEVC_DECODER)
+=
hevc_mc.o
AVCODECOBJS-$(CONFIG_V210_ENCODER)
+=
v210enc.o
CHECKASMOBJS-$(CONFIG_AVCODEC)
+=
$
(
AVCODECOBJS-yes
)
...
...
tests/checkasm/checkasm.c
浏览文件 @
0cef06df
...
...
@@ -66,6 +66,9 @@ static const struct {
#if CONFIG_H264QPEL
{
"h264qpel"
,
checkasm_check_h264qpel
},
#endif
#if CONFIG_HEVC_DECODER
{
"hevc_mc"
,
checkasm_check_hevc_mc
},
#endif
#if CONFIG_V210_ENCODER
{
"v210enc"
,
checkasm_check_v210enc
},
#endif
...
...
tests/checkasm/checkasm.h
浏览文件 @
0cef06df
...
...
@@ -32,6 +32,7 @@
void
checkasm_check_bswapdsp
(
void
);
void
checkasm_check_h264pred
(
void
);
void
checkasm_check_h264qpel
(
void
);
void
checkasm_check_hevc_mc
(
void
);
void
checkasm_check_v210enc
(
void
);
void
*
checkasm_check_func
(
void
*
func
,
const
char
*
name
,
...)
av_printf_format
(
2
,
3
);
...
...
tests/checkasm/hevc_mc.c
0 → 100644
浏览文件 @
0cef06df
/*
* Copyright (c) 2015 Anton Khirnov
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Libav 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with Libav; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string.h>
#include "checkasm.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/hevcdsp.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
// max PU size + interpolation stencil
#define BUF_SIZE (FFALIGN(64 + 7, 16) * (64 + 7) * 2)
#define PIXEL_SIZE(depth) ((depth + 7) / 8)
#define randomize_buffers(buf, size, depth) \
do { \
uint32_t mask = pixel_mask[depth - 8]; \
int i; \
for (i = 0; i < size; i += 4) { \
uint32_t r = rnd() & mask; \
AV_WN32A(buf + i, r); \
} \
} while (0)
static
const
uint32_t
pixel_mask
[
3
]
=
{
0xffffffff
,
0x01ff01ff
,
0x03ff03ff
};
static
const
int
pred_heights
[][
7
]
=
{
[
2
]
=
{
8
,
4
,
2
,
0
},
[
4
]
=
{
16
,
8
,
4
,
2
,
0
},
[
6
]
=
{
8
,
0
},
[
8
]
=
{
32
,
16
,
8
,
4
,
2
,
0
},
[
12
]
=
{
16
,
0
},
[
16
]
=
{
64
,
32
,
16
,
12
,
8
,
4
,
0
},
[
24
]
=
{
32
,
0
},
[
32
]
=
{
64
,
32
,
24
,
16
,
8
,
0
},
[
48
]
=
{
64
,
0
},
[
64
]
=
{
64
,
48
,
32
,
16
,
0
},
};
static
const
int
pred_widths
[]
=
{
4
,
8
,
12
,
16
,
24
,
32
,
48
,
64
};
static
const
char
*
interp_names
[
2
][
2
]
=
{
{
"pixels"
,
"h"
},
{
"v"
,
"hv"
}
};
#define UNWEIGHTED_PRED(dst0, dst1, src0, width, bit_depth) \
do { \
int i; \
for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \
int height = pred_heights[width][i]; \
if (!height) \
break; \
call_ref(dst0, dststride, src0, srcstride, height); \
call_new(dst1, dststride, src0, srcstride, height); \
if (memcmp(dst0, dst1, dststride * height)) \
fail(); \
bench_new(dst1, dststride, src0, srcstride, height); \
} \
} while (0)
#define UNWEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth) \
do { \
int i; \
for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \
int height = pred_heights[width][i]; \
if (!height) \
break; \
call_ref(dst0, dststride, src0, src1, srcstride, height); \
call_new(dst1, dststride, src0, src1, srcstride, height); \
if (memcmp(dst0, dst1, dststride * height)) \
fail(); \
bench_new(dst1, dststride, src0, src1, srcstride, height); \
} \
} while (0)
static
void
check_unweighted_pred
(
HEVCDSPContext
*
h
,
uint8_t
*
dst0
,
uint8_t
*
dst1
,
int16_t
*
src0
,
int16_t
*
src1
,
int
bit_depth
)
{
int
i
;
randomize_buffers
(
src0
,
BUF_SIZE
,
8
);
randomize_buffers
(
src1
,
BUF_SIZE
,
8
);
memset
(
dst0
,
0
,
BUF_SIZE
*
sizeof
(
*
dst0
));
memset
(
dst1
,
0
,
BUF_SIZE
*
sizeof
(
*
dst1
));
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
pred_widths
);
i
++
)
{
const
int
width
=
pred_widths
[
i
];
const
int
srcstride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
src0
);
const
int
dststride
=
FFALIGN
(
width
,
16
)
*
PIXEL_SIZE
(
bit_depth
);
{
declare_func
(
void
,
uint8_t
*
dst
,
ptrdiff_t
dststride
,
int16_t
*
src
,
ptrdiff_t
srcstride
,
int
height
);
if
(
check_func
(
h
->
put_unweighted_pred
[
i
],
"put_unweighted_pred_%d_%d"
,
width
,
bit_depth
))
UNWEIGHTED_PRED
(
dst0
,
dst1
,
src0
,
width
,
bit_depth
);
if
(
check_func
(
h
->
put_unweighted_pred_chroma
[
i
],
"put_unweighted_pred_%d_%d"
,
width
/
2
,
bit_depth
))
UNWEIGHTED_PRED
(
dst0
,
dst1
,
src0
,
width
,
bit_depth
);
}
{
declare_func
(
void
,
uint8_t
*
dst
,
ptrdiff_t
dststride
,
int16_t
*
src0
,
int16_t
*
src1
,
ptrdiff_t
srcstride
,
int
height
);
if
(
check_func
(
h
->
put_unweighted_pred_avg
[
i
],
"put_unweighted_pred_avg_%d_%d"
,
width
,
bit_depth
))
UNWEIGHTED_PRED_AVG
(
dst0
,
dst1
,
src0
,
src1
,
width
,
bit_depth
);
if
(
check_func
(
h
->
put_unweighted_pred_avg_chroma
[
i
],
"put_unweighted_pred_avg_%d_%d"
,
width
/
2
,
bit_depth
))
UNWEIGHTED_PRED_AVG
(
dst0
,
dst1
,
src0
,
src1
,
width
,
bit_depth
);
}
}
}
#define WEIGHTED_PRED(dst0, dst1, src0, width, bit_depth) \
do { \
int i; \
for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \
int height = pred_heights[width][i]; \
if (!height) \
break; \
call_ref(denom, weight0, offset0, dst0, dststride, src0, srcstride, height); \
call_new(denom, weight0, offset0, dst1, dststride, src0, srcstride, height); \
if (memcmp(dst0, dst1, dststride * height)) \
fail(); \
bench_new(denom, weight0, offset0, dst1, dststride, src0, srcstride, height); \
} \
} while (0)
#define WEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth) \
do { \
int i; \
for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \
int height = pred_heights[width][i]; \
if (!height) \
break; \
call_ref(denom, weight0, weight1, offset0, offset1, dst0, dststride, src0, src1, srcstride, height); \
call_new(denom, weight0, weight1, offset0, offset1, dst1, dststride, src0, src1, srcstride, height); \
if (memcmp(dst0, dst1, dststride * height)) \
fail(); \
bench_new(denom, weight0, weight1, offset0, offset1, dst1, dststride, src0, src1, srcstride, height); \
} \
} while (0)
static
void
check_weighted_pred
(
HEVCDSPContext
*
h
,
uint8_t
*
dst0
,
uint8_t
*
dst1
,
int16_t
*
src0
,
int16_t
*
src1
,
int
bit_depth
)
{
uint8_t
denom
;
int16_t
weight0
,
weight1
,
offset0
,
offset1
;
int
i
;
randomize_buffers
(
src0
,
BUF_SIZE
,
8
);
randomize_buffers
(
src1
,
BUF_SIZE
,
8
);
denom
=
rnd
()
&
7
;
weight0
=
denom
+
((
rnd
()
&
255
)
-
128
);
weight1
=
denom
+
((
rnd
()
&
255
)
-
128
);
offset0
=
(
rnd
()
&
255
)
-
128
;
offset1
=
(
rnd
()
&
255
)
-
128
;
memset
(
dst0
,
0
,
BUF_SIZE
*
sizeof
(
*
dst0
));
memset
(
dst1
,
0
,
BUF_SIZE
*
sizeof
(
*
dst1
));
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
pred_widths
);
i
++
)
{
const
int
width
=
pred_widths
[
i
];
const
int
srcstride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
src0
);
const
int
dststride
=
FFALIGN
(
width
,
16
)
*
PIXEL_SIZE
(
bit_depth
);
{
declare_func
(
void
,
uint8_t
denom
,
int16_t
weight
,
int16_t
offset
,
uint8_t
*
dst
,
ptrdiff_t
dststride
,
int16_t
*
src
,
ptrdiff_t
srcstride
,
int
height
);
if
(
check_func
(
h
->
weighted_pred
[
i
],
"weighted_pred_%d_%d"
,
width
,
bit_depth
))
WEIGHTED_PRED
(
dst0
,
dst1
,
src0
,
width
,
bit_depth
);
if
(
check_func
(
h
->
weighted_pred_chroma
[
i
],
"weighted_pred_%d_%d"
,
width
/
2
,
bit_depth
))
WEIGHTED_PRED
(
dst0
,
dst1
,
src0
,
width
,
bit_depth
);
}
{
declare_func
(
void
,
uint8_t
denom
,
int16_t
weight0
,
int16_t
weight1
,
int16_t
offset0
,
int16_t
offset1
,
uint8_t
*
dst
,
ptrdiff_t
dststride
,
int16_t
*
src0
,
int16_t
*
src1
,
ptrdiff_t
srcstride
,
int
height
);
if
(
check_func
(
h
->
weighted_pred_avg
[
i
],
"weighted_pred_avg_%d_%d"
,
width
,
bit_depth
))
WEIGHTED_PRED_AVG
(
dst0
,
dst1
,
src0
,
src1
,
width
,
bit_depth
);
if
(
check_func
(
h
->
weighted_pred_avg_chroma
[
i
],
"weighted_pred_avg_%d_%d"
,
width
/
2
,
bit_depth
))
WEIGHTED_PRED_AVG
(
dst0
,
dst1
,
src0
,
src1
,
width
,
bit_depth
);
}
}
}
static
void
check_epel
(
HEVCDSPContext
*
h
,
int16_t
*
dst0
,
int16_t
*
dst1
,
uint8_t
*
src
,
int16_t
*
mcbuffer
,
int
bit_depth
)
{
int
i
,
j
,
k
,
l
,
mx
,
my
;
declare_func
(
void
,
int16_t
*
dst
,
ptrdiff_t
dststride
,
uint8_t
*
src
,
ptrdiff_t
srcstride
,
int
height
,
int
mx
,
int
my
,
int16_t
*
mcbuffer
);
randomize_buffers
(
src
,
BUF_SIZE
,
bit_depth
);
memset
(
dst0
,
0
,
BUF_SIZE
*
sizeof
(
*
dst0
));
memset
(
dst1
,
0
,
BUF_SIZE
*
sizeof
(
*
dst1
));
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
k
=
0
;
k
<
FF_ARRAY_ELEMS
(
h
->
put_hevc_epel
[
i
][
j
]);
k
++
)
{
int
width
=
pred_widths
[
k
]
/
2
;
int
dststride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
dst0
);
int
srcstride
=
FFALIGN
(
width
+
3
,
8
)
*
PIXEL_SIZE
(
bit_depth
);
if
(
!
check_func
(
h
->
put_hevc_epel
[
i
][
j
][
k
],
"epel_%s_%d_%d"
,
interp_names
[
i
][
j
],
width
,
bit_depth
))
continue
;
for
(
l
=
0
;
l
<
FF_ARRAY_ELEMS
(
pred_heights
[
0
]);
l
++
)
{
int
height
=
pred_heights
[
width
][
l
];
if
(
!
height
)
continue
;
for
(
my
=
i
;
my
<
(
i
?
8
:
1
);
my
++
)
for
(
mx
=
j
;
mx
<
(
j
?
8
:
1
);
mx
++
)
{
call_ref
(
dst0
,
dststride
,
src
+
srcstride
+
PIXEL_SIZE
(
bit_depth
),
srcstride
,
height
,
mx
,
my
,
mcbuffer
);
call_new
(
dst1
,
dststride
,
src
+
srcstride
+
PIXEL_SIZE
(
bit_depth
),
srcstride
,
height
,
mx
,
my
,
mcbuffer
);
if
(
memcmp
(
dst0
,
dst1
,
dststride
*
height
*
sizeof
(
*
dst0
)))
fail
();
bench_new
(
dst1
,
dststride
,
src
+
srcstride
+
PIXEL_SIZE
(
bit_depth
),
srcstride
,
height
,
mx
,
my
,
mcbuffer
);
}
}
}
}
}
}
static
void
check_qpel
(
HEVCDSPContext
*
h
,
int16_t
*
dst0
,
int16_t
*
dst1
,
uint8_t
*
src
,
int16_t
*
mcbuffer
,
int
bit_depth
)
{
int
i
,
j
,
k
,
l
,
mx
,
my
;
declare_func
(
void
,
int16_t
*
dst
,
ptrdiff_t
dststride
,
uint8_t
*
src
,
ptrdiff_t
srcstride
,
int
height
,
int
mx
,
int
my
,
int16_t
*
mcbuffer
);
randomize_buffers
(
src
,
BUF_SIZE
,
bit_depth
);
memset
(
dst0
,
0
,
BUF_SIZE
*
sizeof
(
*
dst0
));
memset
(
dst1
,
0
,
BUF_SIZE
*
sizeof
(
*
dst1
));
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
k
=
0
;
k
<
FF_ARRAY_ELEMS
(
h
->
put_hevc_qpel
[
i
][
j
]);
k
++
)
{
int
width
=
pred_widths
[
k
];
int
dststride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
dst0
);
int
srcstride
=
FFALIGN
(
width
+
7
,
8
)
*
PIXEL_SIZE
(
bit_depth
);
if
(
!
check_func
(
h
->
put_hevc_qpel
[
i
][
j
][
k
],
"qpel_%s_%d_%d"
,
interp_names
[
i
][
j
],
width
,
bit_depth
))
continue
;
for
(
l
=
0
;
l
<
FF_ARRAY_ELEMS
(
pred_heights
[
0
]);
l
++
)
{
int
height
=
pred_heights
[
width
][
l
];
if
(
!
height
)
continue
;
for
(
my
=
i
;
my
<
(
i
?
2
:
1
);
my
++
)
for
(
mx
=
j
;
mx
<
(
j
?
2
:
1
);
mx
++
)
{
call_ref
(
dst0
,
dststride
,
src
+
3
*
srcstride
+
3
*
PIXEL_SIZE
(
bit_depth
),
srcstride
,
height
,
mx
,
my
,
mcbuffer
);
call_new
(
dst1
,
dststride
,
src
+
3
*
srcstride
+
3
*
PIXEL_SIZE
(
bit_depth
),
srcstride
,
height
,
mx
,
my
,
mcbuffer
);
if
(
memcmp
(
dst0
,
dst1
,
dststride
*
height
*
sizeof
(
*
dst0
)))
fail
();
bench_new
(
dst1
,
dststride
,
src
+
3
*
srcstride
+
3
*
PIXEL_SIZE
(
bit_depth
),
srcstride
,
height
,
mx
,
my
,
mcbuffer
);
}
}
}
}
}
}
void
checkasm_check_hevc_mc
(
void
)
{
DECLARE_ALIGNED
(
16
,
uint8_t
,
buf8_0
)[
BUF_SIZE
];
DECLARE_ALIGNED
(
16
,
uint8_t
,
buf8_1
)[
BUF_SIZE
];
DECLARE_ALIGNED
(
16
,
int16_t
,
buf16_0
)[
BUF_SIZE
];
DECLARE_ALIGNED
(
16
,
int16_t
,
buf16_1
)[
BUF_SIZE
];
DECLARE_ALIGNED
(
16
,
int16_t
,
mcbuffer
)[
BUF_SIZE
];
HEVCDSPContext
h
;
int
bit_depth
;
for
(
bit_depth
=
8
;
bit_depth
<=
10
;
bit_depth
++
)
{
ff_hevc_dsp_init
(
&
h
,
bit_depth
);
check_qpel
(
&
h
,
buf16_0
,
buf16_1
,
buf8_0
,
mcbuffer
,
bit_depth
);
report
(
"qpel"
);
check_epel
(
&
h
,
buf16_0
,
buf16_1
,
buf8_0
,
mcbuffer
,
bit_depth
);
report
(
"epel"
);
check_unweighted_pred
(
&
h
,
buf8_0
,
buf8_1
,
buf16_0
,
buf16_1
,
bit_depth
);
report
(
"unweighted_pred"
);
check_weighted_pred
(
&
h
,
buf8_0
,
buf8_1
,
buf16_0
,
buf16_1
,
bit_depth
);
report
(
"weighted_pred"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录