[FFmpeg-cvslog] avformat/avienc: Avoid float usage

Michael Niedermayer git at videolan.org
Sat May 23 23:54:36 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat May 23 22:46:51 2015 +0200| [17264cd281c40e67942246960ed9385288b639fc] | committer: Michael Niedermayer

avformat/avienc: Avoid float usage

reduces risk for rounding differences between platforms

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/avienc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index fb2cdd2..5396a7d 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -409,7 +409,7 @@ static int avi_write_header(AVFormatContext *s)
             avio_wl32(pb, 0); // video format   = unknown
             avio_wl32(pb, 0); // video standard = unknown
             // TODO: should be avg_frame_rate
-            avio_wl32(pb, lrintf(1.0 / av_q2d(st->time_base)));
+            avio_wl32(pb, (2LL*st->time_base.den + st->time_base.num - 1) / (2LL * st->time_base.num));
             avio_wl32(pb, enc->width);
             avio_wl32(pb, enc->height);
             avio_wl16(pb, den);



More information about the ffmpeg-cvslog mailing list