[FFmpeg-devel] [PATCH 10/10] Document how av_cmp_q() deal when one of the values to be compared is 0/0.

Stefano Sabatini stefano.sabatini-lala
Fri Oct 1 09:10:37 CEST 2010


On date Thursday 2010-09-30 23:58:55 +0200, Michael Niedermayer encoded:
> On Thu, Sep 30, 2010 at 09:45:41PM +0200, Stefano Sabatini wrote:
> > ---
> >  libavutil/rational.h |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/libavutil/rational.h b/libavutil/rational.h
> > index 2dd0c2c..bd2e711 100644
> > --- a/libavutil/rational.h
> > +++ b/libavutil/rational.h
> > @@ -41,6 +41,10 @@ typedef struct AVRational{
> >  
> >  /**
> >   * Compare two rationals.
> > + * If one of the compared values is 0/0, the result of the comparison
> > + * is always 0, so you should do an explicit check for that case
> > + * rather than use this function.
> 
> is there any return value that would in any case avoid an additional check?

@return 0 if a==b, 1 if a>b and -1 if a<b

so which value should it return? In any case I don't think that would
be much intuitive, so I prefer anyway the idea of the external check.

Also consider that in some circustance it may be convenient to just
consider 0/0 as an indetermined form, and so assume that 0/0 == N/M
for each N,M.

Regards.
-- 
FFmpeg = Fostering Fast Minimalistic Prodigious Elitist Guru



More information about the ffmpeg-devel mailing list