[FFmpeg-devel] [PATCH] WMA: use a table instead of pow() in decode_exp_vlc

Reimar Döffinger Reimar.Doeffinger
Tue Sep 29 17:03:01 CEST 2009


On Tue, Sep 29, 2009 at 03:46:22PM +0100, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> 
> > This one has been applied it seems.
> >
> >> @@ -271,8 +339,9 @@ static int decode_exp_vlc(WMACodecContext *s, int ch)
> >>              return -1;
> >>          /* NOTE: this offset is the same as MPEG4 AAC ! */
> >>          last_exp += code - 60;
> >> -        /* XXX: use a table */
> >> -        v = pow(10, last_exp * (1.0 / 16.0));
> >> +        if ((unsigned)last_exp + 60 > FF_ARRAY_ELEMS(pow_tab))
> >> +            return -1;
> >
> > Should we maybe add a request for samples here? If we get a real-world
> > sample, it might be worth to try doing something better than just giving
> > up here.
> > Note that this is in part a general question, would it make sense to
> > request sample for all "fail hard" errors we have where we potentially
> > could do better?
> 
> I got the table size from Rockbox.  I don't know where they got it.

That wasn't quite my point, I was thinking of certainly broken files
(i.e. Microsoft decoder won't play them).
Though as you mention it an obvious improvement would be
if ((unsigned)last_exp + 60 > FF_ARRAY_ELEMS(pow_tab))
    v = pow(...);
else v = table[]



More information about the ffmpeg-devel mailing list