The point by point filter toolbox

XCore Project reviews, ideas, videos and proposals.
Post Reply
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

The point by point filter toolbox

Post by lilltroll »

Version: 0.1
Status: Alpha
License: BSD
Download: /files/project_builds/Filtertoolbox.zip

News

The sc_dsp_filter is more up to date and more optimized that is found on github. Consider to use that instead.
I wasn't quite happy about the filtercode found at xmos.com download section regarding the performance (since it is/was just a general filter code for BP-filter banks), so I will collect different one dimesional filterfunctions for sample by sample use in a toolbox. Also some MATLAB code - how to generate and export filtercoeff to the filter functions.
Please remeber that I only had a 8 week C-course back in 1996.

So from a C-programming perspective things here can be something to laught at. Any suggestions on how to write nicer looking code are appreciated.

On the other hand, I do check the ASM simulation trace to overview the instruction needed/cycle and compare it to optimized DSP libraries.

Also, there might be some large changes between version numbers and they will probably not be backward compatiable. For the momenet I'm using arrays, but I will change to structs when I understand how to make a general struct that can be used in a smart way.
As far as possible, I will try to mix XC and "built in ASM macros" to make it efficient but also with full compatibillity with all XMOS processors.


Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

I have an efficient FIR filter with 64-bit accumulator.
An arbitary order fixed TDF-II IIR-filter on Second Order Sections (SOS) form.

Right now I'm implementing double float IIR filters to test out the computational burden (based on math.h)
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

So, with a floating point BiQuad section in one thread, I can run 6 threads in total on one core filter audio at 48 kHz thrue the BiQuad section. At seven treads in parrallell I believe that the BiQuad secion is starved out of time. The BiQuad section uses 5 floating point multiplications and 4 floating point add or sub and 2 casts.
I guess that would give me an efficient kFLOPS at 432 @ 66 MHz thread speed.
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

So, it was very easy to make an working floating IIR filter, but it's a very computational heavy task using full compatibillity with IEEE standard and math.h
For IIR filtering only mult, add and conversion from int2float and float2int is needed.
Hopefully with some help from some others with experice on the forum, I can implement a special format with a 32 bit significand and a 8 or 16 bit exponent that is at least 5 times faster compared to math.h
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

Made MATLAB simulation of a special float format with a 31-bit radix, based on int16 (short) and int32 (int) as datatypes, intended to handle multiplication with the MACS instruction.
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

I'm working alot with special floats format with different fraction length. I'm doing alot of progress, specially with my XC+ASM skills.
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

So my "float_64" is now working (float with a 64 bit mantissa).
I tested a narrow BP- filter at 20 Hz @192 kHz with a 50 MHz thread speed without problems.

So it must at least be 5 times faster than the IEEE singel implementation.
Next step is to analyse it in XTA :)
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

I added support for using a struct with the filter coeff. It uses some more instructions within the filter, but it makes it so much easier for the programmer. Right now I have a bug in my code. My floats seems to have a incorrect roudoff. It performes better than a single, but not as good as a double. Probably I am only getting the 32 MSB correct, making som error with the 32 LSB.
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

Uploaded the first toolbox - cleaned from prototypes. I hope I have not mixed up things.
And hope to add faster floats and longer fixed soon.

OBS !! The float64 function still has some bug - it has a too large roundoff error !!
Probably not the most confused programmer anymore on the XCORE forum.
Post Reply