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

Michael Niedermayer michaelni
Wed Feb 10 03:26:48 CET 2010


On Tue, Feb 09, 2010 at 08:59:36PM +0100, Reimar D?ffinger wrote:
> On Sun, Feb 07, 2010 at 08:14:32PM +0100, Michael Niedermayer wrote:
> > On Sun, Feb 07, 2010 at 04:18:32PM +0100, Reimar D?ffinger wrote:
> > > On Sun, Feb 07, 2010 at 09:51:29AM +0100, Michael Niedermayer wrote:
> > > > 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
> > > 
> > > In that case I suggest someone first fixes the mess - either change
> > > the convert_ts name in the nut spec, or change it to be an actually
> > > appropriate method for timestamp conversion as the name suggests,
> > > or if it already is change av_rescale_q to do that way.
> > > Pointing me to a spec that either is broken or alternatively means half
> > > of FFmpeg is doing it wrong is not much of a help.
> > 
> > ive added av_convert_ts() you should be able to use it
> 
> Am I missing any reason to not replace the one in seek.c?
> Patch attached (to be applied in two parts).

>  ffmpeg.c           |    2 +-
>  libavformat/seek.c |   46 +++++++---------------------------------------
>  2 files changed, 8 insertions(+), 40 deletions(-)
> aba0e41c261accef4507a3017c605f6dade642a8  cmpts.diff

ok

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- 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/20100210/e0d1ea43/attachment.pgp>



More information about the ffmpeg-devel mailing list