[MPlayer-dev-eng] gcc 2.95 bug/oddity?

Michael Niedermayer michaelni at gmx.at
Wed Jan 19 14:25:06 CET 2005


Hi

On Wednesday 19 January 2005 14:03, Diego Biurrun wrote:
> Diego Biurrun writes:
> > I'm experiencing a peculiar bug that nobody can reproduce, when
> > playing
> >
> > http://mplayerhq.hu/~diego/cathedral-beta2-400extra-crop-avc.mp4
> > http://mplayerhq.hu/~diego/nature_704x576_25Hz_1500kbits.h264
> >
> > playback fails with the following errors:
> >
> > Movie-Aspect is nan:1 - prescaling to correct movie aspect.
> > VO Config (704x576->704x-2147483648,flags=0,'MPlayer',0x32315659)
> > VO: invalid dimensions!
> > FATAL: Cannot initialize video driver.
> >
> > I usually use gcc 2.95.4, if I recompile libmpcodecs/vd.c with gcc 3.3
> > the error goes away, changing -O4 to -O0 and/or -march=pentium,
> > -mcpu=pentium does not help.
> >
> > In libmpcodecs/vd.c line 125 the following variable is declared:
> >
> > float movie_aspect=-1.0;
> >
> > and tested in line 262:
> >
> >   if(movie_aspect>-1.0) sh->aspect = movie_aspect; // cmdline overrides
> > autodetect
> >
> > If I change the initialization of movie_aspect to 0, the problem goes
> > away, but I haven't read the code in depth to understand what it is
> > supposed to be doing.
> >
> > Can anybody give me some further clues about this?  Is this a compiler
> > bug and/or what should I investigate to verify this?
>
> I've been digging through the code some more and found the following:
>
> The problem appears to originate in libmpcodecs/vd_ffmpeg.c line 464
>
>   float aspect= av_q2d(avctx->sample_aspect_ratio) * avctx->width /
> avctx->height;
>
> aspect is used a few lines below to set sh->aspect.
>
> Now after adding a few printfs throughout the code it appears to be
>
>   av_q2d(avctx->sample_aspect_ratio)
>
> that returns nan and thus aspect is nan. av_q2d is defined in
> libavcodec/rational.h as
>
>   /**
>    * converts the given AVRational to a double.
>    */
>   static inline double av_q2d(AVRational a){
>       return a.num / (double) a.den;
>   }
>
> I'm stuck there for the moment.  Michael, can you comment on this?
> It's your code..

av_q2d() is correct, 0/0 is NAN but it should never be 0/0, as avcodec.h says 
unknown aspect is 0 not 0/0, should be fixed

[...]
-- 
Michael

"nothing is evil in the beginning. Even Sauron was not so." -- Elrond




More information about the MPlayer-dev-eng mailing list