[FFmpeg-devel] [PATCH] WMA Voice decoder

Ronald S. Bultje rsbultje
Thu Jan 21 20:06:56 CET 2010


Hi,

On Thu, Jan 21, 2010 at 1:52 PM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de> wrote:
> I suspect that he means that FAST_DIV should be overkill for this
> usage.

OK, I'll expand it properly then.

> Well, if you copy-pasted correctly, yes
> FAST_DIV(x, 9) / 9
> instead of
> FAST_DIV(x, 9) * 9

Oops, right. Well, c/p error, numbers still differ.

    int z, y, x = block_num * 1877 + frame_cntr;
    if (x >= 0xFFFF) x -= 0xFFFF; ///< max value of x is 8*1877+0xFFFE=0x13AA6,
                                  ///< so this is effectively a modulo (%)
    y = (x - 9 * (int)((477218589ULL * x) >> 32)) * 5 + 6; ///< (x % 9) * 5 + 6
    z = (uint16_t) (x * 49995 / y);
    return z % (1000 - block_size);

That'll be it? (The int cast makes sure gcc doesn't do anything stupid
like keeping it as a 64-bit number after the >> 32, does that make
sense?)

Ronald



More information about the ffmpeg-devel mailing list