aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs74
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs14
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs12
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs12
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs29
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs11
7 files changed, 135 insertions, 37 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 913eb0c..2dce706 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -2136,7 +2136,25 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2136 Stream tgadata = new MemoryStream(ic.Asset.Data); 2136 Stream tgadata = new MemoryStream(ic.Asset.Data);
2137 2137
2138 temp = LoadTGAClass.LoadTGA(tgadata); 2138 temp = LoadTGAClass.LoadTGA(tgadata);
2139 ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true); 2139 try
2140 {
2141 ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true);
2142 }
2143 catch (DllNotFoundException)
2144 {
2145 Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", ic.Item.Name);
2146 ic.Asset.Data = new Byte[0];
2147 }
2148 catch (IndexOutOfRangeException)
2149 {
2150 Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", ic.Item.Name);
2151 ic.Asset.Data = new Byte[0];
2152 }
2153 catch (Exception)
2154 {
2155 Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", ic.Item.Name);
2156 ic.Asset.Data = new Byte[0];
2157 }
2140 } 2158 }
2141 2159
2142 ic.reset(); 2160 ic.reset();
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs
index 6b84880..dc46dc6 100644
--- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
49 /// Cached Decoded Layers 49 /// Cached Decoded Layers
50 /// </summary> 50 /// </summary>
51 private readonly Dictionary<UUID, OpenJPEG.J2KLayerInfo[]> m_cacheddecode = new Dictionary<UUID, OpenJPEG.J2KLayerInfo[]>(); 51 private readonly Dictionary<UUID, OpenJPEG.J2KLayerInfo[]> m_cacheddecode = new Dictionary<UUID, OpenJPEG.J2KLayerInfo[]>();
52 private bool OpenJpegFail = false;
52 53
53 /// <summary> 54 /// <summary>
54 /// List of client methods to notify of results of decode 55 /// List of client methods to notify of results of decode
@@ -147,49 +148,64 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
147 int DecodeTime = 0; 148 int DecodeTime = 0;
148 DecodeTime = System.Environment.TickCount; 149 DecodeTime = System.Environment.TickCount;
149 OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality 150 OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality
150 try
151 {
152 151
153 AssetTexture texture = new AssetTexture(AssetId, j2kdata); 152 if (!OpenJpegFail)
154 if (texture.DecodeLayerBoundaries()) 153 {
154 try
155 { 155 {
156 bool sane = true;
157 156
158 // Sanity check all of the layers 157 AssetTexture texture = new AssetTexture(AssetId, j2kdata);
159 for (int i = 0; i < texture.LayerInfo.Length; i++) 158 if (texture.DecodeLayerBoundaries())
160 { 159 {
161 if (texture.LayerInfo[i].End > texture.AssetData.Length) 160 bool sane = true;
161
162 // Sanity check all of the layers
163 for (int i = 0; i < texture.LayerInfo.Length; i++)
162 { 164 {
163 sane = false; 165 if (texture.LayerInfo[i].End > texture.AssetData.Length)
164 break; 166 {
167 sane = false;
168 break;
169 }
170 }
171
172 if (sane)
173 {
174 layers = texture.LayerInfo;
175 }
176 else
177 {
178 m_log.WarnFormat(
179 "[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}",
180 AssetId);
165 } 181 }
166 } 182 }
167 183
168 if (sane)
169 {
170 layers = texture.LayerInfo;
171 }
172 else 184 else
173 { 185 {
174 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}", 186 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}", AssetId);
175 AssetId);
176 } 187 }
188 texture = null; // dereference and dispose of ManagedImage
189 }
190 catch (DllNotFoundException)
191 {
192 m_log.Error(
193 "[J2KDecoderModule]: OpenJpeg is not installed properly. Decoding disabled! This will slow down texture performance! Often times this is because of an old version of GLIBC. You must have version 2.4 or above!");
194 OpenJpegFail = true;
195 }
196 catch (Exception ex)
197 {
198 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}",
199 AssetId, ex);
177 } 200 }
178
179 else
180 {
181 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}", AssetId);
182 }
183 texture = null; // dereference and dispose of ManagedImage
184 } 201 }
185 catch (Exception ex) 202
203 if (!OpenJpegFail)
186 { 204 {
187 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}", AssetId, ex); 205 // Write out decode time
206 m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", System.Environment.TickCount - DecodeTime,
207 AssetId);
188 } 208 }
189
190 // Write out decode time
191 m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", System.Environment.TickCount - DecodeTime, AssetId);
192
193 // Cache Decoded layers 209 // Cache Decoded layers
194 lock (m_cacheddecode) 210 lock (m_cacheddecode)
195 { 211 {
diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 59d29d6..e9fe373 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -275,7 +275,19 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
275 275
276 Bitmap joint = MergeBitMaps(image1, image2); 276 Bitmap joint = MergeBitMaps(image1, image2);
277 277
278 return OpenJPEG.EncodeFromImage(joint, true); 278 byte[] result = new byte[0];
279
280 try
281 {
282 result = OpenJPEG.EncodeFromImage(joint, true);
283 }
284 catch (Exception)
285 {
286 Console.WriteLine(
287 "[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Empty byte data returned!");
288 }
289
290 return result;
279 } 291 }
280 } 292 }
281 293
diff --git a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
index 631051b..eeeb3ca 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -168,7 +168,17 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
168 } 168 }
169 169
170 Bitmap resize = new Bitmap(image, newsize); 170 Bitmap resize = new Bitmap(image, newsize);
171 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 171 byte[] imageJ2000 = new byte[0];
172
173 try
174 {
175 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
176 }
177 catch (Exception)
178 {
179 Console.WriteLine(
180 "[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!");
181 }
172 182
173 m_textureManager.ReturnData(state.RequestID, imageJ2000); 183 m_textureManager.ReturnData(state.RequestID, imageJ2000);
174 } 184 }
diff --git a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
index f8a9879..ffbc262 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
@@ -169,7 +169,17 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
169 169
170 GDIDraw(data, graph); 170 GDIDraw(data, graph);
171 171
172 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); 172 byte[] imageJ2000 = new byte[0];
173
174 try
175 {
176 imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true);
177 }
178 catch (Exception)
179 {
180 Console.WriteLine(
181 "[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Empty byte data returned!");
182 }
173 m_textureManager.ReturnData(id, imageJ2000); 183 m_textureManager.ReturnData(id, imageJ2000);
174 } 184 }
175 185
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs
index c5efb4f..d66bbdb 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/TexturedMapTileRenderer.cs
@@ -170,10 +170,31 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
170 170
171 ManagedImage managedImage; 171 ManagedImage managedImage;
172 Image image; 172 Image image;
173 if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image)) 173
174 return new Bitmap(image); 174 try
175 else 175 {
176 return null; 176 if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
177 return new Bitmap(image);
178 else
179 return null;
180 }
181 catch (DllNotFoundException)
182 {
183 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", id);
184
185 }
186 catch (IndexOutOfRangeException)
187 {
188 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", id);
189
190 }
191 catch (Exception)
192 {
193 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", id);
194
195 }
196 return null;
197
177 } 198 }
178 199
179 // Compute the average color of a texture. 200 // Compute the average color of a texture.
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 92aae1a..72575e5 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -181,6 +181,17 @@ namespace OpenSim.Region.Physics.Meshing
181 { 181 {
182 ManagedImage managedImage; // we never use this 182 ManagedImage managedImage; // we never use this
183 OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata); 183 OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata);
184
185 }
186 catch (DllNotFoundException)
187 {
188 System.Console.WriteLine("[PHYSICS]: OpenJpeg is not installed correctly on this system. Physics Proxy generation failed. Often times this is because of an old version of GLIBC. You must have version 2.4 or above!");
189 return null;
190 }
191 catch (IndexOutOfRangeException)
192 {
193 System.Console.WriteLine("[PHYSICS]: OpenJpeg was unable to decode this. Physics Proxy generation failed");
194 return null;
184 } 195 }
185 catch (Exception) 196 catch (Exception)
186 { 197 {