Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
97b8db33
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,发现更多精彩内容 >>
提交
97b8db33
编写于
12月 01, 2015
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avutil/rational: Test av_rescale_rnd() with combinations of "special" values
Signed-off-by:
N
Michael Niedermayer
<
michael@niedermayer.cc
>
上级
f03c2cee
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
45 addition
and
0 deletion
+45
-0
libavutil/Makefile
libavutil/Makefile
+1
-0
libavutil/rational.c
libavutil/rational.c
+44
-0
未找到文件。
libavutil/Makefile
浏览文件 @
97b8db33
...
...
@@ -106,6 +106,7 @@ OBJS = adler32.o \
hash.o
\
hmac.o
\
imgutils.o
\
integer.o
\
intmath.o
\
lfg.o
\
lls.o
\
...
...
libavutil/rational.c
浏览文件 @
97b8db33
...
...
@@ -183,9 +183,18 @@ uint32_t av_q2intfloat(AVRational q) {
}
#ifdef TEST
#include "integer.h"
int
main
(
void
)
{
AVRational
a
,
b
,
r
;
int
i
,
j
,
k
;
static
const
int64_t
numlist
[]
=
{
INT64_MIN
,
INT64_MIN
+
1
,
INT64_MAX
,
INT32_MIN
,
INT32_MAX
,
1
,
0
,
-
1
,
123456789
,
INT32_MAX
-
1
,
INT32_MAX
+
1LL
,
UINT32_MAX
-
1
,
UINT32_MAX
,
UINT32_MAX
+
1LL
};
for
(
a
.
num
=
-
2
;
a
.
num
<=
2
;
a
.
num
++
)
{
for
(
a
.
den
=
-
2
;
a
.
den
<=
2
;
a
.
den
++
)
{
for
(
b
.
num
=
-
2
;
b
.
num
<=
2
;
b
.
num
++
)
{
...
...
@@ -207,6 +216,41 @@ int main(void)
}
}
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
numlist
);
i
++
)
{
int64_t
a
=
numlist
[
i
];
for
(
j
=
0
;
j
<
FF_ARRAY_ELEMS
(
numlist
);
j
++
)
{
int64_t
b
=
numlist
[
j
];
if
(
b
<=
0
)
continue
;
for
(
k
=
0
;
k
<
FF_ARRAY_ELEMS
(
numlist
);
k
++
)
{
int64_t
c
=
numlist
[
k
];
int64_t
res
;
AVInteger
ai
;
if
(
c
<=
0
)
continue
;
res
=
av_rescale_rnd
(
a
,
b
,
c
,
AV_ROUND_ZERO
);
ai
=
av_mul_i
(
av_int2i
(
a
),
av_int2i
(
b
));
ai
=
av_div_i
(
ai
,
av_int2i
(
c
));
if
(
av_cmp_i
(
ai
,
av_int2i
(
INT64_MAX
))
>
0
&&
res
==
INT64_MIN
)
continue
;
if
(
av_cmp_i
(
ai
,
av_int2i
(
INT64_MIN
))
<
0
&&
res
==
INT64_MIN
)
continue
;
if
(
av_cmp_i
(
ai
,
av_int2i
(
res
))
==
0
)
continue
;
// Special exception for INT64_MIN, remove this in case INT64_MIN is handled without off by 1 error
if
(
av_cmp_i
(
ai
,
av_int2i
(
res
-
1
))
==
0
&&
a
==
INT64_MIN
)
continue
;
av_log
(
NULL
,
AV_LOG_ERROR
,
"%"
PRId64
" * %"
PRId64
" / %"
PRId64
" = %"
PRId64
" or %"
PRId64
"
\n
"
,
a
,
b
,
c
,
res
,
av_i2int
(
ai
));
}
}
}
for
(
a
.
num
=
1
;
a
.
num
<=
10
;
a
.
num
++
)
{
for
(
a
.
den
=
1
;
a
.
den
<=
10
;
a
.
den
++
)
{
if
(
av_gcd
(
a
.
num
,
a
.
den
)
>
1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录