diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-10-20 20:23:46 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-10-20 20:23:46 +0000 |
commit | 5ff85f1d8b5721a9e7f0ca6e03f61f5d3a4c3664 (patch) | |
tree | 710ea001d862c7bdb29dd0e707f9dd9eee3f2c72 /libavcodec/common.c | |
parent | 9dad924e22dc0e1a09013b588b43051b5baf428d (diff) | |
download | ffmpeg-5ff85f1d8b5721a9e7f0ca6e03f61f5d3a4c3664.tar.gz |
AVRational
sample_aspect_ratio
aspect ratio in JPEG JFIF is SAR not DAR !
removed nonsense SAR guessing code
various related cleanups
bugs?
Originally committed as revision 2403 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/common.c')
-rw-r--r-- | libavcodec/common.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/libavcodec/common.c b/libavcodec/common.c index 58d625f099..f37c2c9eba 100644 --- a/libavcodec/common.c +++ b/libavcodec/common.c @@ -386,29 +386,3 @@ int64_t ff_gcd(int64_t a, int64_t b){ if(b) return ff_gcd(b, a%b); else return a; } - -void ff_float2fraction(int *nom_arg, int *denom_arg, double f, int max){ - double best_diff=1E10, diff; - int best_denom=1, best_nom=1; - int nom, denom, gcd; - - //brute force here, perhaps we should try continued fractions if we need large max ... - for(denom=1; denom<=max; denom++){ - nom= (int)(f*denom + 0.5); - if(nom<=0 || nom>max) continue; - - diff= ABS( f - (double)nom / (double)denom ); - if(diff < best_diff){ - best_diff= diff; - best_nom= nom; - best_denom= denom; - } - } - - gcd= ff_gcd(best_nom, best_denom); - best_nom /= gcd; - best_denom /= gcd; - - *nom_arg= best_nom; - *denom_arg= best_denom; -} |