[FFmpeg-cvslog] lavu/rational: add more info regarding floor(x+0.5) usage

Ganesh Ajjanagadde git at videolan.org
Tue Mar 1 01:28:52 CET 2016


ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanag at gmail.com> | Wed Feb 24 20:47:00 2016 -0500| [7dabc78ce13e3baa37292f42df2364b4ccd2aa78] | committer: Ganesh Ajjanagadde

lavu/rational: add more info regarding floor(x+0.5) usage

Add some more verbose info regarding why the imprecise and slow floor(x+0.5) hack
is used; helpful for future maintenance.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanag at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7dabc78ce13e3baa37292f42df2364b4ccd2aa78
---

 libavutil/rational.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/rational.c b/libavutil/rational.c
index 6b3f50a..cab4438 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -115,7 +115,8 @@ AVRational av_d2q(double d, int max)
     frexp(d, &exponent);
     exponent = FFMAX(exponent-1, 0);
     den = 1LL << (61 - exponent);
-    // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64
+    // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64,
+    // see Ticket2713 for affected gcc/glibc versions
     av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, max);
     if ((!a.num || !a.den) && d && max>0 && max<INT_MAX)
         av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, INT_MAX);



More information about the ffmpeg-cvslog mailing list