[MPlayer-dev-eng] enhancement for yuv4mpeg output driver

Michael Niedermayer michaelni at gmx.at
Thu Jan 20 18:07:13 CET 2005


Hi

On Thursday 20 January 2005 16:03, Trent Piepho wrote:
> On Thu, 20 Jan 2005, D Richard Felker III wrote:
> > > Into the email message, yes.  Mplayer only prints the fps value to
> > > three places when you play a file, so I only copied it down to three
> > > places.  I didn't think anyone would feel 10 decimal places were
> > > necessary for an example in an email message.....
> >
> > But the whole precision is there in MPlayer's fps variable, and will
> > get passed to av_reduce if you use it right.
>
> What do you mean by "whole precision"?  If you mean enough precision to
> turn any fraction that was converted to a floating point number back into a
> fraction, that is theoretically impossible.

wrong, see below


>
> > > Secondly, even if I specify -fps 30000/1001, av_reduce() reduces it to
> > > 10999/367!  My float->fraction code gets it right.
> >
> > But only for special cases... BTW if this is true and av_reduce is
> > that broken, it needs to be fixed.
>
> It is not possible take a fraction, turn it into a 32-bit floating point
> number, and then turn it back into a fraction equal to the original in all
> cases.

yes, but thats not what we are talking about, its clear that a fraction made 
of arbitrary large integers can not be losslessly mapped onto a 32bit float
if OTOH u either limit the integers in the fraction enough or remove the 
finiteness limit of the float then its possible


> For any floating point value you pick, there are an infinite number 
> of fractions from which it could have come.  There is no way to figure out
> which of these it came from.  Therefor, any routine you may come up with
> will only work for special cases.

av_reduce will always give u a simplified fraction, so if the input is 
simplified and not unreasonably large u will get the same numerator and 
denominator, if the input is not simplified u will still get a fraction which 
has the same value just with the common factors of the numerator and 
denominator removed

see the attached file, which checks this by brute force


btw, IMHO mplayer should at least use a double instead of a float for fps

[...]
-- 
Michael

"nothing is evil in the beginning. Even Sauron was not so." -- Elrond
-------------- next part --------------
A non-text attachment was scrubbed...
Name: d2q_test.c
Type: text/x-csrc
Size: 525 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050120/b69d7165/attachment.c>


More information about the MPlayer-dev-eng mailing list