[FFmpeg-devel] [PATCH] WMA Voice decoder

Måns Rullgård mans
Sat Jan 30 23:21:30 CET 2010


"Ronald S. Bultje" <rsbultje at gmail.com> writes:

>>> +    s->min_pitch_val    = ((int) ((ctx->sample_rate << 8) * 0.0025) + 50)
>>> >> 8;
>>> +    s->max_pitch_val    = ((int) ((ctx->sample_rate << 8) * 0.0185) + 50)
>>> >> 8;
>>
>> I think this is better done with integer math
>
> I could, don't really have a strong opinion here. The binary uses
> bit-truncation math here which I refuse to use out of principle (i.e.
> int x int -> int64, then >> 20  and << 1). Divisions are slow.
> Anything else we could use here? /= 400 and whatever for .0185?

Division by a simple constant may well be faster than conversion to
float, float division, and conversion back to integer.  It probably
depends on the compiler.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list