[x264-devel] param_parse: Fix framerate rounding issues
Henrik Gramner
git at videolan.org
Wed Aug 19 21:16:12 CEST 2015
x264 | branch: master | Henrik Gramner <henrik at gramner.com> | Mon Jul 27 00:08:31 2015 +0200| [59e7ded846a832125cb533aadff9895487771ea7] | committer: Henrik Gramner
param_parse: Fix framerate rounding issues
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=59e7ded846a832125cb533aadff9895487771ea7
---
common/common.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/common/common.c b/common/common.c
index 3153c7e..273334a 100644
--- a/common/common.c
+++ b/common/common.c
@@ -703,14 +703,12 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
}
OPT("fps")
{
- if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) == 2 )
- ;
- else
+ if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) != 2 )
{
- float fps = atof(value);
- if( fps > 0 && fps <= INT_MAX/1000 )
+ double fps = atof(value);
+ if( fps > 0.0 && fps <= INT_MAX/1000.0 )
{
- p->i_fps_num = (int)(fps * 1000 + .5);
+ p->i_fps_num = (int)(fps * 1000.0 + .5);
p->i_fps_den = 1000;
}
else
More information about the x264-devel
mailing list