From b86e7715a8d8f081fa9452d92a9d8f6d52867a12 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 5 Jan 2012 22:54:33 +0000
Subject: Improve "j2k decode" command to tell us how many layers and
components were decoded, instead of just success/failure
---
.../Agent/TextureSender/J2KDecoderModule.cs | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs')
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 349d3ac..a1a2501 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -133,13 +133,20 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
// Do Decode!
if (decode)
- DoJ2KDecode(assetID, j2kData);
+ Decode(assetID, j2kData);
}
}
public bool Decode(UUID assetID, byte[] j2kData)
{
- return DoJ2KDecode(assetID, j2kData);
+ OpenJPEG.J2KLayerInfo[] layers;
+ int components;
+ return Decode(assetID, j2kData, out layers, out components);
+ }
+
+ public bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components)
+ {
+ return DoJ2KDecode(assetID, j2kData, out layers, out components);
}
#endregion IJ2KDecoder
@@ -149,7 +156,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
///
/// UUID of Asset
/// JPEG2000 data
- private bool DoJ2KDecode(UUID assetID, byte[] j2kData)
+ /// layer data
+ /// number of components
+ /// true if decode was successful. false otherwise.
+ private bool DoJ2KDecode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components)
{
// m_log.DebugFormat(
// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID);
@@ -158,7 +168,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
//int DecodeTime = 0;
//DecodeTime = Environment.TickCount;
- OpenJPEG.J2KLayerInfo[] layers;
+
+ // We don't get this from CSJ2K. Is it relevant?
+ components = 0;
if (!TryLoadCacheForAsset(assetID, out layers))
{
@@ -198,7 +210,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
}
else
{
- int components;
if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components))
{
m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID);
--
cgit v1.1