[sldev] Wind Sound CPU usage. (patch-4)

Callum Lerwick seg at haxxed.com
Wed Mar 5 23:36:57 PST 2008


On Wed, 2008-03-05 at 22:58 -0500, Jason Giglio wrote:
> Here's a new patch that combines techniques from Aimee's patch and my 
> original patch.
> 
> It does frequency damping conditionally based on whether it needs to or 
> not. That is, if the frequency isn't changing (much), we don't need to 
> damp.  This addresses the very subtle pop that Aimee observed when you 
> suddenly stop moving.

Bleh. You still shouldn't need to interpolate every sample. What is the
block size? Limit the inner loop to N samples, where N is a suitable
"control rate", then put another loop around it that recalculates the
filter coefficients and loops until the buffer is full.

Or just convince fmod to call with a smaller block size...

And we may be able find a faster filter design, actually the existing
one appears pretty simple in the inner loop, but cos()/sqrt() are
killers. Establishing a control rate might make this manageable. But it
is not documented what the filter actually *is*... Sounds like a
bandpass filter. 24db/oct? I suppose I can fire up baudline and see...

> This newest patch profiles at 1.1% standing still, 1.3% moving, and near 
> 0% when wind is muted or turned way down.

Better.

The final clip check irks me. If you're clipping, you've failed anyway.
The generator needs to be bounded to not clip anyway. Nuke clipSample(),
which will make any clipping even more noticeable (integer wraparound),
and tweak the scaling factor down (the 32768.f) until it stops clipping.
That will save us some branches.

The conversion code I wrote for something else is using 32767, one less,
but then the float is pre-clipped to -1/+1. Since this is a resonant
filter we're dealing with, its possible for the output samples to exceed
the range of the input samples, so it may need to be tweaked down a bit
more...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.secondlife.com/pipermail/sldev/attachments/20080306/75c10bf9/attachment.pgp


More information about the SLDev mailing list