[sldev] LayerData decoding optimization (was: OpenJPEG optimization (Patch 20070331))

John Hurliman jhurliman at wsu.edu
Sun Apr 1 17:49:15 PDT 2007


Callum Lerwick wrote:
> The main change is I noticed the lookup tables are dynamically allocated
> and constantly recalculated, they all seem to be static so that seems
> pretty pointless. So I moved the table calculation into a separate
> program that generates a static header file to use instead.
>   

On this same topic, if anyone wants to grab some low hanging 
optimization fruit in opensl the LayerData (terrain patch) decoder 
reinitializes several data tables for every patch it decodes (256 per 
sim). It does this because the original decoder was designed to work 
with arbitrary sized patches, but the grid only used 16x16 and 32x32 
patches, and now it only uses the full resolution 16x16 patches. When I 
implemented the LayerData decoder in libsecondlife I initialize static 
tables once at startup (one set for 16 and one set for 32, even though 
it turns out we don't need the 32) and just reference those. The same 
can easily be done in opensl since there is a #define 
_PATCH_SIZE_16_AND_32_ONLY that is used to remove some of the loops and 
hand-unroll them. I thought it was kind of funny that someone took the 
time to hand-unroll loops but the lookup tables are still being 
dynamically generated every pass.

Check it out here: 
http://gza.props.org:8180/source/search?q=init_patch_decompressor

John Hurliman


More information about the SLDev mailing list