[FFmpeg-cvslog] r23283 - in branches/0.6: . libavutil/rational.c

diego subversion
Mon May 24 04:27:43 CEST 2010


Author: diego
Date: Mon May 24 04:27:43 2010
New Revision: 23283

Log:
Convert NaN to 0/0 in av_d2q

This fixes aspect ratio calculation for encoding from files with 0/0 stored,
common with ogg/theora

backport r23280 by conrad

Modified:
   branches/0.6/   (props changed)
   branches/0.6/libavutil/rational.c

Modified: branches/0.6/libavutil/rational.c
==============================================================================
--- branches/0.6/libavutil/rational.c	Mon May 24 04:09:36 2010	(r23282)
+++ branches/0.6/libavutil/rational.c	Mon May 24 04:27:43 2010	(r23283)
@@ -98,6 +98,8 @@ AVRational av_d2q(double d, int max){
 #define LOG2  0.69314718055994530941723212145817656807550013436025
     int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
     int64_t den= 1LL << (61 - exponent);
+    if (isnan(d))
+        return (AVRational){0,0};
     av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);
 
     return a;



More information about the ffmpeg-cvslog mailing list