diff options
author | Panagiotis Issaris <takis.issaris@uhasselt.be> | 2006-09-18 11:35:48 +0000 |
---|---|---|
committer | Panagiotis Issaris <takis.issaris@uhasselt.be> | 2006-09-18 11:35:48 +0000 |
commit | 97c73545a5d6b28e2ea16773e9f3ba87e3a1c9cb (patch) | |
tree | 4e1c1860fde1df05f7a7451ff3a53de9b3ea05a1 /libavcodec/eval.c | |
parent | e9e12f0e11f43cab3e61257b95f6a6b0ac21b202 (diff) | |
download | ffmpeg-97c73545a5d6b28e2ea16773e9f3ba87e3a1c9cb.tar.gz |
Add support for SI (k, M, ...) and IEC/IEEE (Ki, Mi, ...) units.
Originally committed as revision 6287 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/eval.c')
-rw-r--r-- | libavcodec/eval.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/libavcodec/eval.c b/libavcodec/eval.c index 7eb835fc47..db15f2b5b3 100644 --- a/libavcodec/eval.c +++ b/libavcodec/eval.c @@ -64,49 +64,14 @@ static int strmatch(const char *s, const char *prefix){ return 1; } -static int8_t si_prefixes['z' - 'E' + 1]={ - ['y'-'E']= -24, - ['z'-'E']= -21, - ['a'-'E']= -18, - ['f'-'E']= -15, - ['p'-'E']= -12, - ['n'-'E']= - 9, - ['u'-'E']= - 6, - ['m'-'E']= - 3, - ['c'-'E']= - 2, - ['d'-'E']= - 1, - ['h'-'E']= 2, - ['k'-'E']= 3, - ['K'-'E']= 3, - ['M'-'E']= 6, - ['G'-'E']= 9, - ['T'-'E']= 12, - ['P'-'E']= 15, - ['E'-'E']= 18, - ['Z'-'E']= 21, - ['Y'-'E']= 24, -}; - static double evalPrimary(Parser *p){ double d, d2=NAN; char *next= p->s; int i; /* number */ - d= strtod(p->s, &next); + d= av_strtod(p->s, &next); if(next != p->s){ - if(*next >= 'E' && *next <= 'z'){ - int e= si_prefixes[*next - 'E']; - if(e){ - if(next[1] == 'i'){ - d*= pow( 2, e/0.3); - next+=2; - }else{ - d*= pow(10, e); - next++; - } - } - } p->s= next; return d; } |