flibitijibibo/openal-soft-msadpcm — pull request #2 by sulix (2013-12-04 12:49:11+00:00)
Title: Decrease MSADPCM decode times to about 80%

This patchset decreases MSADPCM decode time to 82.2% (std dev 6.2%) over codename Naddachance's initial load on my machine. It also greatly helps to reduce the pause when new dialogue is loaded.

Basically, there are two parts to this, and both of them make the code quite a bit uglier. :/

The first patch creates specialized versions of the DecodeMSADPCMBlock function for Mono and Stereo streams, each of which have the decode loop unrolled.

The second patch creates a special version of the Convert_ALshort_ALmsadpcm64 function that decodes directly into the final buffer, rather than a temp. buffer. This is the biggest performance improvement: all MSADPCM decodes in Naddachance are MSADPCM64->ALshort, so there was always a needless copy.

I haven't implemented the special Convert_ALshort_ALmsadpcm{128,256} functions, as I couldn't find any MSADPCM{128,256} streams to test on, but it should be pretty simple to extend this.

— David