Hi, all.

>>One problem:  The code is now about 50% slower, mostly because
>>the old quantize_xrpow had some hand rolled asm for gcc and MSVC.

No problem :)
This is ASM implementation.

# I have no MSVC and am not good at MSVC, so there's no MSVC code.
# But it is easy to implement on MSVC, I hope.

First, make a different table whether we use ASM or not.

#if defined(__GNUC__) && defined(__i386__)
    for (i = 0; i < PRECALC_SIZE - 1; i++)
        adj43[i] = i + 0.5 - pow(0.5 * (pow43[i] + pow43[i + 1]), 0.75);

    adj43[i] = 0.0;
#else
    for (i = 0; i < PRECALC_SIZE - 1; i++)
        adj43[i] = (i + 1) - pow(0.5 * (pow43[i] + pow43[i + 1]), 0.75);

    adj43[i] = 0.5;
#endif

And second, quantize !

#if defined(__GNUC__) && defined(__i386__)
            x = istep * *xp++;
            asm("fistpl %0 ": "=m"(*pi++): "t"(x + adj43[(int)x]): "st");
#else
            x = istep * *xp++;
            *pi++ = (int)(x + adj43[(int)x]);
#endif

This code is only about 5-10% slower than the code with the old
quantize method.

# I think it is better for this new code to enable only when the high
# quality mode(-h option).
-- 
Takehiro TOMINAGA // may the source be with you!
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to