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

Reimar Döffinger Reimar.Doeffinger
Tue Sep 29 18:03:46 CEST 2009


On Tue, Sep 29, 2009 at 04:52:31PM +0100, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> 
> > 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).
> 
> Do you have such files?

Well no, if I had such a sample I wouldn't have to ask if we should add
a message asking for samples, would I?

> > 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[]
> 
> That is complicating the code for no reason, unless there exist files
> that need and these should be decoded in the first place.

Well, that was basically why I was asking if there should be a message
asking for samples.
That was just an alternative way of handling it if we don't want to do
that.

> Also,
> adding a few more entries to the table would be better if it's only
> out of bounds by a little.  If it's off by a lot, something is
> seriously wrong.

Originally my question was if we know/want to find out how if there are
any and if yes how to handle those "seriously wrong" cases by asking
for a sample. Or if a decode error is considered enough handling.



More information about the ffmpeg-devel mailing list