[FFmpeg-devel] [PATCH] avoid floating point for -t endtime

Michael Niedermayer michaelni
Sun Feb 7 09:51:29 CET 2010


On Sun, Feb 07, 2010 at 08:56:14AM +0100, Reimar D?ffinger wrote:
> On Sun, Feb 07, 2010 at 01:22:57AM +0100, Michael Niedermayer wrote:
> > > +    a = ts_a * tb_a.num * tb_b.den;
> > > +    b = ts_b * tb_b.num * tb_a.den;
> > 
> > read the nut spec again about compare_ts() this overflows for rather small
> > numbers
> 
> Here is an attempt to fix compare_ts first.
> It assumes that av_rescale_q does the right thing, although it does at least
> use a different algorithm that convert_ts in nut.txt.
> "make test" for it is still in progress.
[...]
> +    if (av_rescale_q(ts_a, tb_a, tb_b) < ts_b) return -1;
> +    if (av_rescale_q(ts_b, tb_b, tb_a) < ts_a) return  1;
> +    return 0;

av_rescale_q is 
 return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);

thats not rounding correctly for us

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100207/4fd3f291/attachment.pgp>



More information about the ffmpeg-devel mailing list