[FFmpeg-devel] [PATCH] WMA: use a table instead of pow() in decode_exp_vlc
Måns Rullgård
mans
Tue Sep 29 17:52:31 CEST 2009
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?
> 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. 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.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list