VOGONS


First post, by canadacow

User metadata
Rank Member
Rank
Member

Sooo... I've been working on optimizing the code associated with the MT-32. I consider the low-pass filter, which presently uses floating point code, as a bottleneck in my program's execution. So, today I tried to make an interger/fixed point version of the routine. I discovered that fixed point 32 bit integers are not precise enough for the filter. I tried instead to use 64 bit integers within Visual C (__int64). Using a fixed point of 20 bits I was able to gain enough precision for the filter to work. Interestingly, however, it doesn't seem that the 64 bit integer version is any faster than the floating point version. Infact, a disassembly listing shows that the floating point version has fewer instructions (though I don't know what it comes out to cycle wise) than the 64 bit instructions. It seems for any multiplications and shifts, C has to resort to function calls to do the 64 bit math. I'm sure this slows it down a good bit. Anyone out there have any suggestions on what I could do? Anyone have any experience with high precision and fixed point math?

Last edited by canadacow on 2003-07-30, 18:45. Edited 1 time in total.

Reply 1 of 3, by vladr

User metadata
Rank Oldbie
Rank
Oldbie

Optimization on should have inlined the 64-bit lib-calls. Anyway, 64-bit arithmetic may end up being slower than floating-point on IA32 (FPUs in general may be more performant than ALUs nowadays, and 64-bit int operations may be done as tw 32-bit int ops, which is slooow as well). But I don't get it why you need so much precision, though - haven't looked at the code, but is your filter a linear xform? And what is the window size?

V.

Reply 2 of 3, by canadacow

User metadata
Rank Member
Rank
Member

My filter is a lowpass butterworth with four poles and four zeros. And no, like every other bloody thing on the MT-32 the transform is logarithmic. As for the number of poles and zero's I've used, I found it was necessary to get the required rectangular lowpass filter window.

Reply 3 of 3, by vladr

User metadata
Rank Oldbie
Rank
Oldbie

But how wide is your window? Ideally all the precision you need would be log2(width) [in samples] for the fractional, and 15-16bit (if not 14, since IIRC the DAC has two input pins floating) for the integral part, nay?
V.

canadacow wrote:

My filter is a lowpass butterworth with four poles and four zeros. And no, like every other bloody thing on the MT-32 the transform is logarithmic. As for the number of poles and zero's I've used, I found it was necessary to get the required rectangular lowpass filter window.