sfstoolbox / sfs-matlab

SFS Toolbox for Matlab/Octave
https://sfs-matlab.readthedocs.io
MIT License
97 stars 39 forks source link

delayline() is called twice for every impulse response in ir_wfs() #116

Open hagenw opened 7 years ago

hagenw commented 7 years ago

This is a follow up on #115.

There @VeraE wrote that delayline() gets called several times:

  1. when calculating the driving function,
  2. in ir_correct_distance()

One way to improve this might be to let ir_correct_distance() return delay and weight instead of the actual shifted impulse response. The downside is that this would complicate how get_ir() works as this would then need to return the unmodified impulse response and the delay and weight. I guess in this case it would even be better to remove ir_correct_distance() from get_ir() and apply it somewhere else.

Maybe we find a good solution for this, but in my opinion it would be also ok, to stay with the current state.

VeraE commented 7 years ago

The same problem applies to ssr_brs_wfs().

VeraE commented 7 years ago

I would not want to change how get_ir() works either. But I have the following suggestion: The only delay that should be returned from ir_correct_distance() is the one that can be caused by delayline(), I think. So this should be returned from ir_correct_distance() to get_ir() to ir_generic() where it can be added to the delay returned by driving_function_imp_wfs(). What do you think?

hagenw commented 7 years ago

Ah ok, now I see the real problem. I thought it was just a problem performance wise. But the problem is of course that delayline() can add a processing delay already inside ir_correct_distance(). So the only solution seems indeed to return that delay in ir_correct_distance() and pass it on. I do not like that very much as it add a returning parameter to get_ir() that you would not expect there, but I have no better proposal at the moment.