From 74df9f9c816f54fc60b131a347e7e1f1988b1fe2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 23 Jan 2009 11:00:36 +0000 Subject: * Adds a synchronous jpeg decode for pre-caching purposes * When the DynamicTextureModule creates a j2k image, pre-cache the decode so that it doesn't stall any client threads. --- OpenSim/Region/Environment/Interfaces/IJ2KDecoder.cs | 1 + .../Modules/Agent/TextureSender/J2KDecoderModule.cs | 10 ++++++++++ .../Modules/Scripting/DynamicTexture/DynamicTextureModule.cs | 7 +++++++ 3 files changed, 18 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Interfaces/IJ2KDecoder.cs b/OpenSim/Region/Environment/Interfaces/IJ2KDecoder.cs index 44b9289..2a37195 100644 --- a/OpenSim/Region/Environment/Interfaces/IJ2KDecoder.cs +++ b/OpenSim/Region/Environment/Interfaces/IJ2KDecoder.cs @@ -36,5 +36,6 @@ namespace OpenSim.Region.Environment.Interfaces public interface IJ2KDecoder { void decode(UUID AssetId, byte[] assetData, DecodedCallback decodedReturn); + void syncdecode(UUID AssetId, byte[] j2kdata); } } diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs index 2a565ee..53e66fc 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs @@ -146,6 +146,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender } } + /// + /// Provides a synchronous decode so that caller can be assured that this executes before the next line + /// + /// + /// + public void syncdecode(UUID AssetId, byte[] j2kdata) + { + doJ2kDecode(AssetId, j2kdata); + } + #endregion /// diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs index e9fe373..0974f02 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -242,6 +242,13 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture LastAssetID = asset.FullID; + IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface(); + if (cacheLayerDecode != null) + { + cacheLayerDecode.syncdecode(asset.FullID, asset.Data); + } + cacheLayerDecode = null; + // mostly keep the values from before Primitive.TextureEntry tmptex = part.Shape.Textures; -- cgit v1.1