From 4bf47fa592fd60716ffd6b34d418c241709c4744 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 30 Sep 2009 10:59:10 -0700 Subject: This releases the texture assets from LLImageManager cache, and re-requests them later if the client asks for them again. Needs more testing in texture-rich sims. --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 37 +++++++++++++++------- .../Region/ClientStack/LindenUDP/LLImageManager.cs | 23 +++++++++++++- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 6cffd70..b186720 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -60,14 +60,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP private sbyte m_discardLevel=-1; private uint m_packetNumber; private bool m_decoderequested = false; - private bool m_hasasset = false; + public bool m_hasasset = false; private bool m_asset_requested = false; private bool m_sentinfo = false; private uint m_stopPacket = 0; private const int cImagePacketSize = 1000; private const int cFirstPacketSize = 600; + private AssetBase m_asset = null; + private int m_assetDataLength = 0; + private LLImageManager m_image; + public J2KImage(LLImageManager image) { m_image = image; @@ -99,7 +103,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return 0; try { - return (ushort)(((m_asset.Data.Length - cFirstPacketSize + cImagePacketSize - 1) / cImagePacketSize) + 1); + return (ushort)(((m_assetDataLength - cFirstPacketSize + cImagePacketSize - 1) / cImagePacketSize) + 1); } catch (Exception) { @@ -110,6 +114,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void DropAsset() + { + m_log.WarnFormat("[LLIMAGE MANAGER]: Dropping texture asset {0}", m_requestedUUID); + m_asset = null; + m_hasasset = false; + m_asset_requested = false; + } + public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) { m_image.m_outstandingtextures++; @@ -127,8 +139,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - m_asset = asset; + m_asset = asset; } + + m_assetDataLength = m_asset.Data.Length; + RunUpdate(); } @@ -150,8 +165,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int LastPacketSize() { if (m_packetNumber == 1) - return m_asset.Data.Length; - int lastsize = (m_asset.Data.Length - cFirstPacketSize) % cImagePacketSize; + return m_assetDataLength; + int lastsize = (m_assetDataLength - cFirstPacketSize) % cImagePacketSize; //If the last packet size is zero, it's really cImagePacketSize, it sits on the boundary if (lastsize == 0) { @@ -185,10 +200,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } // Do we have less then 1 packet's worth of data? - else if (m_asset.Data.Length <= cFirstPacketSize) + else if (m_assetDataLength <= cFirstPacketSize) { // Send only 1 packet - client.SendImageFirstPart(1, m_requestedUUID, (uint)m_asset.Data.Length, m_asset.Data, 2); + client.SendImageFirstPart(1, m_requestedUUID, (uint)m_assetDataLength, m_asset.Data, 2); m_stopPacket = 0; return true; } @@ -198,7 +213,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)cFirstPacketSize); - client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_asset.Data.Length, firstImageData, 2); + client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_assetDataLength, firstImageData, 2); } catch (Exception) { @@ -216,13 +231,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { - if ((CurrentBytePosition() + cImagePacketSize) > m_asset.Data.Length) + if ((CurrentBytePosition() + cImagePacketSize) > m_assetDataLength) { imagePacketSize = LastPacketSize(); complete=true; - if ((CurrentBytePosition() + imagePacketSize) > m_asset.Data.Length) + if ((CurrentBytePosition() + imagePacketSize) > m_assetDataLength) { - imagePacketSize = m_asset.Data.Length - CurrentBytePosition(); + imagePacketSize = m_assetDataLength - CurrentBytePosition(); complete = true; } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 295a5e6..b039049 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -257,6 +257,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP J2KImage imagereq = m_imagestore[m_priorities.Values[x]]; if (imagereq.m_decoded == true && !imagereq.m_completedSendAtCurrentDiscardLevel) { + // we need to test this here now that we are dropping assets + if (!imagereq.m_hasasset) + { + m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID); + imagereq.RunUpdate(); + continue; + } + numCollected++; //SendPackets will send up to ten packets per cycle if (imagereq.SendPackets(m_client, maxpack)) @@ -264,8 +272,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP //Send complete if (!imagereq.m_completedSendAtCurrentDiscardLevel) { - imagereq.m_completedSendAtCurrentDiscardLevel = true; + // I think this field imagereq.m_completedSendAtCurrentDiscardLevel + // is completely redundant + //imagereq.m_completedSendAtCurrentDiscardLevel = true; + Interlocked.Decrement(ref m_outstandingtextures); + + // First and foremost, drop the reference to the asset + // so that the asset doesn't stay in memory forever. + // We'll Get it again from the asset service (usually cache) + // if/when the client requests it again. + // In order not to mess much with the current implementation + // of this management code, we drop only the asset reference + // but keep the image request itself. + imagereq.DropAsset(); + //Re-assign priority to bottom //Remove the old priority m_priorities.Remove(imagereq.m_designatedPriorityKey); -- cgit v1.1 From 22cc31135e2989df28e0756eb3b03f85530d5555 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 29 Sep 2009 18:15:22 -0700 Subject: Attempting to improve the robustness of texture decoding by always ignoring LayerInfo.End values and creating guessed default layer boundaries on failed decodes Changed a noisy J2K decode log message from Info to Debug Replacing openjpeg-dotnet decoding with managed CSJ2K decoding. Should be much more reliable, faster, and use less memory * Re-added openjpeg-dotnet files since they are used elsewhere in OpenSim * Updated prebuild.xml with a reference to CSJ2K --- .../Agent/TextureSender/J2KDecoderModule.cs | 236 ++++++--------------- bin/CSJ2K.dll | Bin 0 -> 544768 bytes prebuild.xml | 1 + 3 files changed, 69 insertions(+), 168 deletions(-) create mode 100644 bin/CSJ2K.dll diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 937f76b..aa29947 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -34,8 +34,8 @@ using System.Threading; using log4net; using Nini.Config; using OpenMetaverse; -using OpenMetaverse.Assets; using OpenMetaverse.Imaging; +using CSJ2K; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -195,174 +195,58 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { int DecodeTime = 0; DecodeTime = Environment.TickCount; - OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality + OpenJPEG.J2KLayerInfo[] layers = null; - if (!OpenJpegFail) + if (!fCache.TryLoadCacheForAsset(AssetId, out layers)) { - if (!fCache.TryLoadCacheForAsset(AssetId, out layers)) + try { - try + List layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kdata)); + + if (layerStarts != null && layerStarts.Count > 0) { + layers = new OpenJPEG.J2KLayerInfo[layerStarts.Count]; - AssetTexture texture = new AssetTexture(AssetId, j2kdata); - if (texture.DecodeLayerBoundaries()) + for (int i = 0; i < layerStarts.Count; i++) { - bool sane = true; - - // Sanity check all of the layers - for (int i = 0; i < texture.LayerInfo.Length; i++) - { - if (texture.LayerInfo[i].End > texture.AssetData.Length) - { - sane = false; - break; - } - } - - if (sane) - { - layers = texture.LayerInfo; - fCache.SaveFileCacheForAsset(AssetId, layers); - - - // Write out decode time - m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", Environment.TickCount - DecodeTime, - AssetId); - - } + OpenJPEG.J2KLayerInfo layer = new OpenJPEG.J2KLayerInfo(); + int start = layerStarts[i]; + + if (i == 0) + layer.Start = 0; else - { - m_log.WarnFormat( - "[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}", - AssetId); - } - } + layer.Start = layerStarts[i]; - else - { - /* - Random rnd = new Random(); - // scramble ends for test - for (int i = 0; i < texture.LayerInfo.Length; i++) - { - texture.LayerInfo[i].End = rnd.Next(999999); - } - */ - - // Try to do some heuristics error correction! Yeah. - bool sane2Heuristics = true; - - - if (texture.Image == null) - sane2Heuristics = false; - - if (texture.LayerInfo == null) - sane2Heuristics = false; - - if (sane2Heuristics) - { - - - if (texture.LayerInfo.Length == 0) - sane2Heuristics = false; - } - - if (sane2Heuristics) - { - // Last layer start is less then the end of the file and last layer start is greater then 0 - if (texture.LayerInfo[texture.LayerInfo.Length - 1].Start < texture.AssetData.Length && texture.LayerInfo[texture.LayerInfo.Length - 1].Start > 0) - { - } - else - { - sane2Heuristics = false; - } - - } - - if (sane2Heuristics) - { - int start = 0; - - // try to fix it by using consistant data in the start field - for (int i = 0; i < texture.LayerInfo.Length; i++) - { - if (i == 0) - start = 0; - - if (i == texture.LayerInfo.Length - 1) - texture.LayerInfo[i].End = texture.AssetData.Length; - else - texture.LayerInfo[i].End = texture.LayerInfo[i + 1].Start - 1; - - // in this case, the end of the next packet is less then the start of the last packet - // after we've attempted to fix it which means the start of the last packet is borked - // there's no recovery from this - if (texture.LayerInfo[i].End < start) - { - sane2Heuristics = false; - break; - } - - if (texture.LayerInfo[i].End < 0 || texture.LayerInfo[i].End > texture.AssetData.Length) - { - sane2Heuristics = false; - break; - } - - if (texture.LayerInfo[i].Start < 0 || texture.LayerInfo[i].Start > texture.AssetData.Length) - { - sane2Heuristics = false; - break; - } - - start = texture.LayerInfo[i].Start; - } - } - - if (sane2Heuristics) - { - layers = texture.LayerInfo; - fCache.SaveFileCacheForAsset(AssetId, layers); - - - // Write out decode time - m_log.InfoFormat("[J2KDecoderModule]: HEURISTICS SUCCEEDED {0} Decode Time: {1}", Environment.TickCount - DecodeTime, - AssetId); - - } + if (i == layerStarts.Count - 1) + layer.End = j2kdata.Length; else - { - m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}. Is this a texture? is it J2K?", AssetId); - } + layer.End = layerStarts[i + 1] - 1; + + layers[i] = layer; } - texture = null; // dereference and dispose of ManagedImage - } - catch (DllNotFoundException) - { - m_log.Error( - "[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!"); - OpenJpegFail = true; - } - catch (Exception ex) - { - m_log.WarnFormat( - "[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}", - AssetId, ex); } } - - } - - // Cache Decoded layers - lock (m_cacheddecode) - { - if (m_cacheddecode.ContainsKey(AssetId)) - m_cacheddecode.Remove(AssetId); - m_cacheddecode.Add(AssetId, layers); + catch (Exception ex) + { + m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + AssetId + ": " + ex.ToString()); + } - } + if (layers.Length == 0) + { + m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode any layer data for texture " + AssetId + ", guessing sane defaults"); + // Layer decoding completely failed. Guess at sane defaults for the layer boundaries + layers = CreateDefaultLayers(j2kdata.Length); + } + // Cache Decoded layers + lock (m_cacheddecode) + { + if (m_cacheddecode.ContainsKey(AssetId)) + m_cacheddecode.Remove(AssetId); + m_cacheddecode.Add(AssetId, layers); + } + } + // Notify Interested Parties lock (m_notifyList) { @@ -377,6 +261,31 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender } } } + + private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) + { + OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[5]; + layers[0] = new OpenJPEG.J2KLayerInfo(); + + for (int i = 0; i < layers.Length; i++) + { + OpenJPEG.J2KLayerInfo layer = new OpenJPEG.J2KLayerInfo(); + + if (i == 0) + layer.Start = 0; + else + layer.Start = layers[i - 1].End + 1; + + // These default layer sizes are based on a small sampling of real-world texture data + // with extra padding thrown in for good measure. This is a worst case fallback plan + // and will probably not gracefully handle all real world data + layer.End = (int)(160d * Math.Exp(1.3d * (double)(i + 1))); + + layers[i] = layer; + } + + return layers; + } private void CleanCache() { @@ -418,10 +327,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { m_cacheDecodeFolder = pFolder; m_cacheTimeout = timeout; + if (!Directory.Exists(pFolder)) - { Createj2KCacheFolder(pFolder); - } } /// @@ -447,14 +355,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd); } + fsSWCache.Write(stringResult.ToString()); fsSWCache.Close(); fsSWCache.Dispose(); fsCache.Dispose(); + return true; } - return false; } @@ -475,11 +384,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender return false; if (!enabled) - { return false; - } - string readResult = string.Empty; + string readResult = String.Empty; try { @@ -493,7 +400,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender sr.Close(); sr.Dispose(); fsCachefile.Dispose(); - } catch (IOException ioe) { @@ -514,7 +420,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender "[J2KDecodeCache]: Cache Read failed. IO Exception."); } return false; - } catch (UnauthorizedAccessException) { @@ -541,7 +446,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender m_log.Error( "[J2KDecodeCache]: Cache Read failed, not supported. Cache disabled!"); enabled = false; - return false; } catch (Exception e) @@ -581,7 +485,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender Layers[i] = new OpenJPEG.J2KLayerInfo(); Layers[i].Start = element1; Layers[i].End = element2; - } else { @@ -592,9 +495,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender } } - - - return true; } diff --git a/bin/CSJ2K.dll b/bin/CSJ2K.dll new file mode 100644 index 0000000..ff7e809 Binary files /dev/null and b/bin/CSJ2K.dll differ diff --git a/prebuild.xml b/prebuild.xml index 9498d7d..3cc9bab 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1503,6 +1503,7 @@ + -- cgit v1.1 From 41e4f3afdbdbb3685962043eb5e86834533bb36c Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Sep 2009 19:14:58 +0100 Subject: Remove some tests that no longer apply --- .../HttpServer/Tests/BaseRequestHandlerTests.cs | 70 ----------- .../Servers/Tests/GetAssetStreamHandlerTests.cs | 135 --------------------- .../Common/Setup/BaseRequestHandlerTestHelper.cs | 86 ------------- .../Setup/GetAssetStreamHandlerTestHelpers.cs | 122 ------------------- 4 files changed, 413 deletions(-) delete mode 100644 OpenSim/Framework/Servers/HttpServer/Tests/BaseRequestHandlerTests.cs delete mode 100644 OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs delete mode 100644 OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs delete mode 100644 OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs diff --git a/OpenSim/Framework/Servers/HttpServer/Tests/BaseRequestHandlerTests.cs b/OpenSim/Framework/Servers/HttpServer/Tests/BaseRequestHandlerTests.cs deleted file mode 100644 index 2fa118d..0000000 --- a/OpenSim/Framework/Servers/HttpServer/Tests/BaseRequestHandlerTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Text; -using NUnit.Framework; -using OpenSim.Tests.Common.Setup; - -namespace OpenSim.Framework.Servers.HttpServer.Tests -{ - [TestFixture] - public class BaseRequestHandlerTests - { - private const string BASE_PATH = "/testpath"; - - private class BaseRequestHandlerImpl : BaseRequestHandler - { - public BaseRequestHandlerImpl(string httpMethod, string path) : base(httpMethod, path) - { - } - } - - [Test] - public void TestConstructor() - { - new BaseRequestHandlerImpl(null, null); - } - - [Test] - public void TestGetParams() - { - BaseRequestHandlerImpl handler = new BaseRequestHandlerImpl(null, BASE_PATH); - - BaseRequestHandlerTestHelper.BaseTestGetParams(handler, BASE_PATH); - } - - [Test] - public void TestSplitParams() - { - BaseRequestHandlerImpl handler = new BaseRequestHandlerImpl(null, BASE_PATH); - - BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, BASE_PATH); - } - } -} diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs deleted file mode 100644 index be3f518..0000000 --- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Net; -using System.Text; -using HttpServer; -using NUnit.Framework; -using OpenSim.Data; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Tests.Common; -using OpenSim.Tests.Common.Mock; -using OpenSim.Tests.Common.Setup; - -namespace OpenSim.Framework.Servers.Tests -{ - [TestFixture] - public class GetAssetStreamHandlerTests - { - private const string ASSETS_PATH = "/assets"; - - [Test] - public void TestConstructor() - { - TestHelper.InMethod(); - - // GetAssetStreamHandler handler = - new GetAssetStreamHandler(null); - } - - [Test] - public void TestGetParams() - { - TestHelper.InMethod(); - - GetAssetStreamHandler handler = new GetAssetStreamHandler(null); - BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH); - } - - [Test] - public void TestSplitParams() - { - TestHelper.InMethod(); - - GetAssetStreamHandler handler = new GetAssetStreamHandler(null); - BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH); - } - - [Test] - public void TestHandleNoParams() - { - TestHelper.InMethod(); - - GetAssetStreamHandler handler = new GetAssetStreamHandler(null); - - BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH); - } - - [Test] - public void TestHandleMalformedGuid() - { - TestHelper.InMethod(); - - GetAssetStreamHandler handler = new GetAssetStreamHandler(null); - - BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH); - } - - [Test] - public void TestHandleFetchMissingAsset() - { - GetAssetStreamHandler handler; - OSHttpResponse response; - CreateTestEnvironment(out handler, out response); - - GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler, response); - } - - [Test] - public void TestHandleFetchExistingAssetData() - { - GetAssetStreamHandler handler; - OSHttpResponse response; - AssetBase asset = CreateTestEnvironment(out handler, out response); - - GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response); - } - - [Test] - public void TestHandleFetchExistingAssetXml() - { - GetAssetStreamHandler handler; - OSHttpResponse response; - AssetBase asset = CreateTestEnvironment(out handler, out response); - - GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetXmlTest(asset, handler, response); - } - - private static AssetBase CreateTestEnvironment(out GetAssetStreamHandler handler, out OSHttpResponse response) - { - AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response); - - IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin(); - handler = new GetAssetStreamHandler(assetDataPlugin); - - assetDataPlugin.StoreAsset(asset); - return asset; - } - } -} diff --git a/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs b/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs deleted file mode 100644 index e858371..0000000 --- a/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Text; -using NUnit.Framework; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Tests.Common.Mock; - -namespace OpenSim.Tests.Common.Setup -{ - public class BaseRequestHandlerTestHelper - { - private static string[] m_emptyStringArray = new string[] { }; - - public static void BaseTestGetParams(BaseRequestHandler handler, string assetsPath) - { - Assert.AreEqual(String.Empty, handler.GetParam(null), "Failed on null path."); - Assert.AreEqual(String.Empty, handler.GetParam(""), "Failed on empty path."); - Assert.AreEqual(String.Empty, handler.GetParam("s"), "Failed on short url."); - Assert.AreEqual(String.Empty, handler.GetParam("corruptUrl"), "Failed on corruptUrl."); - - Assert.AreEqual(String.Empty, handler.GetParam(assetsPath)); - Assert.AreEqual("/", handler.GetParam(assetsPath + "/")); - Assert.AreEqual("/a", handler.GetParam(assetsPath + "/a")); - Assert.AreEqual("/b/", handler.GetParam(assetsPath + "/b/")); - Assert.AreEqual("/c/d", handler.GetParam(assetsPath + "/c/d")); - Assert.AreEqual("/e/f/", handler.GetParam(assetsPath + "/e/f/")); - } - - public static void BaseTestSplitParams(BaseRequestHandler handler, string assetsPath) - { - Assert.AreEqual(m_emptyStringArray, handler.SplitParams(null), "Failed on null."); - Assert.AreEqual(m_emptyStringArray, handler.SplitParams(""), "Failed on empty path."); - Assert.AreEqual(m_emptyStringArray, handler.SplitParams("corruptUrl"), "Failed on corrupt url."); - - Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath), "Failed on empty params."); - Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath + "/"), "Failed on single slash."); - - Assert.AreEqual(new string[] { "a" }, handler.SplitParams(assetsPath + "/a"), "Failed on first segment."); - Assert.AreEqual(new string[] { "b" }, handler.SplitParams(assetsPath + "/b/"), "Failed on second slash."); - Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams(assetsPath + "/c/d"), "Failed on second segment."); - Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams(assetsPath + "/e/f/"), "Failed on trailing slash."); - } - - public static byte[] EmptyByteArray = new byte[] {}; - - public static void BaseTestHandleNoParams(BaseGetAssetStreamHandler handler, string assetsPath) - { - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath, null, null, null), "Failed on empty params."); - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/", null, null, null), "Failed on single slash."); - } - - public static void BaseTestHandleMalformedGuid(BaseGetAssetStreamHandler handler, string assetsPath) - { - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/badGuid", null, null, null), "Failed on bad guid."); - } - } -} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs b/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs deleted file mode 100644 index ffa7283..0000000 --- a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Text; -using System.Xml; -using System.Xml.Serialization; -using NUnit.Framework; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Server.Base; -using OpenSim.Tests.Common.Mock; - -namespace OpenSim.Tests.Common.Setup -{ - public class GetAssetStreamHandlerTestHelpers - { - private const string EXPECTED_CONTENT_TYPE = "application/x-metaverse-callingcard"; - - public static void BaseFetchExistingAssetXmlTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - byte[] expected = BaseGetAssetStreamHandler.GetXml(asset); - - byte[] actual = handler.Handle("/assets/" + asset.ID , null, null, response); - - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml without trailing slash."); - Assert.AreEqual(expected, actual, "Failed on fetching xml without trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - - actual = handler.Handle("/assets/" + asset.ID + "/", null, null, response); - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml with trailing slash."); - Assert.AreEqual(expected, actual, "Failed on fetching xml with trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - - actual = handler.Handle("/assets/" + asset.ID + "/badData", null, null, response); - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml with bad trailing data."); - Assert.AreEqual(expected, actual, "Failed on fetching xml with bad trailing trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - } - - public static void BaseFetchExistingAssetDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data", null, null, response), "Failed on fetching data without trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on first fetch."); - - Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data/", null, null, response), "Failed on fetching data with trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on second fetch."); - } - - public static void BaseFetchExistingAssetMetaDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - XmlSerializer xs = new XmlSerializer(typeof(AssetMetadata)); - - byte[] expected = ServerUtils.SerializeResult(xs, asset.Metadata); - - Assert.AreEqual(expected, handler.Handle("/assets/" + asset.ID + "/metadata", null, null, response), "Failed on fetching data without trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on first fetch."); - - Assert.AreEqual(expected, handler.Handle("/assets/" + asset.ID + "/metadata/", null, null, response), "Failed on fetching data with trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on second fetch."); - } - - public static AssetBase CreateCommonTestResources(out OSHttpResponse response) - { - AssetBase asset = CreateTestAsset(); - response = new TestOSHttpResponse(); - return asset; - } - - public static AssetBase CreateTestAsset() - { - byte[] expected = new byte[] { 1,2,3 }; - AssetBase asset = new AssetBase(); - asset.ID = Guid.NewGuid().ToString(); - asset.Data = expected; - asset.Type = 2; - - return asset; - } - - public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - Assert.AreEqual( - BaseRequestHandlerTestHelper.EmptyByteArray, - handler.Handle("/assets/" + Guid.NewGuid(), null, null, response), "Failed on bad guid."); - Assert.AreEqual((int)HttpStatusCode.NotFound, response.StatusCode, "Response code wrong in BaseFetchMissingAsset"); - } - } -} -- cgit v1.1 From c1706e9a685bc618e287acd5415e2b92c69d9da1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Sep 2009 19:20:57 +0100 Subject: Remove the dll for the removed tests --- prebuild.xml | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/prebuild.xml b/prebuild.xml index 3cc9bab..9dc417a 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3436,35 +3436,6 @@ - - - - ../../../../../bin/ - - - - - ../../../../../bin/ - - - - ../../../../../bin/ - - - - - - - - - - - - - - - - -- cgit v1.1 From 8d35cd90615b0048607375560edb56e4b39c4c12 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Sep 2009 19:25:48 +0100 Subject: Remove more tests that don't apply to this build --- .../Tests/Asset/AssetServerGetHandlerTests.cs | 80 ---------------------- prebuild.xml | 34 --------- 2 files changed, 114 deletions(-) delete mode 100644 OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs diff --git a/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs b/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs deleted file mode 100644 index 04a73e4..0000000 --- a/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using NUnit.Framework; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Server.Handlers.Asset; -using OpenSim.Services.Interfaces; -using OpenSim.Tests.Common; -using OpenSim.Tests.Common.Mock; -using OpenSim.Tests.Common.Setup; - -namespace OpenSim.Server.Handlers.Tests.Asset -{ - [TestFixture] - public class AssetServerGetHandlerTests - { - private const string ASSETS_PATH = "/assets"; - - [Test] - public void TestConstructor() - { - TestHelper.InMethod(); - - new AssetServerGetHandler(null); - } - - [Test] - public void TestGetParams() - { - TestHelper.InMethod(); - - AssetServerGetHandler handler = new AssetServerGetHandler(null); - BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH); - } - - [Test] - public void TestSplitParams() - { - TestHelper.InMethod(); - - AssetServerGetHandler handler = new AssetServerGetHandler(null); - BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH); - } - - // TODO: unused - // private static AssetBase CreateTestEnvironment(out AssetServerGetHandler handler, out OSHttpResponse response) - // { - // AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response); - // IAssetService assetDataPlugin = new TestAssetService(); - // handler = new AssetServerGetHandler(assetDataPlugin); - // assetDataPlugin.Store(asset); - // return asset; - // } - } -} diff --git a/prebuild.xml b/prebuild.xml index 9dc417a..70f5cfd 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3699,40 +3699,6 @@ - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - - - - -- cgit v1.1 From f908e32f620272a63c6a338fddfa3214ce95627b Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Sep 2009 19:26:26 +0100 Subject: Revert "Attempting to improve the robustness of texture decoding by always ignoring LayerInfo.End values and creating guessed default layer boundaries on failed decodes Changed a noisy J2K decode log message from Info to Debug" This reverts commit 22cc31135e2989df28e0756eb3b03f85530d5555. --- .../Agent/TextureSender/J2KDecoderModule.cs | 236 +++++++++++++++------ bin/CSJ2K.dll | Bin 544768 -> 0 bytes prebuild.xml | 1 - 3 files changed, 168 insertions(+), 69 deletions(-) delete mode 100644 bin/CSJ2K.dll diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index aa29947..937f76b 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -34,8 +34,8 @@ using System.Threading; using log4net; using Nini.Config; using OpenMetaverse; +using OpenMetaverse.Assets; using OpenMetaverse.Imaging; -using CSJ2K; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -195,58 +195,174 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { int DecodeTime = 0; DecodeTime = Environment.TickCount; - OpenJPEG.J2KLayerInfo[] layers = null; + OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality - if (!fCache.TryLoadCacheForAsset(AssetId, out layers)) + if (!OpenJpegFail) { - try + if (!fCache.TryLoadCacheForAsset(AssetId, out layers)) { - List layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kdata)); - - if (layerStarts != null && layerStarts.Count > 0) + try { - layers = new OpenJPEG.J2KLayerInfo[layerStarts.Count]; - for (int i = 0; i < layerStarts.Count; i++) + AssetTexture texture = new AssetTexture(AssetId, j2kdata); + if (texture.DecodeLayerBoundaries()) { - OpenJPEG.J2KLayerInfo layer = new OpenJPEG.J2KLayerInfo(); - int start = layerStarts[i]; - - if (i == 0) - layer.Start = 0; + bool sane = true; + + // Sanity check all of the layers + for (int i = 0; i < texture.LayerInfo.Length; i++) + { + if (texture.LayerInfo[i].End > texture.AssetData.Length) + { + sane = false; + break; + } + } + + if (sane) + { + layers = texture.LayerInfo; + fCache.SaveFileCacheForAsset(AssetId, layers); + + + // Write out decode time + m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", Environment.TickCount - DecodeTime, + AssetId); + + } else - layer.Start = layerStarts[i]; + { + m_log.WarnFormat( + "[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}", + AssetId); + } + } - if (i == layerStarts.Count - 1) - layer.End = j2kdata.Length; + else + { + /* + Random rnd = new Random(); + // scramble ends for test + for (int i = 0; i < texture.LayerInfo.Length; i++) + { + texture.LayerInfo[i].End = rnd.Next(999999); + } + */ + + // Try to do some heuristics error correction! Yeah. + bool sane2Heuristics = true; + + + if (texture.Image == null) + sane2Heuristics = false; + + if (texture.LayerInfo == null) + sane2Heuristics = false; + + if (sane2Heuristics) + { + + + if (texture.LayerInfo.Length == 0) + sane2Heuristics = false; + } + + if (sane2Heuristics) + { + // Last layer start is less then the end of the file and last layer start is greater then 0 + if (texture.LayerInfo[texture.LayerInfo.Length - 1].Start < texture.AssetData.Length && texture.LayerInfo[texture.LayerInfo.Length - 1].Start > 0) + { + } + else + { + sane2Heuristics = false; + } + + } + + if (sane2Heuristics) + { + int start = 0; + + // try to fix it by using consistant data in the start field + for (int i = 0; i < texture.LayerInfo.Length; i++) + { + if (i == 0) + start = 0; + + if (i == texture.LayerInfo.Length - 1) + texture.LayerInfo[i].End = texture.AssetData.Length; + else + texture.LayerInfo[i].End = texture.LayerInfo[i + 1].Start - 1; + + // in this case, the end of the next packet is less then the start of the last packet + // after we've attempted to fix it which means the start of the last packet is borked + // there's no recovery from this + if (texture.LayerInfo[i].End < start) + { + sane2Heuristics = false; + break; + } + + if (texture.LayerInfo[i].End < 0 || texture.LayerInfo[i].End > texture.AssetData.Length) + { + sane2Heuristics = false; + break; + } + + if (texture.LayerInfo[i].Start < 0 || texture.LayerInfo[i].Start > texture.AssetData.Length) + { + sane2Heuristics = false; + break; + } + + start = texture.LayerInfo[i].Start; + } + } + + if (sane2Heuristics) + { + layers = texture.LayerInfo; + fCache.SaveFileCacheForAsset(AssetId, layers); + + + // Write out decode time + m_log.InfoFormat("[J2KDecoderModule]: HEURISTICS SUCCEEDED {0} Decode Time: {1}", Environment.TickCount - DecodeTime, + AssetId); + + } else - layer.End = layerStarts[i + 1] - 1; - - layers[i] = layer; + { + m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}. Is this a texture? is it J2K?", AssetId); + } } + texture = null; // dereference and dispose of ManagedImage + } + catch (DllNotFoundException) + { + m_log.Error( + "[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!"); + OpenJpegFail = true; + } + catch (Exception ex) + { + m_log.WarnFormat( + "[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}", + AssetId, ex); } } - catch (Exception ex) - { - m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + AssetId + ": " + ex.ToString()); - } + + } - if (layers.Length == 0) - { - m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode any layer data for texture " + AssetId + ", guessing sane defaults"); - // Layer decoding completely failed. Guess at sane defaults for the layer boundaries - layers = CreateDefaultLayers(j2kdata.Length); - } + // Cache Decoded layers + lock (m_cacheddecode) + { + if (m_cacheddecode.ContainsKey(AssetId)) + m_cacheddecode.Remove(AssetId); + m_cacheddecode.Add(AssetId, layers); + + } - // Cache Decoded layers - lock (m_cacheddecode) - { - if (m_cacheddecode.ContainsKey(AssetId)) - m_cacheddecode.Remove(AssetId); - m_cacheddecode.Add(AssetId, layers); - } - } - // Notify Interested Parties lock (m_notifyList) { @@ -261,31 +377,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender } } } - - private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) - { - OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[5]; - layers[0] = new OpenJPEG.J2KLayerInfo(); - - for (int i = 0; i < layers.Length; i++) - { - OpenJPEG.J2KLayerInfo layer = new OpenJPEG.J2KLayerInfo(); - - if (i == 0) - layer.Start = 0; - else - layer.Start = layers[i - 1].End + 1; - - // These default layer sizes are based on a small sampling of real-world texture data - // with extra padding thrown in for good measure. This is a worst case fallback plan - // and will probably not gracefully handle all real world data - layer.End = (int)(160d * Math.Exp(1.3d * (double)(i + 1))); - - layers[i] = layer; - } - - return layers; - } private void CleanCache() { @@ -327,9 +418,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { m_cacheDecodeFolder = pFolder; m_cacheTimeout = timeout; - if (!Directory.Exists(pFolder)) + { Createj2KCacheFolder(pFolder); + } } /// @@ -355,15 +447,14 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd); } - fsSWCache.Write(stringResult.ToString()); fsSWCache.Close(); fsSWCache.Dispose(); fsCache.Dispose(); - return true; } + return false; } @@ -384,9 +475,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender return false; if (!enabled) + { return false; + } - string readResult = String.Empty; + string readResult = string.Empty; try { @@ -400,6 +493,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender sr.Close(); sr.Dispose(); fsCachefile.Dispose(); + } catch (IOException ioe) { @@ -420,6 +514,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender "[J2KDecodeCache]: Cache Read failed. IO Exception."); } return false; + } catch (UnauthorizedAccessException) { @@ -446,6 +541,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender m_log.Error( "[J2KDecodeCache]: Cache Read failed, not supported. Cache disabled!"); enabled = false; + return false; } catch (Exception e) @@ -485,6 +581,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender Layers[i] = new OpenJPEG.J2KLayerInfo(); Layers[i].Start = element1; Layers[i].End = element2; + } else { @@ -495,6 +592,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender } } + + + return true; } diff --git a/bin/CSJ2K.dll b/bin/CSJ2K.dll deleted file mode 100644 index ff7e809..0000000 Binary files a/bin/CSJ2K.dll and /dev/null differ diff --git a/prebuild.xml b/prebuild.xml index 70f5cfd..d049b5d 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1503,7 +1503,6 @@ - -- cgit v1.1 From f56dc5fcda16d96a309120b2a75a623cf455a8e8 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 30 Sep 2009 12:18:22 -0700 Subject: Attempting to improve the robustness of texture decoding by always ignoring LayerInfo.End values and creating guessed default layer boundaries on failed decodes Changed a noisy J2K decode log message from Info to Debug Replacing openjpeg-dotnet decoding with managed CSJ2K decoding. Should be much more reliable, faster, and use less memory * Re-added openjpeg-dotnet files since they are used elsewhere in OpenSim * Updated prebuild.xml with a reference to CSJ2K * Renamed IJ2KDecoder and J2KDecoder member names to follow standard naming conventions * Removed j2kDecodeCache cruft and replaced it with the OpenSim cache system * Rewrote the default layer boundary algorithm to use percentages instead of an exponent * Switched from an infinite in-memory cache to an expiring cache (10 minute timeout) * Slightly quieted logging errors for failed texture decodes --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 2 +- .../Agent/TextureSender/J2KDecoderModule.cs | 688 +++++---------------- .../DynamicTexture/DynamicTextureModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs | 5 +- OpenSim/Region/Framework/Scenes/SceneManager.cs | 2 +- bin/CSJ2K.dll | Bin 0 -> 544768 bytes prebuild.xml | 1 + 7 files changed, 166 insertions(+), 534 deletions(-) create mode 100644 bin/CSJ2K.dll diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index b186720..45286be 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -351,7 +351,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP J2KDecodedCallback(m_requestedUUID, new OpenJPEG.J2KLayerInfo[0]); } // Send it off to the jpeg decoder - m_j2kDecodeModule.decode(m_requestedUUID, Data, J2KDecodedCallback); + m_j2kDecodeModule.BeginDecode(m_requestedUUID, Data, J2KDecodedCallback); } else diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 937f76b..49f7f48 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -34,8 +34,8 @@ using System.Threading; using log4net; using Nini.Config; using OpenMetaverse; -using OpenMetaverse.Assets; using OpenMetaverse.Imaging; +using CSJ2K; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -43,31 +43,25 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Agent.TextureSender { - public delegate void J2KDecodeDelegate(UUID AssetId); + public delegate void J2KDecodeDelegate(UUID assetID); public class J2KDecoderModule : IRegionModule, IJ2KDecoder { - #region IRegionModule Members + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// Temporarily holds deserialized layer data information in memory + private readonly ExpiringCache m_decodedCache = new ExpiringCache(); + /// List of client methods to notify of results of decode + private readonly Dictionary> m_notifyList = new Dictionary>(); + /// Cache that will store decoded JPEG2000 layer boundary data + private IImprovedAssetCache m_cache; + /// Reference to a scene (doesn't matter which one as long as it can load the cache module) + private Scene m_scene; - /// - /// Cached Decoded Layers - /// - private readonly Dictionary m_cacheddecode = new Dictionary(); - private bool OpenJpegFail = false; - private string CacheFolder = Util.dataDir() + "/j2kDecodeCache"; - private int CacheTimeout = 720; - private J2KDecodeFileCache fCache = null; - private Thread CleanerThread = null; - private IAssetService AssetService = null; - private Scene m_Scene = null; + #region IRegionModule - /// - /// List of client methods to notify of results of decode - /// - private readonly Dictionary> m_notifyList = new Dictionary>(); + public string Name { get { return "J2KDecoderModule"; } } + public bool IsSharedModule { get { return true; } } public J2KDecoderModule() { @@ -75,630 +69,268 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender public void Initialise(Scene scene, IConfigSource source) { - if (m_Scene == null) - m_Scene = scene; - - IConfig j2kConfig = source.Configs["J2KDecoder"]; - if (j2kConfig != null) - { - CacheFolder = j2kConfig.GetString("CacheDir", CacheFolder); - CacheTimeout = j2kConfig.GetInt("CacheTimeout", CacheTimeout); - } - - if (fCache == null) - fCache = new J2KDecodeFileCache(CacheFolder, CacheTimeout); + if (m_scene == null) + m_scene = scene; scene.RegisterModuleInterface(this); - - if (CleanerThread == null && CacheTimeout != 0) - { - CleanerThread = new Thread(CleanCache); - CleanerThread.Name = "J2KCleanerThread"; - CleanerThread.IsBackground = true; - CleanerThread.Start(); - } } public void PostInitialise() { - AssetService = m_Scene.AssetService; + m_cache = m_scene.RequestModuleInterface(); } public void Close() { - - } - - public string Name - { - get { return "J2KDecoderModule"; } - } - - public bool IsSharedModule - { - get { return true; } } - #endregion + #endregion IRegionModule - #region IJ2KDecoder Members + #region IJ2KDecoder - - public void decode(UUID AssetId, byte[] assetData, DecodedCallback decodedReturn) + public void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback) { - // Dummy for if decoding fails. - OpenJPEG.J2KLayerInfo[] result = new OpenJPEG.J2KLayerInfo[0]; - - // Check if it's cached - bool cached = false; - lock (m_cacheddecode) - { - if (m_cacheddecode.ContainsKey(AssetId)) - { - cached = true; - result = m_cacheddecode[AssetId]; - } - } + OpenJPEG.J2KLayerInfo[] result; // If it's cached, return the cached results - if (cached) + if (m_decodedCache.TryGetValue(assetID, out result)) { - decodedReturn(AssetId, result); + callback(assetID, result); } else { - // not cached, so we need to decode it + // Not cached, we need to decode it. // Add to notify list and start decoding. // Next request for this asset while it's decoding will only be added to the notify list // once this is decoded, requests will be served from the cache and all clients in the notifylist will be updated bool decode = false; lock (m_notifyList) { - if (m_notifyList.ContainsKey(AssetId)) + if (m_notifyList.ContainsKey(assetID)) { - m_notifyList[AssetId].Add(decodedReturn); + m_notifyList[assetID].Add(callback); } else { List notifylist = new List(); - notifylist.Add(decodedReturn); - m_notifyList.Add(AssetId, notifylist); + notifylist.Add(callback); + m_notifyList.Add(assetID, notifylist); decode = true; } } + // Do Decode! if (decode) - { - doJ2kDecode(AssetId, assetData); - } + DoJ2KDecode(assetID, j2kData); } } /// /// Provides a synchronous decode so that caller can be assured that this executes before the next line /// - /// - /// - public void syncdecode(UUID AssetId, byte[] j2kdata) + /// + /// + public void Decode(UUID assetID, byte[] j2kData) { - doJ2kDecode(AssetId, j2kdata); + DoJ2KDecode(assetID, j2kData); } - #endregion + #endregion IJ2KDecoder /// /// Decode Jpeg2000 Asset Data /// - /// UUID of Asset - /// Byte Array Asset Data - private void doJ2kDecode(UUID AssetId, byte[] j2kdata) + /// UUID of Asset + /// JPEG2000 data + private void DoJ2KDecode(UUID assetID, byte[] j2kData) { int DecodeTime = 0; DecodeTime = Environment.TickCount; - OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality + OpenJPEG.J2KLayerInfo[] layers; - if (!OpenJpegFail) + if (!TryLoadCacheForAsset(assetID, out layers)) { - if (!fCache.TryLoadCacheForAsset(AssetId, out layers)) + try { - try + List layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kData)); + + if (layerStarts != null && layerStarts.Count > 0) { + layers = new OpenJPEG.J2KLayerInfo[layerStarts.Count]; - AssetTexture texture = new AssetTexture(AssetId, j2kdata); - if (texture.DecodeLayerBoundaries()) + for (int i = 0; i < layerStarts.Count; i++) { - bool sane = true; - - // Sanity check all of the layers - for (int i = 0; i < texture.LayerInfo.Length; i++) - { - if (texture.LayerInfo[i].End > texture.AssetData.Length) - { - sane = false; - break; - } - } + OpenJPEG.J2KLayerInfo layer = new OpenJPEG.J2KLayerInfo(); + int start = layerStarts[i]; - if (sane) - { - layers = texture.LayerInfo; - fCache.SaveFileCacheForAsset(AssetId, layers); - - - // Write out decode time - m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", Environment.TickCount - DecodeTime, - AssetId); - - } + if (i == 0) + layer.Start = 0; else - { - m_log.WarnFormat( - "[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}", - AssetId); - } - } + layer.Start = layerStarts[i]; - else - { - /* - Random rnd = new Random(); - // scramble ends for test - for (int i = 0; i < texture.LayerInfo.Length; i++) - { - texture.LayerInfo[i].End = rnd.Next(999999); - } - */ - - // Try to do some heuristics error correction! Yeah. - bool sane2Heuristics = true; - - - if (texture.Image == null) - sane2Heuristics = false; - - if (texture.LayerInfo == null) - sane2Heuristics = false; - - if (sane2Heuristics) - { - - - if (texture.LayerInfo.Length == 0) - sane2Heuristics = false; - } - - if (sane2Heuristics) - { - // Last layer start is less then the end of the file and last layer start is greater then 0 - if (texture.LayerInfo[texture.LayerInfo.Length - 1].Start < texture.AssetData.Length && texture.LayerInfo[texture.LayerInfo.Length - 1].Start > 0) - { - } - else - { - sane2Heuristics = false; - } - - } - - if (sane2Heuristics) - { - int start = 0; - - // try to fix it by using consistant data in the start field - for (int i = 0; i < texture.LayerInfo.Length; i++) - { - if (i == 0) - start = 0; - - if (i == texture.LayerInfo.Length - 1) - texture.LayerInfo[i].End = texture.AssetData.Length; - else - texture.LayerInfo[i].End = texture.LayerInfo[i + 1].Start - 1; - - // in this case, the end of the next packet is less then the start of the last packet - // after we've attempted to fix it which means the start of the last packet is borked - // there's no recovery from this - if (texture.LayerInfo[i].End < start) - { - sane2Heuristics = false; - break; - } - - if (texture.LayerInfo[i].End < 0 || texture.LayerInfo[i].End > texture.AssetData.Length) - { - sane2Heuristics = false; - break; - } - - if (texture.LayerInfo[i].Start < 0 || texture.LayerInfo[i].Start > texture.AssetData.Length) - { - sane2Heuristics = false; - break; - } - - start = texture.LayerInfo[i].Start; - } - } - - if (sane2Heuristics) - { - layers = texture.LayerInfo; - fCache.SaveFileCacheForAsset(AssetId, layers); - - - // Write out decode time - m_log.InfoFormat("[J2KDecoderModule]: HEURISTICS SUCCEEDED {0} Decode Time: {1}", Environment.TickCount - DecodeTime, - AssetId); - - } + if (i == layerStarts.Count - 1) + layer.End = j2kData.Length; else - { - m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}. Is this a texture? is it J2K?", AssetId); - } + layer.End = layerStarts[i + 1] - 1; + + layers[i] = layer; } - texture = null; // dereference and dispose of ManagedImage - } - catch (DllNotFoundException) - { - m_log.Error( - "[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!"); - OpenJpegFail = true; - } - catch (Exception ex) - { - m_log.WarnFormat( - "[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}", - AssetId, ex); } } - - } - - // Cache Decoded layers - lock (m_cacheddecode) - { - if (m_cacheddecode.ContainsKey(AssetId)) - m_cacheddecode.Remove(AssetId); - m_cacheddecode.Add(AssetId, layers); + catch (Exception ex) + { + m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message); + } - } + if (layers == null || layers.Length == 0) + { + m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults"); + // Layer decoding completely failed. Guess at sane defaults for the layer boundaries + layers = CreateDefaultLayers(j2kData.Length); + } + // Cache Decoded layers + SaveFileCacheForAsset(assetID, layers); + } + // Notify Interested Parties lock (m_notifyList) { - if (m_notifyList.ContainsKey(AssetId)) + if (m_notifyList.ContainsKey(assetID)) { - foreach (DecodedCallback d in m_notifyList[AssetId]) + foreach (DecodedCallback d in m_notifyList[assetID]) { if (d != null) - d.DynamicInvoke(AssetId, layers); + d.DynamicInvoke(assetID, layers); } - m_notifyList.Remove(AssetId); + m_notifyList.Remove(assetID); } } } - - private void CleanCache() - { - m_log.Info("[J2KDecoderModule]: Cleaner thread started"); - - while (true) - { - if (AssetService != null) - fCache.ScanCacheFiles(RedecodeTexture); - System.Threading.Thread.Sleep(600000); - } - } - - private void RedecodeTexture(UUID assetID) + private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) { - AssetBase texture = AssetService.Get(assetID.ToString()); - if (texture == null) - return; - - doJ2kDecode(assetID, texture.Data); + OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[5]; + + for (int i = 0; i < layers.Length; i++) + layers[i] = new OpenJPEG.J2KLayerInfo(); + + // These default layer sizes are based on a small sampling of real-world texture data + // with extra padding thrown in for good measure. This is a worst case fallback plan + // and may not gracefully handle all real world data + layers[0].Start = 0; + layers[1].Start = (int)((float)j2kLength * 0.02f); + layers[2].Start = (int)((float)j2kLength * 0.05f); + layers[3].Start = (int)((float)j2kLength * 0.20f); + layers[4].Start = (int)((float)j2kLength * 0.50f); + + layers[0].End = layers[1].Start - 1; + layers[1].End = layers[2].Start - 1; + layers[2].End = layers[3].Start - 1; + layers[3].End = layers[4].Start - 1; + layers[4].End = j2kLength; + + return layers; } - } - public class J2KDecodeFileCache - { - private readonly string m_cacheDecodeFolder; - private readonly int m_cacheTimeout; - private bool enabled = true; - - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// Creates a new instance of a file cache - /// - /// base folder for the cache. Will be created if it doesn't exist - public J2KDecodeFileCache(string pFolder, int timeout) + private void SaveFileCacheForAsset(UUID AssetId, OpenJPEG.J2KLayerInfo[] Layers) { - m_cacheDecodeFolder = pFolder; - m_cacheTimeout = timeout; - if (!Directory.Exists(pFolder)) - { - Createj2KCacheFolder(pFolder); - } - } + m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10)); - /// - /// Save Layers to Disk Cache - /// - /// Asset to Save the layers. Used int he file name by default - /// The Layer Data from OpenJpeg - /// - public bool SaveFileCacheForAsset(UUID AssetId, OpenJPEG.J2KLayerInfo[] Layers) - { - if (Layers.Length > 0 && enabled) + if (m_cache != null) { - FileStream fsCache = - new FileStream(String.Format("{0}/{1}", m_cacheDecodeFolder, FileNameFromAssetId(AssetId)), - FileMode.Create); - StreamWriter fsSWCache = new StreamWriter(fsCache); + AssetBase layerDecodeAsset = new AssetBase(); + layerDecodeAsset.ID = "j2kCache_" + AssetId.ToString(); + layerDecodeAsset.Local = true; + layerDecodeAsset.Name = layerDecodeAsset.ID; + layerDecodeAsset.Temporary = true; + layerDecodeAsset.Type = (sbyte)AssetType.Notecard; + + #region Serialize Layer Data + StringBuilder stringResult = new StringBuilder(); string strEnd = "\n"; for (int i = 0; i < Layers.Length; i++) { - if (i == (Layers.Length - 1)) - strEnd = ""; + if (i == Layers.Length - 1) + strEnd = String.Empty; stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd); } - fsSWCache.Write(stringResult.ToString()); - fsSWCache.Close(); - fsSWCache.Dispose(); - fsCache.Dispose(); - return true; - } - - return false; - } + layerDecodeAsset.Data = Encoding.UTF8.GetBytes(stringResult.ToString()); - - /// - /// Loads the Layer data from the disk cache - /// Returns true if load succeeded - /// - /// AssetId that we're checking the cache for - /// out layers to save to - /// true if load succeeded - public bool TryLoadCacheForAsset(UUID AssetId, out OpenJPEG.J2KLayerInfo[] Layers) - { - string filename = String.Format("{0}/{1}", m_cacheDecodeFolder, FileNameFromAssetId(AssetId)); - Layers = new OpenJPEG.J2KLayerInfo[0]; + #endregion Serialize Layer Data - if (!File.Exists(filename)) - return false; - - if (!enabled) - { - return false; + m_cache.Cache(layerDecodeAsset); } + } - string readResult = string.Empty; - - try + bool TryLoadCacheForAsset(UUID AssetId, out OpenJPEG.J2KLayerInfo[] Layers) + { + if (m_decodedCache.TryGetValue(AssetId, out Layers)) { - FileStream fsCachefile = - new FileStream(filename, - FileMode.Open); - - StreamReader sr = new StreamReader(fsCachefile); - readResult = sr.ReadToEnd(); - - sr.Close(); - sr.Dispose(); - fsCachefile.Dispose(); - + return true; } - catch (IOException ioe) + else if (m_cache != null) { - if (ioe is PathTooLongException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Read failed. Path is too long."); - } - else if (ioe is DirectoryNotFoundException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Read failed. Cache Directory does not exist!"); - enabled = false; - } - else - { - m_log.Error( - "[J2KDecodeCache]: Cache Read failed. IO Exception."); - } - return false; + string assetName = "j2kCache_" + AssetId.ToString(); + AssetBase layerDecodeAsset = m_cache.Get(assetName); - } - catch (UnauthorizedAccessException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Read failed. UnauthorizedAccessException Exception. Do you have the proper permissions on this file?"); - return false; - } - catch (ArgumentException ae) - { - if (ae is ArgumentNullException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Read failed. No Filename provided"); - } - else + if (layerDecodeAsset != null) { - m_log.Error( - "[J2KDecodeCache]: Cache Read failed. Filname was invalid"); - } - return false; - } - catch (NotSupportedException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Read failed, not supported. Cache disabled!"); - enabled = false; + #region Deserialize Layer Data - return false; - } - catch (Exception e) - { - m_log.ErrorFormat( - "[J2KDecodeCache]: Cache Read failed, unknown exception. Error: {0}", - e.ToString()); - return false; - } - - string[] lines = readResult.Split('\n'); + string readResult = Encoding.UTF8.GetString(layerDecodeAsset.Data); + string[] lines = readResult.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); - if (lines.Length <= 0) - return false; - - Layers = new OpenJPEG.J2KLayerInfo[lines.Length]; - - for (int i = 0; i < lines.Length; i++) - { - string[] elements = lines[i].Split('|'); - if (elements.Length == 3) - { - int element1, element2; - - try - { - element1 = Convert.ToInt32(elements[0]); - element2 = Convert.ToInt32(elements[1]); - } - catch (FormatException) + if (lines.Length == 0) { - m_log.WarnFormat("[J2KDecodeCache]: Cache Read failed with ErrorConvert for {0}", AssetId); - Layers = new OpenJPEG.J2KLayerInfo[0]; + m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName); + m_cache.Expire(assetName); return false; } - Layers[i] = new OpenJPEG.J2KLayerInfo(); - Layers[i].Start = element1; - Layers[i].End = element2; - - } - else - { - // reading failed - m_log.WarnFormat("[J2KDecodeCache]: Cache Read failed for {0}", AssetId); - Layers = new OpenJPEG.J2KLayerInfo[0]; - return false; - } - } - - - - - return true; - } + Layers = new OpenJPEG.J2KLayerInfo[lines.Length]; - /// - /// Routine which converts assetid to file name - /// - /// asset id of the image - /// string filename - public string FileNameFromAssetId(UUID AssetId) - { - return String.Format("j2kCache_{0}.cache", AssetId); - } + for (int i = 0; i < lines.Length; i++) + { + string[] elements = lines[i].Split('|'); + if (elements.Length == 3) + { + int element1, element2; - public UUID AssetIdFromFileName(string fileName) - { - string rawId = fileName.Replace("j2kCache_", "").Replace(".cache", ""); - UUID asset; - if (!UUID.TryParse(rawId, out asset)) - return UUID.Zero; + try + { + element1 = Convert.ToInt32(elements[0]); + element2 = Convert.ToInt32(elements[1]); + } + catch (FormatException) + { + m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName); + m_cache.Expire(assetName); + return false; + } - return asset; - } + Layers[i] = new OpenJPEG.J2KLayerInfo(); + Layers[i].Start = element1; + Layers[i].End = element2; + } + else + { + m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName); + m_cache.Expire(assetName); + return false; + } + } - /// - /// Creates the Cache Folder - /// - /// Folder to Create - public void Createj2KCacheFolder(string pFolder) - { - try - { - Directory.CreateDirectory(pFolder); - } - catch (IOException ioe) - { - if (ioe is PathTooLongException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Directory does not exist and create failed because the path to the cache folder is too long. Cache disabled!"); - } - else if (ioe is DirectoryNotFoundException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Directory does not exist and create failed because the supplied base of the directory folder does not exist. Cache disabled!"); - } - else - { - m_log.Error( - "[J2KDecodeCache]: Cache Directory does not exist and create failed because of an IO Exception. Cache disabled!"); - } - enabled = false; + #endregion Deserialize Layer Data - } - catch (UnauthorizedAccessException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Directory does not exist and create failed because of an UnauthorizedAccessException Exception. Cache disabled!"); - enabled = false; - } - catch (ArgumentException ae) - { - if (ae is ArgumentNullException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Directory does not exist and create failed because the folder provided is invalid! Cache disabled!"); + return true; } - else - { - m_log.Error( - "[J2KDecodeCache]: Cache Directory does not exist and create failed because no cache folder was provided! Cache disabled!"); - } - enabled = false; } - catch (NotSupportedException) - { - m_log.Error( - "[J2KDecodeCache]: Cache Directory does not exist and create failed because it's not supported. Cache disabled!"); - enabled = false; - } - catch (Exception e) - { - m_log.ErrorFormat( - "[J2KDecodeCache]: Cache Directory does not exist and create failed because of an unknown exception. Cache disabled! Error: {0}", - e.ToString()); - enabled = false; - } - } - - public void ScanCacheFiles(J2KDecodeDelegate decode) - { - DirectoryInfo dir = new DirectoryInfo(m_cacheDecodeFolder); - FileInfo[] files = dir.GetFiles("j2kCache_*.cache"); - foreach (FileInfo f in files) - { - TimeSpan fileAge = DateTime.Now - f.CreationTime; - - if (m_cacheTimeout != 0 && fileAge >= TimeSpan.FromMinutes(m_cacheTimeout)) - { - File.Delete(f.Name); - decode(AssetIdFromFileName(f.Name)); - System.Threading.Thread.Sleep(5000); - } - } + return false; } } } diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 14eb9a2..9a6c49a 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface(); if (cacheLayerDecode != null) { - cacheLayerDecode.syncdecode(asset.FullID, asset.Data); + cacheLayerDecode.Decode(asset.FullID, asset.Data); cacheLayerDecode = null; LastAssetID = asset.FullID; } diff --git a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs index b153997..856eb11 100644 --- a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs +++ b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs @@ -30,12 +30,11 @@ using OpenMetaverse.Imaging; namespace OpenSim.Region.Framework.Interfaces { - public delegate void DecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers); public interface IJ2KDecoder { - void decode(UUID AssetId, byte[] assetData, DecodedCallback decodedReturn); - void syncdecode(UUID AssetId, byte[] j2kdata); + void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback); + void Decode(UUID assetID, byte[] j2kData); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 0019b23..091a2d5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -652,7 +652,7 @@ namespace OpenSim.Region.Framework.Scenes AssetBase ab = sn.AssetService.Get(arrassets[i].ToString()); if (ab != null && ab.Data != null) { - j2kdecode.syncdecode(arrassets[i], ab.Data); + j2kdecode.Decode(arrassets[i], ab.Data); } } ThreadTracker.Remove(thisthread); diff --git a/bin/CSJ2K.dll b/bin/CSJ2K.dll new file mode 100644 index 0000000..ff7e809 Binary files /dev/null and b/bin/CSJ2K.dll differ diff --git a/prebuild.xml b/prebuild.xml index d049b5d..70f5cfd 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1503,6 +1503,7 @@ + -- cgit v1.1 From b0c0d6f9d1ebba91a45722e6f8286e81c1eed414 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Sep 2009 20:35:22 +0100 Subject: Squelch the debug noise from diva's patch --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 45286be..06dd28d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -116,7 +116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void DropAsset() { - m_log.WarnFormat("[LLIMAGE MANAGER]: Dropping texture asset {0}", m_requestedUUID); + //m_log.WarnFormat("[LLIMAGE MANAGER]: Dropping texture asset {0}", m_requestedUUID); m_asset = null; m_hasasset = false; m_asset_requested = false; -- cgit v1.1 From d0bf084da5bad6f7e07e78c6ad5758860c44be21 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Sep 2009 20:34:42 +0100 Subject: Remove the settings for the J2KDecoder, since they are now obsolete (thank god!) --- bin/OpenSim.ini.example | 9 --------- 1 file changed, 9 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index d38c511..2be8c06 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -1369,15 +1369,6 @@ ; ;TextureDataLimit = 5 -;; The JPEG2000 decode cache -;; Timeout is in minutes - -[J2KDecoder] -;CacheDir = "./j2kDecodeCache" -; Time in minutes before cached decodes expire. Set to 0 for no expiration. Default is 720 minutes. - -;CacheTimeout = 720 - ;; ;; These are defaults that are overwritten below in [Architecture]. ;; These defaults allow OpenSim to work out of the box with -- cgit v1.1 From 67fefdb5a0eafc5fe899b990b096d1d70ce9d4a8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Sep 2009 20:52:10 +0100 Subject: Remove predecode-j2k and it's assoaciated logic --- OpenSim/Region/Application/OpenSim.cs | 20 ---- OpenSim/Region/Framework/Scenes/SceneManager.cs | 122 ------------------------ 2 files changed, 142 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 10071a0..b23cdc3 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -306,10 +306,6 @@ namespace OpenSim "delete-region ", "Delete a region from disk", RunCommand); - m_console.Commands.AddCommand("region", false, "predecode-j2k", - "predecode-j2k []>", - "Precache assets,decode j2k layerdata", RunCommand); - m_console.Commands.AddCommand("region", false, "modules list", "modules list", "List modules", HandleModules); @@ -744,22 +740,6 @@ namespace OpenSim } break; - case "predecode-j2k": - if (cmdparams.Length > 0) - { - m_sceneManager.CacheJ2kDecode(Convert.ToInt32(cmdparams[0])); - } - else - { - m_sceneManager.CacheJ2kDecode(1); - } - break; - - case "link-region": - case "unlink-region": - case "link-mapping": - HGCommands.RunHGCommand(command, cmdparams, m_sceneManager.CurrentOrFirstScene); - break; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 091a2d5..1843e2c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -540,127 +540,5 @@ namespace OpenSim.Region.Framework.Scenes { m_localScenes.ForEach(action); } - - public void CacheJ2kDecode(int threads) - { - if (threads < 1) threads = 1; - - IJ2KDecoder m_decoder = m_localScenes[0].RequestModuleInterface(); - - List assetRequestList = new List(); - - #region AssetGathering! - foreach (Scene scene in m_localScenes) - { - List entitles = scene.GetEntities(); - foreach (EntityBase entity in entitles) - { - if (entity is SceneObjectGroup) - { - SceneObjectGroup sog = (SceneObjectGroup) entity; - foreach (SceneObjectPart part in sog.Children.Values) - { - if (part.Shape != null) - { - if (part.Shape.TextureEntry.Length > 0) - { - OpenMetaverse.Primitive.TextureEntry te = - new Primitive.TextureEntry(part.Shape.TextureEntry, 0, - part.Shape.TextureEntry.Length); - if (te.DefaultTexture != null) // this has been null for some reason... - { - if (te.DefaultTexture.TextureID != UUID.Zero) - assetRequestList.Add(te.DefaultTexture.TextureID); - } - for (int i=0; i arrvalus = new List(); - - //split into separate arrays - for (int j = 0; j < threads; j++) - { - List val = new List(); - - for (int k = j * entries_per_thread; k < ((j + 1) * entries_per_thread); k++) - { - if (k < arrAssetRequestList.Length) - { - val.Add(arrAssetRequestList[k]); - } - - } - arrvalus.Add(val.ToArray()); - } - - for (int l = 0; l < arrvalus.Count; l++) - { - DecodeThreadContents threadworkItem = new DecodeThreadContents(); - threadworkItem.sn = m_localScenes[0]; - threadworkItem.j2kdecode = m_decoder; - threadworkItem.arrassets = arrvalus[l]; - - System.Threading.Thread decodethread = - new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(threadworkItem.run)); - - threadworkItem.SetThread(decodethread); - - decodethread.Priority = System.Threading.ThreadPriority.Lowest; - decodethread.Name = "J2kCacheDecodeThread_" + l + 1; - ThreadTracker.Add(decodethread); - decodethread.Start(); - - } - } - } - - public class DecodeThreadContents - { - public Scene sn; - public UUID[] arrassets; - public IJ2KDecoder j2kdecode; - private System.Threading.Thread thisthread; - - public void run(object o) - { - for (int i=0;i visualParams = new List(); - foreach (byte visualParam in appearance.VisualParams) - { - visualParams.Add(visualParam); - } - OnSetAppearance(appearance.Texture.GetBytes(), visualParams); + OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone()); } public void Stop() diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 940ae3b..3f4214e 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -380,13 +380,13 @@ namespace OpenSim.Framework /// /// Set up appearance textures and avatar parameters, including a height calculation /// - /// - /// - public virtual void SetAppearance(byte[] texture, List visualParam) + public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) { - Primitive.TextureEntry textureEnt = new Primitive.TextureEntry(texture, 0, texture.Length); - m_texture = textureEnt; - m_visualparams = visualParam.ToArray(); + if (textureEntry != null) + m_texture = textureEntry; + if (visualParams != null) + m_visualparams = visualParams; + m_avatarHeight = 1.23077f // Shortest possible avatar height + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 2ca2df9..430cbd7 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -65,7 +65,7 @@ namespace OpenSim.Framework public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); - public delegate void SetAppearance(byte[] texture, List visualParamList); + public delegate void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams); public delegate void StartAnim(IClientAPI remoteClient, UUID animID); diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs index ecd35c0..2fda6f3 100644 --- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs @@ -227,8 +227,7 @@ namespace OpenSim.Framework.Tests wearbyte.Add(VisualParams[i]); } - - AvAppearance.SetAppearance(AvAppearance.Texture.GetBytes(), wearbyte); + AvAppearance.SetAppearance(AvAppearance.Texture, (byte[])VisualParams.Clone()); } /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index dae525d..9788f40 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5272,13 +5272,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP // for the client session anyway, in order to protect ourselves against bad code in plugins try { - List visualparams = new List(); - foreach (AgentSetAppearancePacket.VisualParamBlock x in appear.VisualParam) - { - visualparams.Add(x.ParamValue); - } + byte[] visualparams = new byte[appear.VisualParam.Length]; + for (int i = 0; i < appear.VisualParam.Length; i++) + visualparams[i] = appear.VisualParam[i].ParamValue; + + Primitive.TextureEntry te = null; + if (appear.ObjectData.TextureEntry.Length > 1) + te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); - handlerSetAppearance(appear.ObjectData.TextureEntry, visualparams); + handlerSetAppearance(te, visualparams); } catch (Exception e) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 23fe2d3..ea5240e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -73,6 +73,8 @@ namespace OpenSim.Region.Framework.Scenes private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; + public static byte[] DefaultTexture; public UUID currentParcelUUID = UUID.Zero; @@ -2685,7 +2687,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void SetAppearance(byte[] texture, List visualParam) + public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) { if (m_physicsActor != null) { @@ -2703,7 +2705,30 @@ namespace OpenSim.Region.Framework.Scenes AddToPhysicalScene(flyingTemp); } } - m_appearance.SetAppearance(texture, visualParam); + + #region Bake Cache Check + + if (textureEntry != null) + { + for (int i = 0; i < BAKE_INDICES.Length; i++) + { + int j = BAKE_INDICES[i]; + Primitive.TextureEntryFace face = textureEntry.FaceTextures[j]; + + if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) + { + if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) + { + m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + (AppearanceManager.TextureIndex)j + ") for avatar " + this.Name); + this.ControllingClient.SendRebakeAvatarTextures(face.TextureID); + } + } + } + } + + #endregion Bake Cache Check + + m_appearance.SetAppearance(textureEntry, visualParams); if (m_appearance.AvatarHeight > 0) SetHeight(m_appearance.AvatarHeight); m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); @@ -3253,14 +3278,14 @@ namespace OpenSim.Region.Framework.Scenes wears[i++] = new AvatarWearable(itemId, assetId); } m_appearance.Wearables = wears; - byte[] te = null; - if (cAgent.AgentTextures != null) - te = cAgent.AgentTextures; + Primitive.TextureEntry te; + if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) + te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); else - te = AvatarAppearance.GetDefaultTexture().GetBytes(); + te = AvatarAppearance.GetDefaultTexture(); if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); - m_appearance.SetAppearance(te, new List(cAgent.VisualParams)); + m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone()); } catch (Exception e) { diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 2316267..57f5d29 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -861,12 +861,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server Scene scene = (Scene)Scene; AvatarAppearance appearance; scene.GetAvatarAppearance(this, out appearance); - List visualParams = new List(); - foreach (byte visualParam in appearance.VisualParams) - { - visualParams.Add(visualParam); - } - OnSetAppearance(appearance.Texture.GetBytes(), visualParams); + OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone()); } public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index b3bfe07..30a2675 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -163,13 +163,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); - List wearbyte = new List(); - for (int i = 0; i < x.VisualParams.Length; i++) - { - wearbyte.Add(x.VisualParams[i]); - } - - sp.SetAppearance(x.Texture.GetBytes(), wearbyte); + sp.SetAppearance(x.Texture, (byte[])x.VisualParams.Clone()); } m_avatars.Add(npcAvatar.AgentId, npcAvatar); -- cgit v1.1 From f6cc20940f0caceb12119abb4140b21c0b937116 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 30 Sep 2009 17:49:51 -0700 Subject: Taking the opportunity to delete unnecessary text files from the Prebuild folder (the license information is already in the appropriate place in the OpenSim distro) --- Prebuild/AUTHORS | 10 -- Prebuild/COPYING | 65 -------- Prebuild/ChangeLog | 461 ----------------------------------------------------- Prebuild/INSTALL | 236 --------------------------- Prebuild/NEWS | 200 ----------------------- Prebuild/README | 274 ------------------------------- Prebuild/THANKS | 18 --- Prebuild/TODO | 43 ----- Prebuild/prebuild | 2 - 9 files changed, 1309 deletions(-) delete mode 100644 Prebuild/AUTHORS delete mode 100644 Prebuild/COPYING delete mode 100644 Prebuild/ChangeLog delete mode 100644 Prebuild/INSTALL delete mode 100644 Prebuild/NEWS delete mode 100644 Prebuild/README delete mode 100644 Prebuild/THANKS delete mode 100644 Prebuild/TODO delete mode 100644 Prebuild/prebuild diff --git a/Prebuild/AUTHORS b/Prebuild/AUTHORS deleted file mode 100644 index 9e86ac0..0000000 --- a/Prebuild/AUTHORS +++ /dev/null @@ -1,10 +0,0 @@ -Dave Hudson (jendave@yahoo.com), -Matthew Holmes (matthew@wildfiregames.com) -Dan Moorehead (dan05a@gmail.com) -Rob Loach (http://www.robloach.net) -C.J. Adams-Collier (cjac@colliertech.org) - -Patch Contributers -lbsa71 -chi11ken -sdague diff --git a/Prebuild/COPYING b/Prebuild/COPYING deleted file mode 100644 index d3cdf7e..0000000 --- a/Prebuild/COPYING +++ /dev/null @@ -1,65 +0,0 @@ -BSD License -Copyright (c)2004-2008 - -See AUTHORS file for list of copyright holders - -Dave Hudson (jendave@yahoo.com), -Matthew Holmes (matthew@wildfiregames.com) -Dan Moorehead (dan05a@gmail.com) -Rob Loach (http://www.robloach.net) -C.J. Adams-Collier (cjac@colliertech.org) - -http://dnpb.sourceforge.net -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---- - -Portions of src/Core/Targets/AutotoolsTarget.cs -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Prebuild/ChangeLog b/Prebuild/ChangeLog deleted file mode 100644 index bb8e7b0..0000000 --- a/Prebuild/ChangeLog +++ /dev/null @@ -1,461 +0,0 @@ -2008-12-09T02:15 D. Moonfire - * src/Core/Kernel.cs - - Added a /ppi target to get the results of processing but before - processing the actual results. - * src/Core/Preprocessor.cs - - Applied the patch from kanato with formatting changes. - - Uses the format. - * tests/ - - Added some lightweight tests to test the functionality of the - include patch. - -2008-06-19T09:37 John Anderson - * src/Core/Kernel.cs - - Only Loop through targets that are not abstract. - * src/Core/Targets/VSGenericTarget.cs - - Marked abstract and removed the Target attribute. - -2008-06-16T17:37 John Anderson - * src/Core/Nodes/ProjectNode.cs,data/prebuild-1.7.xsd - - Added the ability to hardcode guid's in the projects - -2008-05-21T0737 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - catch exception when unable to compile AssemblyInfo.cs - -2008-05-07T17:29 John Anderson - * src/Core/Targets/VSGenericTarget.cs - - Generate asp.net output in bin\ folder (asp.net requires it there) - -2008-04-30T17:29 John Anderson - * src/Core/Nodes/DatabaseReferenceNode.cs, - src/Core/Nodes/Datanode.cs, - src/Core/Nodes/FileNode.cs, - src/Core/Nodes/FileNodes.cs, - src/Core/Nodes/MatchNode.cs, - src/Core/Targets/VS2008Target.cs, - src/data/prebuild-1.7.xsd - - Refactored the project generation code to handle web projects and more - logically handle embedded resources and designer files. - -2008-04-30T17:29 Joseph Lombrozo - * src/Core/Nodes/SolutionNode.cs - - Had solutions inherit Configurations in the same way that Projects do. - -2008-04-29T06:35 Joseph Lombrozo - * src/Core/Targets/VS2008Target.cs, - src/Core/Nodes/DatabaseProjectNode.cs, - src/Core/Nodes/DatabaseReferenceNode.cs, - src/data/prebuild-1.7.xsd - - Added database references to database projects. - - Prevented nested solutions from being written to disk. - -2008-04-29T05:43 Joseph Lombrozo - * src/Core/Targets/VS2008Target.cs - - Enabled embedded solutions to contain Files. - -2008-04-29T04:13 Joseph Lombrozo - * src/Core/VSVersion.cs - - Fixed spelling mistake in enum comment. - * src/Core/Attributes/DataNodeAttribute.cs - - Allowed the DataNodeAttribute to be attached to a single class - more than once, allowing one class to be used to parse more than - one node at a time. - * src/Core/Kernel.cs - - Changed CacheNodeTypes() to allow for multiple DataNodeAttribute - instances in one class. Refactored ProcessFile(...) to return Solutions, - rather than adding them to the Kernel. - * src/Core/Nodes/SolutionNode.cs - - Added Guid (for embedded folders) - - Added DatabaseProjects, Solutions and Processes to the SolutionNode - when parsing. - * src/Core/Nodes/ProjectNode.cs - - Added FrameworkVersion property to allow for 2.0/3.0/3.5 differentiation. - * src/Core/Targets/VS2008Target.cs, src/data/prebuild-1.7.xsd - - Added ability to have embedded solutions, and externally referenced - prebuild scripts. - -2008-04-24T04:33 John M. Anderson - * src/Core/Targets/VS2003Target.cs, src/Core/Targets/VSVersion.cs - - Moved the VSVersion enum into its own file. - * src/Core/Targets/VS2008Target.cs - - added support for VS2008 - * src/Core/Nodes/ProjectNode.cs - - Added initial support for ASP.NET projects - * src/Core/Nodes/DatabaseProjectNode.cs - - Added support for Visual Studio database projects - -2008-02-19T07:08 C.J. Adams-Collier - * TODO - - added some tasks from Sam Hocevar - * src/Core/Targets/AutotoolsTarget.cs - - added a missing end paren - * COPYING - - Removed Randy Ridge's name from the copyright. Looks to me like - his name was present only because the file was nabbed from Tao - -2008-02-09T20:29 C.J. Adams-Collier - * COPYING - - added MIT/X11 license due to inclusion of code from Monodevelop - * THANKS - - added Lluis Sanchez Gual and Todd Berman - I yoinked code from - their pkg-config .pc file parser to build AutotoolsTarget.cs. - Sorry it took me so long to remember to add mention of you guys! - * src/Core/Targets/AutotoolsTarget.cs - - added MIT/X11 license. see above. - -2008-02-07T08:27 C.J. Adams-Collier - * AUTHORS - - consolidated names and contact info found laying around the - source - * src/Core/Kernel.cs - - updated copyright date - - re-formatted license for 80-column editor - - updated log banner to indicate new date, new authors - * src/Core/Targets/AutotoolsTarget.cs - - clarified reasoning behind use of constants in - AutotoolsTarget.ParsePCFile - - reduced length of some long lines using newline/indent - - added log messages for parsing .pc files, emitting solutions, - projects - - robustified the inter-package dependency resolution target - - log warning when we can't find assembly for - - clarified code for case of inability to find embedded - autotools.xml - * src/data/autotools.xml - - adding system lookup of resgen2 to configure.ac - - fixed .resource -> .resources typo - - added a rule to create .response file containing all sources - - using @.response on $(CSC) command line instead of listing - all source files - * src/Properties/AssemblyInfo.cs - - re-formatted license for an 80-column editor - - added more authors to the AssemblyCopyright attribute - - bumped version to 2.0.3 - * prebuild.xml - - bumped version to 2.0.3 - * scripts/autotools.sh - - if 'mono' is in the path, run Prebuild.exe with it - - using dirname to capture correct path to prebuild.xml &c - -2008-02-06T17:18 C.J. Adams-Collier - * src/Core/Targets/NAntTarget.cs - - re-formatted the license for an 80-column editor - - added myself to the copyright - - added a fix submitted by Gryc Ueusp - * src/Core/Targets/AutotoolsTarget.cs - - updated copyright to include 2008 - * THANKS - - created file, added Gryc Ueusp - -2008-01-01T14:50 C.J. Adams-Collier - * src/data/autotools.xml - - fixed .resx -> .resource compilation - - fixed failing edge case where Project is an unsigned Library - - added $(RESOURCE_SRC) to list of extra dist files - * src/Core/Targets/AutotoolsTarget.cs - - removed embeddedResources from extraDistFiles list - -2007-04-18T07:49 C.J. Adams-Collier - * src/data/prebuild-1.7.xsd - - removed default version from references - -2007-04-06T12:42 C.J. Adams-Collier - * src/data/autotools.xml - - added support for /doc: output when XmlDocFile is not empty - - not printing \t \\n on lines that have no content - - gacutil now installs the root assembly instead of the one under - bin/Debug or whatever - -2007-04-04T22:12 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - removed debugging Console.WriteLine() - * src/data/autotools.xml - - ensuring that install-sh and missing get distributed - - explicitly stating that the sources, snk, resources and binary - references live under $(srcdir) - - corrected uninstall target - - verified distcheck completes successfully - -2007-04-03T21:56 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - added a using for System.Diagnostics - - added enum ClrVersion for use with the pkg-config parser - - added class SystemPackage for use with the pkg-config parser - - removed explicit "private" property of members since it is implied - - flushing the stream-writer before it's closed - - removed excess braces around an if statement - ! NormalizeAsmName(), AddAssembly(), GetAssembliesWithLibInfo(), - GetAssembliesWithoutLibInfo(), ProcessPiece(), - GetVariableFromPkgConfig(), ParsePCFile(), - RegisterSystemAssemblies(), RunInitialization() - - pulled the above from MonoDevelop to parse the system pkgconfig - files and determine /pkg: arguments. Original sources are here: - http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs - http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/ClrVersion.cs - ! WriteProject() - - now gathering project version from AssemblyInfo.cs if it is part - of the project - - changed the declaration of the ArrayList's in the method - - now copying assembly .config files to the project, distributing, - installing - - making sure all needed files live under the Project directory - - copying strongname keys to project directory - - parsing AssemblyInfo.cs to determine assembly version - - removing all references to ".." - - removed superfluous if(project.References.Count > 0) around - for(int refNum = 0; refNum < project.References.Count; refNum++) - - removed use of runtimeLibs - - adding hook to copy sibling project's generated assemblies to - this project during Make time - - added extra dist target to ensure all files required to build - get distributed during "make dist" - - added new xslt processing args: - -- assemblyName - -- extraDistFiles - -- pkgLibs (/pkg:foo) - -- localCopyTargets (to copy sibling assemblies at Make time) - -- projectVersion (if determined from AssemblyInfo.cs) - -- hasAssemblyConfig (if there's a assembly.exe.config present) - ! Write() - - calling RunInitialization() to gather pkg-config data - * src/data/autotools.xml - - accepting new args passed from AutotoolsTarget.cs - - modernized configure.ac a bit - - using a version of tar that allows >99-char filenames - - added ASSEMBLY_NAME variable - - using assembly name rather than project name for gac installation - - generated assembly is now assembly name and not project name - - accepting /pkg: flags gathered from AutotoolsTarget.cs - - adding Makefile targets to copy sibling project assemblies to . - - fixed Debug, Release targets - - adding support for strongname key signing - - adding /unsafe support - - adding a clean make target - - only running gacutil /u if the assembly being uninstalled is in gac - - added some templates to determine each Configuration's .snk - - added explanation as to why .exe assemblies live in $prefix/lib - * src/Properties/AssemblyInfo.cs - - bumped assembly version - * prebuild.xml - - bumped assembly version - -2007-03-29T18:03 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - ! WriteProject() - - re-named incorrectly-named variable gacLibs to systemLibs - - added another reference list, runtimeLibs which contains the - libs we will need at runtime. we use this to build a MONO_PATH - - added monoPath to the xslt args list - * src/data/autotools.xml - ! - - renamed gacLibs to systemLibs - - added the sources to the dist list - - added logic to install libs that aren't strongnamed - ! - - accepting a param to update the MONO_PATH - -2007-03-28T19:46 C.J. Adams-Collier - * src/Core/Targets/MonoDevelopTarget.cs - ! CleanProject() - - using Assembly.LoadWithPartialName to locate the assembly - * src/Core/Targets/AutotoolsTarget.cs - ! WriteCombine() - - no longer using $PWD to determine a project's source dir; this - doesn't work with elements - - passing the solution name to all templates - fixes - multi-solution prebuild systems - ! WriteProject() - - no longer using $PWD to determine a project's source dir; this - doesn't work with elements - - passing the solution name to all templates - fixes - multi-solution prebuild systems - - copying strongname key to the autotools directory - - using Assembly.LoadWithPartialName to locate assemblies - * src/data/autotools.xml - ! - - fixed the .pc AC_CONFIG_FILES macro - ! - - added solution name param - - wrapping if type=exe check around script install macro - - added type=lib check and .pc file install macro - - added support for Configuration-specific builds (Debug, Release, etc) - - added strongname keyfile code - - TODO: support non-strongnamed library installation - ! - - added space preservation attribute to stylesheet element - - added a lower-case project name variable - - added solution name param - - made for-each template more specific - ! - - added solution name param - ! - - added solution name param - ! - - added solution name param - ! - - added solution name param - -2007-03-27T09:33 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - now processing the wrapper script if type is "Exe" or "WinExe" - * src/data/autotools.xml - ! - - being more exact about where text escaping is used - - using the correct variable name for the GACUTIL_FLAGS template - - using correct test="" for the AC_CONFIG_FILES macros - ! - - uncommented the bin_SCRIPTS section now that the script is being - generated correctly - ! - - fixed whitespace at beginning of file, before #! - - using lower-case packageName to indicate installation location - -2007-03-27T09:33 C.J. Adams-Collier - * src/data/autotools.xml - ! - * added a lcProjectName which is $projectName lower-cased - * moved autoconf template specifier near AC_OUTPUT - * AC_OUTPUT with args is deprecated. now using AC_CONFIG_FILES - * placed AC_CONFIG_FILES() calls for wrapper script or pkg-config - file in xslt project type checks - ! - * commented out bin_SCRIPTS - * added a lcProjectName which is $projectName lower-cased - * using $lcProjectName instead of the longer version - -2007-03-27T08:39 C.J. Adams-Collier - * src/data/autotools.xml - ! - - added whitespace-preservation - - added the missing projectName param - - replaced bin_SCRIPTS with something that worked - -2007-03-27T07:56 C.J. Adams-Collier - * src/data/autotools.xml - ! - - cleaned up duplicate checks - - placed initialization macros above system check macros - - added some more messages about what's going on - - added GACUTIL_FLAGS variable including /package option - ! - - added an incomplete bin_SCRIPTS - - RCS check says "building" instead of "compiling" - ! - - removed macros that are useful only for projects - ! - - created this element on this revision - - this is a wrapper shell script that lives in the $PATH and runs - the CIL assembly - -2007-03-26T20:18 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - creating new template arguments to contain the list of libs to - reference: source, binary & GAC - - source libs are included as part of this solution (untested) - - binary libs are distributed with the source (untested) - - GAC libs are assumed to be in the GAC or other lib path (tested) - * src/data/autotools.xml - - created new params through which to accept reference info - - created a working $(CSC) line - - added a TODO item for ordering project dependency for - AC_CONFIG_SUBDIRS code - -2007-03-26T08:41 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - now creating list of source files in managed code and passing - them to the template via s - * src/data/prebuild-1.7.xsd - - updated the header comment to 2007 - * src/data/autotools.xml - ! - - copied checks from Solution-level configure.ac - - copied solution-level config status - ! - - added elements for file list to be passed through - - made a temporary target for the assembly we're building - - added this target to the deps of "all:" - ! - - changed status header/footer from "- - -" to "===" - -2007-03-23T08:33 C.J. Adams-Collier - Added version attribute handling code for Property element - Added description element handling code - * prebuild.xml - - added /Prebuild/Solution/Property/@version attribute - - added /Prebuild/Solution/Property/Description element - * src/Core/Nodes/ProjectNode.cs - - added some docs where they were missing and obvious - - added code to handle @version - * src/Core/Nodes/DescriptionNode.cs - - new file. Used to handle /Prebuild/Solution/Property/Description - * src/Core/Targets/AutotoolsTarget.cs - - added mkdirDashP(), a recursive directory creation method - - WriteProject() now copies the files to autotools/ - * src/data/prebuild-1.7.xsd - - added /Prebuild/Solution/Property/Description element - - added /Prebuild/Solution/Property/@version attribute - * src/data/autotools.xml - - removed excess - - explicitly using dnpb: prefix - -2007-03-23T04:31 C.J. Adams-Collier - Merged code from my stripped-down test - Adding support for the /Prebuild/Solution/Project/Author element - * prebuild.xml - - added Author elements - - cleaned up the really long Project element - * src/Core/Nodes/ProjectNode.cs - - added Author tag processing code - * src/Core/Nodes/AuthorNode.cs - - Created to process Author elements - - based off of ReferencePathNode.cs - * src/Core/Targets/AutotoolsTarget.cs - - merged code from https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/test.cs - - renamed old WriteCombine to WriteCombineOld - - renamed old WriteProject to WriteProjectOld - * src/data/prebuild-1.7.xsd - - added Author element to Project - * src/data/autotools.xml - - lower-cased utf - - -2007-03-22T13:58 C.J. Adams-Collier - Exposing an XmlDocument that represents the prebuild.xml file - passed to the program - - * src/Core/Kernel.cs - - created an object member called XmlDocument m_CurrentDoc - - created a property to access its value - - using m_CurrentDoc to load up the prebuild.xml file rather than - a local variable called "doc" - -2007-03-22 C.J. Adams-Collier - * prebuild.xml - - added autotools.xml created at https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/autotools.xml - * src/data/autotools.xml - - the same - * src/Core/Targets/MonoDevelopTarget.cs - - fixed bug introduced in r206 - -2007-03-07 C.J. Adams-Collier - * src/data/prebuild-1.7.xsd - - added version attribute to Solution and Project elements - -2006-11-04T00:38 C.J. Adams-Collier - * placing AssemblyInfo.cs into Properties/ - * Fixed double-mention of the package name - -2006-11-03T15:23 C.J. Adams-Collier - * corrected a problem in the Include.am generation code - * created the new .exe - * copied it to the root of the build - -2006-11-03T14:57 C.J. Adams-Collier - * Updated the .exe file - -2006-11-03 C.J. Adams-Collier - * Added a TODO file - * Added a ChangeLog file - * applied some fixes for autotools gac and pkg-config installation - problems diff --git a/Prebuild/INSTALL b/Prebuild/INSTALL deleted file mode 100644 index 23e5f25..0000000 --- a/Prebuild/INSTALL +++ /dev/null @@ -1,236 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/Prebuild/NEWS b/Prebuild/NEWS deleted file mode 100644 index bea28da..0000000 --- a/Prebuild/NEWS +++ /dev/null @@ -1,200 +0,0 @@ -Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt. - -Documentation and downloads are available at http://dnpb.sourceforge.net. - -Prebuild is licensed under the BSD license. - -[ XXXXXXX XX, XXX - 1.3.2 ] - + Added Keyfile signing to NAnt target and VS2005 target - + Updated XSD file to 1.7 - + Boo and VisualBasic Language support in VS2005 target - + Added basic Autotools target. It creates a non-recursive Autotools system. - ! Multiple files can be excluded from the Match node - ! VS2005 now handles .resx files correctly. - ! NAnt and Autotools now handle defines - ! NAnt and Autotools now handle resources - + Conditional XML variables can be passed through the command line. - + Added /install and /remove command line flags to install and remove assemblies from the GAC - + Many fixes to VS2005 target - -[ July 21, 2006 - 1.3.1 ] - ! VS2005 fixes from Rob Loach - ! NAnt fixes from Rob Loach and David Hudson - ! XML doc fixes from Rob Loach - + Added SharpDevelop2 target (really just uses VS2005 target) - ! Fixed bug with BuildEvents in Monodevelop target - + Passing /yes will default to answering yes to any warnings - -[ February 28, 2006 - 1.3 ] - + Added MonoDevelop target. - + Added NAnt target. - + Lots of fixes to all targets. - * Cleaned up the code using FXCop. - * Updated schema to 1.6 to fix a typo and add a new parameter. - * jendave is now the maintainer of the project. RobLoach has been added as a developer. - * Removed references to 'dnpb'. - + Added rudimentary support for pre- and post- build scripts - * Updated examples. - -[ August 5, 2004 - 1.2 ] - + Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages - + Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags - + Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs - * Modified the removedir command line option to allow for a pipe-delimited list of directory names - ! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well - + Added the GenerateXmlDocFile boolean option to the Options XML element - * Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this - -[ January 3, 2004 - 1.1 ] - ! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems - + Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake - * Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version - -[ December 30, 2004 - 1.1 ] - ! Applied Leed's fix for SharpDevelop references - + Rewrote much of the processing for better validation and without the use of a temp file - + Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs - * Changed all spaces into tabs - + Added support for the None build action - * Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument - -[ December 25, 2004 - 1.0 ] - + Added the /removedir option for cleaning directories like obj before file releases - + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds - * Made path optional for Match elements (defaults to current directory) and updates schema for it - ! Fixed XML example in the readme.txt - + Added example xml files to docs directory - * Updated license.txt to add Dan Moorehead and update copyright years - + Updated prebuild.xml to take advantage of the default path attribute for match elements - + Updated Clean to delete the obj directories - -[ December 25, 2004 - 0.13 ] - + Added dnpb.exe so that it can be used to generate the project files - + Added dnpb.ico - * Added parameterless Write statement to Log for writing a single line - * Changed scehema to version 1.3 for support of icon attribute - * Added support for All configuration name under a Project node signifying common settings for all configurations - ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode - * Wrote documentation in docs/readme.txt - * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005 - * Updated prebuild.xml - * Optimized Log class - * Updated OutputUsage() - * /clean targets all by default - * No log file is used by default, /log without value specified uses default file name - + Added support for the /pause which pauses the utility after execution to observe output - - -[ September 27, 2004 - 0.12.2a ] - ! Fixed a nasty bug when trying to delete our temp file for pre-processing. - -[ September 15, 2004 - 0.12.2 ] - + Expanded platform identification, thanks to the NAnt guys for shedding some - light on how to properly check for UNIX platforms! Thanks guys! - * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX", - and "Unknown". - ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of - the Project tag. - + New command-line switch, /ppo, forces DNPB to pre-process the file and write - the pre-processed file. This allows you to test/debug your pre-processor - macros. No other processing will be done. You can specify a target file as - a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml' - if you do not specify a file. - + The Match tag now has a 'buildAction' attribute which functions exactly like - the attribute of the same name for the File tag. - -[ August 5, 2004 - 0.12.1 ] - + Added environment variable expansion for all values. Environment variables - should be listed in the form ${VAR}. - -[ July 30, 2004 - 0.12.0 ] - + Added preprocessing via XML processing information tags. Available tags - are: ?>, ?>, and . The - current expression parser is very basic, but will be replaced with a more - capable parser over time. Current operators available are: =, !=, <, >, - <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor, - RuntimeMinor, RuntimeRevision. - -[ July 27, 2004 - 0.11.4 ] - + Added 'useRegex' attribute to the Match tag. Matches can now use regular - expressions to match filenames. - + Added the 'assemblyName' attribute to the Project tag. Projects can now - set their output assembly name. - ! Fixed several bugs in the way that Project tags inheirt their parent - Solutions configuration options. This operation should now work fully as - intended. - ! Due to some wierdness, Project Guid's are now stored as part of the Project - node and created at parse time. - -[ May 11, 2004 - 0.11.3 ] - ! Fixed a bug where I was writing the wrong property name for a projects root - namespace. - ! Removed a DEBUG statement I had left in the code in 0.11.2. - ! Fixed a bug in the VS2002 writer which caused the version variables to not - be overriden correctly. - + Added the rootNamespace property to the element, allowing you to - specify the root namespace. - * /target and /clean are now mutually exclusive command line switches, and - they both now take the all option. In the case of /target all, all build - file for all targets will be created. In the case of /clean all, the user - will be prompted to make sure they want to do it, and if so, will clean - all build files for all targets. - -[ April 22, 2004 - 0.11.2 ] - ! Fixed a bug with the /file command-line operator. Was using the unresolved - file path rather then the resolved one, was making the attempt to open the - dnpb file fail. - ! Fixed a bug in the schema that required at least 1 solution and 1 reference - path. We can do just fine with 0 of either of these. Some files may be all - statements and not have any tags. - ! Fixed a bug that caused the project references not to be written with the - SharpDevelop target. - * Changed the schema to version 1.2, allowing for Configuration nodes to exist - under project nodes. The inheritance of values is hierarchical. Meaning, if - you define a configuration named Debug at the Soltion level, and one by the - same name at the Project level, the one at the Project level will first - inherit the options of the Solution level configuration, then set it's own - options. If you define a configuration at the Project level and it does not - exist at the Solution level, it will be created at the Solution level. - * Project references should now work correctly across the board. Note that due - to a restriction in Visual Studio, you can only reference projects in the same - solution. - -[ April 21, 2004 - 0.11.1 ] - ! Fixed a problem with resolving paths in various targets. Was not properly - setting the CWD. - * Schema updated to 1.1, moving the ReferencePath element from the Options - element to the Project element. This makes more logical sense, given that - reference paths are resolved relative to the project path. Any prebuild.xml - file referecning verison 1.0 will fail! Please update to the 1.1 schema. - -[ April 19, 2004 - 0.11.0 ] - * Added several attributes across the code to make FxCop happy - ! Fixed bugs in reference paths being written in the VS targets. - ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of - a Push/Pop pair. Was wreaking havoc with tags. - ! Fixed some bugs in the path tracking, both the Project and Solution nodes now - have a FullPath property, which is the full path to the file resolved at load - time. This should fix all path relativity problems. - + Added new /clean switch, allowing the target to clean up any files it generated. - in accordance, the ITarget interface has been updated to support a new Clean() - method. - + Completed addition of the tag, to allow the referencing of external - prebuild.xml files. - + Added the runtime attribute to the Project element. This allows the developer - to specify which runtime a project should target (Mono or Microsoft). This is - of course ignored in certain targets like the Visual Studio targets. - + Added the SharpDevelop target. - -[ April 13, 2004 - 0.10.1a ] - + Added the buildAction attribute to the File node. This is needed for dnpb - to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource) - -[ April 13, 2004 - 0.10.1 ] - * First Release - -[ Key ] -* = Change or information -+ = Addition -! = Bug Fix - diff --git a/Prebuild/README b/Prebuild/README deleted file mode 100644 index e8a2d69..0000000 --- a/Prebuild/README +++ /dev/null @@ -1,274 +0,0 @@ -Prebuild Instructions - -Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt. - -_______________________________________________________________________________ -Overview - -Prebuild can be either be run from the command line to generate the -project and make files or you can execute the included batch (*.bat) -and Unix Shell script (*.sh) files. - -_______________________________________________________________________________ -The currently supported developement tools and their associated batch -and shell script files. - -Visual Studio .NET 2005 (VS2005.bat) -Visual Studio .NET 2003 (VS2003.bat) -Visual Studio .NET 2002 (VS2002.bat) -SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/ -SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/ -MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/ -NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/ -Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system - -Notes: - -A Unix Shell script is provided for MonoDevelop, as it does not run on -Windows at this time. - -Visual Studio .NET 2005 and the Visual Express IDE's can import -solutions from older versions of Visual Studio .NET. - -Makefiles are not currently supported. - -_______________________________________________________________________________ -Command Line Syntax: - -Example: -> Prebuild /target vs2003 - -This will generate the project files for Visual Studio.NET 2003 and -place the redirect the log to a file named PrebuildLog.txt in the -parent directory - - -The syntax structure is as below, where commandParameter is optional -depending on the command and you can provide several option-value -pairs. - -Note: The '> ' signifies the command prompt, do not enter this literally - -> Prebuild /