[MPlayer-dev-eng] [PATCH] MPEG-2 TS 60000/1001 FPS Conversion	Error in mencoder
    Eric Lammerts 
    eric at lammerts.org
       
    Sun Nov 26 21:58:46 CET 2006
    
    
  
Uoti Urpala wrote:
> Other people did note in that thread that it's possible to reconstruct
> the fraction from doubles but float accuracy might not be enough. And
> guess what, they were right and your claims were wrong.
> 
> (gdb) print (float)(31001./1293) == (float)(24000./1001)
> $1 = 1
> 
> So av_d2q or whatever function was used to reconstruct the fraction
> "didn't work" when it could not tell the difference between 2 equal
> float values?
The problem is that 1293*24000 != 1001*31001, which is what 
find_frame_rate_index() in mpeg12.c is looking for.
When you go from a rational number to floating point and then back to a 
rational number you'll lose precision. It is unavoidable.
So we should either fix that and make the fps numbers rationals, or (as a 
dirty workaround) make everything after such conversions less picky about 
exact matches (e.g., in find_frame_rate_index() change the "if(dmin)" to 
"if(dmin > 1)").
Eric
    
    
More information about the MPlayer-dev-eng
mailing list