aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs21
-rw-r--r--OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs10
-rw-r--r--OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs16
3 files changed, 39 insertions, 8 deletions
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
133 133
134 // Do Decode! 134 // Do Decode!
135 if (decode) 135 if (decode)
136 DoJ2KDecode(assetID, j2kData); 136 Decode(assetID, j2kData);
137 } 137 }
138 } 138 }
139 139
140 public bool Decode(UUID assetID, byte[] j2kData) 140 public bool Decode(UUID assetID, byte[] j2kData)
141 { 141 {
142 return DoJ2KDecode(assetID, j2kData); 142 OpenJPEG.J2KLayerInfo[] layers;
143 int components;
144 return Decode(assetID, j2kData, out layers, out components);
145 }
146
147 public bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components)
148 {
149 return DoJ2KDecode(assetID, j2kData, out layers, out components);
143 } 150 }
144 151
145 #endregion IJ2KDecoder 152 #endregion IJ2KDecoder
@@ -149,7 +156,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
149 /// </summary> 156 /// </summary>
150 /// <param name="assetID">UUID of Asset</param> 157 /// <param name="assetID">UUID of Asset</param>
151 /// <param name="j2kData">JPEG2000 data</param> 158 /// <param name="j2kData">JPEG2000 data</param>
152 private bool DoJ2KDecode(UUID assetID, byte[] j2kData) 159 /// <param name="layers">layer data</param>
160 /// <param name="components">number of components</param>
161 /// <returns>true if decode was successful. false otherwise.</returns>
162 private bool DoJ2KDecode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components)
153 { 163 {
154// m_log.DebugFormat( 164// m_log.DebugFormat(
155// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID); 165// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID);
@@ -158,7 +168,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
158 168
159 //int DecodeTime = 0; 169 //int DecodeTime = 0;
160 //DecodeTime = Environment.TickCount; 170 //DecodeTime = Environment.TickCount;
161 OpenJPEG.J2KLayerInfo[] layers; 171
172 // We don't get this from CSJ2K. Is it relevant?
173 components = 0;
162 174
163 if (!TryLoadCacheForAsset(assetID, out layers)) 175 if (!TryLoadCacheForAsset(assetID, out layers))
164 { 176 {
@@ -198,7 +210,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
198 } 210 }
199 else 211 else
200 { 212 {
201 int components;
202 if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components)) 213 if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components))
203 { 214 {
204 m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID); 215 m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID);
diff --git a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
index 0964276..46d03b3 100644
--- a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
@@ -43,5 +43,15 @@ namespace OpenSim.Region.Framework.Interfaces
43 /// <param name="j2kData"></param> 43 /// <param name="j2kData"></param>
44 /// <returns>true if decode was successful. false otherwise.</returns> 44 /// <returns>true if decode was successful. false otherwise.</returns>
45 bool Decode(UUID assetID, byte[] j2kData); 45 bool Decode(UUID assetID, byte[] j2kData);
46
47 /// <summary>
48 /// Provides a synchronous decode so that caller can be assured that this executes before the next line
49 /// </summary>
50 /// <param name="assetID"></param>
51 /// <param name="j2kData"></param>
52 /// <param name="layers">layer data</param>
53 /// <param name="components">number of components</param>
54 /// <returns>true if decode was successful. false otherwise.</returns>
55 bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components);
46 } 56 }
47} 57}
diff --git a/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
index b224132..439096a 100644
--- a/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
@@ -34,6 +34,7 @@ using log4net;
34using Mono.Addins; 34using Mono.Addins;
35using Nini.Config; 35using Nini.Config;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.Imaging;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
39using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
@@ -137,9 +138,18 @@ namespace OpenSim.Region.OptionalModules.Agent.TextureSender
137 return; 138 return;
138 } 139 }
139 140
140 if (decoder.Decode(assetId, asset.Data)) 141 OpenJPEG.J2KLayerInfo[] layers;
141 MainConsole.Instance.OutputFormat("Successfully decoded asset {0}", assetId); 142 int components;
143 if (decoder.Decode(assetId, asset.Data, out layers, out components))
144 {
145 MainConsole.Instance.OutputFormat(
146 "Successfully decoded asset {0} with {1} layers and {2} components",
147 assetId, layers.Length, components);
148 }
142 else 149 else
143 MainConsole.Instance.OutputFormat("Decode of asset {0} failed", assetId); } 150 {
151 MainConsole.Instance.OutputFormat("Decode of asset {0} failed", assetId);
152 }
153 }
144 } 154 }
145} \ No newline at end of file 155} \ No newline at end of file