mirror of https://git.ffmpeg.org/ffmpeg.git
rational: test add/sub too
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
841bf0ef24
commit
6204ea17f1
|
@ -148,7 +148,7 @@ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list)
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
AVRational a,b;
|
AVRational a,b,r;
|
||||||
for (a.num = -2; a.num <= 2; a.num++) {
|
for (a.num = -2; a.num <= 2; a.num++) {
|
||||||
for (a.den = -2; a.den <= 2; a.den++) {
|
for (a.den = -2; a.den <= 2; a.den++) {
|
||||||
for (b.num = -2; b.num <= 2; b.num++) {
|
for (b.num = -2; b.num <= 2; b.num++) {
|
||||||
|
@ -162,6 +162,9 @@ int main(void)
|
||||||
if (c != d)
|
if (c != d)
|
||||||
av_log(0, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num,
|
av_log(0, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num,
|
||||||
a.den, b.num, b.den, c,d);
|
a.den, b.num, b.den, c,d);
|
||||||
|
r = av_sub_q(av_add_q(b,a), b);
|
||||||
|
if(b.den && (r.num*a.den != a.num*r.den || !r.num != !a.num || !r.den != !a.den))
|
||||||
|
av_log(0, AV_LOG_ERROR, "%d/%d ", r.num, r.den);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue