pd-externals / earplug

binaural filter based on KEMAR impulse measurement for Pd
GNU General Public License v2.0
14 stars 1 forks source link

DSP optimizations #3

Open danomatika opened 3 years ago

danomatika commented 3 years ago

This external performs DSP convolution by basically doing a lot of matrix math on a 368x2x128 data set and can get a bit CPU heavy when using multiple objects.

Some optimizations could be:

ping @SylvainPDR

chikashimiyama commented 3 years ago

vDSP for mac, MTL for win, KissFFT for linux? platform/arch-specific approach costs a lot of dev time. Platform independent options: fftw http://fftw.org/ kissFFT could be the easiest though.

danomatika commented 3 years ago

Whatever is cross-platform and easiest. Pierre (intern) looked into this and said there wasn't much he could change to make it faster, but it's worth a second look just in case.

chikashimiyama commented 3 years ago

ok.

chikashimiyama commented 3 years ago

https://github.com/pd-externals/earplug/blob/4ac193809ac89d6fc7dfe1e9d55b3c5d22b74bc9/earplug~.c#L151-L178

convolution code

chikashimiyama commented 3 years ago

L. 170 - 171 is totally redundant code. and possibly this is not intended. since this is done in the nested loop of while(block size--) and for. the intended crossfading may be not working at all.

chikashimiyama commented 3 years ago

@danomatika

I tried frequency domain convolution using uFFT but the result is not very good (not so optimized significantly and generates some artifacts). see the optimization branch. I can investigate more but I'm not sure if I should use more time for this...

danomatika commented 3 years ago

This refers to PR #16