Opened 4 years ago

Closed 4 years ago

#2713 closed defect (fixed)

av_d2q regression on sparc64 and ia64

Reported by: cehoyos Owned by:
Priority: important Component: avutil
Version: git-master Keywords: regression ia64 sparc64
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by cehoyos)

The parseutils fate test fails on sparc64 Linux and ia64 Linux since 64eacb8. The problem is not limited to parseutils, many fate tests fail because of an incorrect timebase.
The reason is that for some values of d and den - local variables in av_d2q() used when calling av_reduce() - (uint64_t)rint(d * den) and llrint(d * den) provide different results than (int64_t)(d * den + 0.5) which was used before.

$ make fate-parseutils
TEST    parseutils
--- ./tests/ref/fate/parseutils 2013-06-25 21:37:23.758635630 +0200
+++ tests/data/fate/parseutils  2013-06-25 21:40:36.629074659 +0200
@@ -6,7 +6,7 @@
 '-123 / 0' -> -1/0 ERROR
 '' -> 0/0 ERROR
 '/' -> 0/0 ERROR
-' 123  /  321' -> 41/107 OK
+' 123  /  321' -> 213623/557504 OK
 'foo/foo' -> 0/0 ERROR
 'foo/1' -> 0/0 ERROR
 '1/foo' -> 1/0 ERROR
@@ -17,13 +17,13 @@
 '0' -> 0/1 ERROR
 '-123/123' -> -1/1 ERROR
 '-foo' -> 0/0 ERROR
-'123.23' -> 12323/100 OK
-'.23' -> 23/100 OK
-'-.23' -> -23/100 ERROR
-'-0.234' -> -117/500 ERROR
+'123.23' -> 697112/5657 OK
+'.23' -> 209687/911683 OK
+'-.23' -> -209687/911683 ERROR
+'-0.234' -> -177357/757936 ERROR
 '-0.0000001' -> -1/10000000 ERROR
-'  21332.2324   ' -> 917286/43 OK
-' -21332.2324   ' -> -917286/43 ERROR
+'  21332.2324   ' -> 682631/32 OK
+' -21332.2324   ' -> -682631/32 ERROR

 Testing av_parse_color()
 bikeshed -> R(80) G(64) B(140) A(59)
Test parseutils failed. Look at tests/data/fate/parseutils.err for details.
make: *** [fate-parseutils] Error 1

Not reproducible on ppc64.

Attachments (1)

patchrational.diff (833 bytes) - added by cehoyos 4 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 4 years ago by cehoyos

Here is one example (of many) for an incorrect timebase in fate:

$ make SAMPLES=fate-suite fate-wnv1
TEST    wnv1
--- ./tests/ref/fate/wnv1       2013-06-24 14:18:26.000000000 +0200
+++ tests/data/fate/wnv1        2013-06-25 22:01:46.000000000 +0200
@@ -1,4 +1,4 @@
-#tb 0: 13333/200000
+#tb 0: 756994/11355193
 0,          0,          0,        1,    38400, 0x4c3fdc2f
 0,          1,          1,        1,    38400, 0x11c9d0cb
 0,          2,          2,        1,    38400, 0x6c37fd7f
Test wnv1 failed. Look at tests/data/fate/wnv1.err for details.
make: *** [fate-wnv1] Error 1

comment:2 Changed 4 years ago by cehoyos

  • Description modified (diff)

comment:3 Changed 4 years ago by michael

Please provide exact information which variables have which values, including a patch that shows how you printed them

comment:4 in reply to: ↑ description Changed 4 years ago by cehoyos

Replying to cehoyos:

The parseutils fate test fails on sparc64 Linux and ia64 Linux since 887d74c.

Sorry, it is actually a regression since 64eacb8.

comment:5 Changed 4 years ago by cehoyos

  • Description modified (diff)

Changed 4 years ago by cehoyos

comment:6 Changed 4 years ago by cehoyos

$ make fate-parseutils
TEST    parseutils
--- ./tests/ref/fate/parseutils 2013-07-04 03:21:28.208764283 +0200
+++ tests/data/fate/parseutils  2013-07-04 03:39:26.316158816 +0200
@@ -6,24 +6,46 @@
 '-123 / 0' -> -1/0 ERROR
 '' -> 0/0 ERROR
 '/' -> 0/0 ERROR
-' 123  /  321' -> 41/107 OK
+d: 0.383178, den: 2305843009213693952, d*den: 883547321287490176.000000, (int64_t)(d*den+0.5): 883547321287490176, rint(d*den): 883547321287490176.000000,
+(uint64_t)rint(d*den): 883547321287490176, (int64_t)rint(d*den):  883547205323373184, llrint(d*den): 883547205323373184
+' 123  /  321' -> 213623/557504 OK
 'foo/foo' -> 0/0 ERROR
 'foo/1' -> 0/0 ERROR
 '1/foo' -> 1/0 ERROR
 '0/0' -> 0/0 ERROR
 '/0' -> 0/0 ERROR
 '1/' -> 1/0 ERROR
+d: 1.000000, den: 2305843009213693952, d*den: 2305843009213693952.000000, (int64_t)(d*den+0.5): 2305843009213693952, rint(d*den): 2305843009213693952.000000,
+(uint64_t)rint(d*den): 2305843009213693952, (int64_t)rint(d*den):  2305843009213693952, llrint(d*den): 2305843009213693952
 '1' -> 1/1 OK
+d: 0.000000, den: 2305843009213693952, d*den: 0.000000, (int64_t)(d*den+0.5): 0, rint(d*den): 0.000000,
+(uint64_t)rint(d*den): 0, (int64_t)rint(d*den):  0, llrint(d*den): 0
 '0' -> 0/1 ERROR
+d: -1.000000, den: 2305843009213693952, d*den: -2305843009213693952.000000, (int64_t)(d*den+0.5): -2305843009213693952, rint(d*den): -2305843009213693952.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -2305843009213693952, llrint(d*den): -2305843009213693952
 '-123/123' -> -1/1 ERROR
 '-foo' -> 0/0 ERROR
-'123.23' -> 12323/100 OK
-'.23' -> 23/100 OK
-'-.23' -> -23/100 ERROR
-'-0.234' -> -117/500 ERROR
+d: 123.230000, den: 36028797018963968, d*den: 4439828656646929920.000000, (int64_t)(d*den+0.5): 4439828656646929920, rint(d*den): 4439828656646929920.000000,
+(uint64_t)rint(d*den): 4439828656646929920, (int64_t)rint(d*den):  4439827956567260672, llrint(d*den): 4439827956567260672
+'123.23' -> 697112/5657 OK
+d: 0.230000, den: 2305843009213693952, d*den: 530343892119149632.000000, (int64_t)(d*den+0.5): 530343892119149632, rint(d*den): 530343892119149632.000000,
+(uint64_t)rint(d*den): 530343892119149632, (int64_t)rint(d*den):  530343664485882944, llrint(d*den): 530343664485882944
+'.23' -> 209687/911683 OK
+d: -0.230000, den: 2305843009213693952, d*den: -530343892119149632.000000, (int64_t)(d*den+0.5): -530343892119149632, rint(d*den): -530343892119149632.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -530343664485882944, llrint(d*den): -530343664485882944
+'-.23' -> -209687/911683 ERROR
+d: -0.234000, den: 2305843009213693952, d*den: -539567264156004416.000000, (int64_t)(d*den+0.5): -539567264156004416, rint(d*den): -539567264156004416.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -539567191141560384, llrint(d*den): -539567191141560384
+'-0.234' -> -177357/757936 ERROR
+d: -0.000000, den: 2305843009213693952, d*den: -230584300921.369385, (int64_t)(d*den+0.5): -230584300920, rint(d*den): -230584300921.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -230584300921, llrint(d*den): -230584300921
 '-0.0000001' -> -1/10000000 ERROR
-'  21332.2324   ' -> 917286/43 OK
-' -21332.2324   ' -> -917286/43 ERROR
+d: 21332.232400, den: 140737488355328, d*den: 3002244808988150784.000000, (int64_t)(d*den+0.5): 3002244808988150784, rint(d*den): 3002244808988150784.000000,
+(uint64_t)rint(d*den): 3002244808988150784, (int64_t)rint(d*den):  3002242889137769472, llrint(d*den): 3002242889137769472
+'  21332.2324   ' -> 682631/32 OK
+d: -21332.232400, den: 140737488355328, d*den: -3002244808988150784.000000, (int64_t)(d*den+0.5): -3002244808988150784, rint(d*den): -3002244808988150784.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -3002242889137769472, llrint(d*den): -3002242889137769472
+' -21332.2324   ' -> -682631/32 ERROR

 Testing av_parse_color()
 bikeshed -> R(80) G(64) B(140) A(59)
Test parseutils failed. Look at tests/data/fate/parseutils.err for details.
make: *** [fate-parseutils] Error 1

comment:7 follow-up: Changed 4 years ago by michael

This looks like a compiler bug or a bug in libc
which versions of these are used ?

Also please test nearbyint(), round(), floor(x + 0.5) and ceil(x - 0.5) too

comment:8 in reply to: ↑ 7 Changed 4 years ago by cehoyos

Replying to michael:

This looks like a compiler bug or a bug in libc
which versions of these are used ?

ia64: gcc-4.4, gcc-4.5, gcc-4.6, gcc-4.7 (works fine with icc), Debian EGLIBC 2.17-5
sparc64: gcc-4.2, gcc-4.4, gcc-4.6, Debian EGLIBC 2.13-38

Also please test nearbyint(), round(), floor(x + 0.5) and ceil(x - 0.5) too

All four alternatives pass fate on both systems.

$ make fate-parseutils
TEST    parseutils
--- ./tests/ref/fate/parseutils 2013-07-04 03:21:28.208764283 +0200
+++ tests/data/fate/parseutils  2013-07-04 14:48:50.008046808 +0200
@@ -6,24 +6,68 @@
 '-123 / 0' -> -1/0 ERROR
 '' -> 0/0 ERROR
 '/' -> 0/0 ERROR
-' 123  /  321' -> 41/107 OK
+d: 0.383178, den: 2305843009213693952, d*den: 883547321287490176.000000, (int64_t)(d*den+0.5): 883547321287490176, rint(d*den): 883547321287490176.000000,
+(uint64_t)rint(d*den): 883547321287490176, (int64_t)rint(d*den):  883547205323373184, llrint(d*den): 883547205323373184
+nearbyint(d*den): 883547321287490176.000000, (int64_t)nearbyint(d*den):  883547321287490176, round(d*den): 883547321287490176.000000, (int64_t)round(d*den): 883547321287490176
+floor(d*den+0.5): 883547321287490176.000000, (int64_t)floor(d*den+0.5): 883547321287490176, ceil(d*den-0.5): 883547321287490176.000000, (int64_t)ceil(d*den-0.5): 883547321287490176
+' 123  /  321' -> 213623/557504 OK
 'foo/foo' -> 0/0 ERROR
 'foo/1' -> 0/0 ERROR
 '1/foo' -> 1/0 ERROR
 '0/0' -> 0/0 ERROR
 '/0' -> 0/0 ERROR
 '1/' -> 1/0 ERROR
+d: 1.000000, den: 2305843009213693952, d*den: 2305843009213693952.000000, (int64_t)(d*den+0.5): 2305843009213693952, rint(d*den): 2305843009213693952.000000,
+(uint64_t)rint(d*den): 2305843009213693952, (int64_t)rint(d*den):  2305843009213693952, llrint(d*den): 2305843009213693952
+nearbyint(d*den): 2305843009213693952.000000, (int64_t)nearbyint(d*den):  2305843009213693952, round(d*den): 2305843009213693952.000000, (int64_t)round(d*den): 2305843009213693952
+floor(d*den+0.5): 2305843009213693952.000000, (int64_t)floor(d*den+0.5): 2305843009213693952, ceil(d*den-0.5): 2305843009213693952.000000, (int64_t)ceil(d*den-0.5): 2305843009213693952
 '1' -> 1/1 OK
+d: 0.000000, den: 2305843009213693952, d*den: 0.000000, (int64_t)(d*den+0.5): 0, rint(d*den): 0.000000,
+(uint64_t)rint(d*den): 0, (int64_t)rint(d*den):  0, llrint(d*den): 0
+nearbyint(d*den): 0.000000, (int64_t)nearbyint(d*den):  0, round(d*den): 0.000000, (int64_t)round(d*den): 0
+floor(d*den+0.5): 0.000000, (int64_t)floor(d*den+0.5): 0, ceil(d*den-0.5): -0.000000, (int64_t)ceil(d*den-0.5): 0
 '0' -> 0/1 ERROR
+d: -1.000000, den: 2305843009213693952, d*den: -2305843009213693952.000000, (int64_t)(d*den+0.5): -2305843009213693952, rint(d*den): -2305843009213693952.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -2305843009213693952, llrint(d*den): -2305843009213693952
+nearbyint(d*den): -2305843009213693952.000000, (int64_t)nearbyint(d*den):  -2305843009213693952, round(d*den): -2305843009213693952.000000, (int64_t)round(d*den): -2305843009213693952
+floor(d*den+0.5): -2305843009213693952.000000, (int64_t)floor(d*den+0.5): -2305843009213693952, ceil(d*den-0.5): -2305843009213693952.000000, (int64_t)ceil(d*den-0.5): -2305843009213693952
 '-123/123' -> -1/1 ERROR
 '-foo' -> 0/0 ERROR
-'123.23' -> 12323/100 OK
-'.23' -> 23/100 OK
-'-.23' -> -23/100 ERROR
-'-0.234' -> -117/500 ERROR
+d: 123.230000, den: 36028797018963968, d*den: 4439828656646929920.000000, (int64_t)(d*den+0.5): 4439828656646929920, rint(d*den): 4439828656646929920.000000,
+(uint64_t)rint(d*den): 4439828656646929920, (int64_t)rint(d*den):  4439827956567260672, llrint(d*den): 4439827956567260672
+nearbyint(d*den): 4439828656646929920.000000, (int64_t)nearbyint(d*den):  4439828656646929920, round(d*den): 4439828656646929920.000000, (int64_t)round(d*den): 4439828656646929920
+floor(d*den+0.5): 4439828656646929920.000000, (int64_t)floor(d*den+0.5): 4439828656646929920, ceil(d*den-0.5): 4439828656646929920.000000, (int64_t)ceil(d*den-0.5): 4439828656646929920
+'123.23' -> 697112/5657 OK
+d: 0.230000, den: 2305843009213693952, d*den: 530343892119149632.000000, (int64_t)(d*den+0.5): 530343892119149632, rint(d*den): 530343892119149632.000000,
+(uint64_t)rint(d*den): 530343892119149632, (int64_t)rint(d*den):  530343664485882944, llrint(d*den): 530343664485882944
+nearbyint(d*den): 530343892119149632.000000, (int64_t)nearbyint(d*den):  530343892119149632, round(d*den): 530343892119149632.000000, (int64_t)round(d*den): 530343892119149632
+floor(d*den+0.5): 530343892119149632.000000, (int64_t)floor(d*den+0.5): 530343892119149632, ceil(d*den-0.5): 530343892119149632.000000, (int64_t)ceil(d*den-0.5): 530343892119149632
+'.23' -> 209687/911683 OK
+d: -0.230000, den: 2305843009213693952, d*den: -530343892119149632.000000, (int64_t)(d*den+0.5): -530343892119149632, rint(d*den): -530343892119149632.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -530343664485882944, llrint(d*den): -530343664485882944
+nearbyint(d*den): -530343892119149632.000000, (int64_t)nearbyint(d*den):  -530343892119149632, round(d*den): -530343892119149632.000000, (int64_t)round(d*den): -530343892119149632
+floor(d*den+0.5): -530343892119149632.000000, (int64_t)floor(d*den+0.5): -530343892119149632, ceil(d*den-0.5): -530343892119149632.000000, (int64_t)ceil(d*den-0.5): -530343892119149632
+'-.23' -> -209687/911683 ERROR
+d: -0.234000, den: 2305843009213693952, d*den: -539567264156004416.000000, (int64_t)(d*den+0.5): -539567264156004416, rint(d*den): -539567264156004416.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -539567191141560384, llrint(d*den): -539567191141560384
+nearbyint(d*den): -539567264156004416.000000, (int64_t)nearbyint(d*den):  -539567264156004416, round(d*den): -539567264156004416.000000, (int64_t)round(d*den): -539567264156004416
+floor(d*den+0.5): -539567264156004416.000000, (int64_t)floor(d*den+0.5): -539567264156004416, ceil(d*den-0.5): -539567264156004416.000000, (int64_t)ceil(d*den-0.5): -539567264156004416
+'-0.234' -> -177357/757936 ERROR
+d: -0.000000, den: 2305843009213693952, d*den: -230584300921.369385, (int64_t)(d*den+0.5): -230584300920, rint(d*den): -230584300921.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -230584300921, llrint(d*den): -230584300921
+nearbyint(d*den): -230584300921.000000, (int64_t)nearbyint(d*den):  -230584300921, round(d*den): -230584300921.000000, (int64_t)round(d*den): -230584300921
+floor(d*den+0.5): -230584300921.000000, (int64_t)floor(d*den+0.5): -230584300921, ceil(d*den-0.5): -230584300921.000000, (int64_t)ceil(d*den-0.5): -230584300921
 '-0.0000001' -> -1/10000000 ERROR
-'  21332.2324   ' -> 917286/43 OK
-' -21332.2324   ' -> -917286/43 ERROR
+d: 21332.232400, den: 140737488355328, d*den: 3002244808988150784.000000, (int64_t)(d*den+0.5): 3002244808988150784, rint(d*den): 3002244808988150784.000000,
+(uint64_t)rint(d*den): 3002244808988150784, (int64_t)rint(d*den):  3002242889137769472, llrint(d*den): 3002242889137769472
+nearbyint(d*den): 3002244808988150784.000000, (int64_t)nearbyint(d*den):  3002244808988150784, round(d*den): 3002244808988150784.000000, (int64_t)round(d*den): 3002244808988150784
+floor(d*den+0.5): 3002244808988150784.000000, (int64_t)floor(d*den+0.5): 3002244808988150784, ceil(d*den-0.5): 3002244808988150784.000000, (int64_t)ceil(d*den-0.5): 3002244808988150784
+'  21332.2324   ' -> 682631/32 OK
+d: -21332.232400, den: 140737488355328, d*den: -3002244808988150784.000000, (int64_t)(d*den+0.5): -3002244808988150784, rint(d*den): -3002244808988150784.000000,
+(uint64_t)rint(d*den): -9223372036854775808, (int64_t)rint(d*den):  -3002242889137769472, llrint(d*den): -3002242889137769472
+nearbyint(d*den): -3002244808988150784.000000, (int64_t)nearbyint(d*den):  -3002244808988150784, round(d*den): -3002244808988150784.000000, (int64_t)round(d*den): -3002244808988150784
+floor(d*den+0.5): -3002244808988150784.000000, (int64_t)floor(d*den+0.5): -3002244808988150784, ceil(d*den-0.5): -3002244808988150784.000000, (int64_t)ceil(d*den-0.5): -3002244808988150784
+' -21332.2324   ' -> -682631/32 ERROR

 Testing av_parse_color()
 bikeshed -> R(80) G(64) B(140) A(59)
Test parseutils failed. Look at tests/data/fate/parseutils.err for details.

comment:9 Changed 4 years ago by michael

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.