[FFmpeg-devel] [PATCH] WMA Voice decoder
Thu Jan 21 20:45:30 CET 2010
On Thu, Jan 21, 2010 at 02:06:56PM -0500, Ronald S. Bultje wrote:
> 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
Doxy-style makes no sense for code comments, only for declarations.
> 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
That's going to be silly slow, you should use
y = x - 9 * MULH(477218589, x); // y = x % 9
(you could here add a "assert(y == x % 9);" to make sure there's no bug
while testing it).
y = y * 5 + 6;
Apart from that it should be identical.
More information about the ffmpeg-devel