diff options
author | Justin Clark-Casey (justincc) | 2012-01-05 22:40:49 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-01-05 22:40:49 +0000 |
commit | 5ea9740f1b2cc98601cfb15c19e190471c4c42ed (patch) | |
tree | 62c37ecf7740044fa01ebf99f0c3f36fef9be8a2 /OpenSim/Region/CoreModules/Agent/TextureSender | |
parent | Make "show asset" command available simulator side. Actually make the servic... (diff) | |
download | opensim-SC_OLD-5ea9740f1b2cc98601cfb15c19e190471c4c42ed.zip opensim-SC_OLD-5ea9740f1b2cc98601cfb15c19e190471c4c42ed.tar.gz opensim-SC_OLD-5ea9740f1b2cc98601cfb15c19e190471c4c42ed.tar.bz2 opensim-SC_OLD-5ea9740f1b2cc98601cfb15c19e190471c4c42ed.tar.xz |
Add a "j2k decode" region console command that allows a manual request for a JPEG2000 decode of an asset
For debugging purposes.
Diffstat (limited to 'OpenSim/Region/CoreModules/Agent/TextureSender')
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 14dee84..349d3ac 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -137,14 +137,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | /// <summary> | 140 | public bool Decode(UUID assetID, byte[] j2kData) |
141 | /// Provides a synchronous decode so that caller can be assured that this executes before the next line | ||
142 | /// </summary> | ||
143 | /// <param name="assetID"></param> | ||
144 | /// <param name="j2kData"></param> | ||
145 | public void Decode(UUID assetID, byte[] j2kData) | ||
146 | { | 141 | { |
147 | DoJ2KDecode(assetID, j2kData); | 142 | return DoJ2KDecode(assetID, j2kData); |
148 | } | 143 | } |
149 | 144 | ||
150 | #endregion IJ2KDecoder | 145 | #endregion IJ2KDecoder |
@@ -154,11 +149,13 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
154 | /// </summary> | 149 | /// </summary> |
155 | /// <param name="assetID">UUID of Asset</param> | 150 | /// <param name="assetID">UUID of Asset</param> |
156 | /// <param name="j2kData">JPEG2000 data</param> | 151 | /// <param name="j2kData">JPEG2000 data</param> |
157 | private void DoJ2KDecode(UUID assetID, byte[] j2kData) | 152 | private bool DoJ2KDecode(UUID assetID, byte[] j2kData) |
158 | { | 153 | { |
159 | // m_log.DebugFormat( | 154 | // m_log.DebugFormat( |
160 | // "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID); | 155 | // "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID); |
161 | 156 | ||
157 | bool decodedSuccessfully = true; | ||
158 | |||
162 | //int DecodeTime = 0; | 159 | //int DecodeTime = 0; |
163 | //DecodeTime = Environment.TickCount; | 160 | //DecodeTime = Environment.TickCount; |
164 | OpenJPEG.J2KLayerInfo[] layers; | 161 | OpenJPEG.J2KLayerInfo[] layers; |
@@ -196,6 +193,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
196 | catch (Exception ex) | 193 | catch (Exception ex) |
197 | { | 194 | { |
198 | m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message); | 195 | m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message); |
196 | decodedSuccessfully = false; | ||
199 | } | 197 | } |
200 | } | 198 | } |
201 | else | 199 | else |
@@ -204,6 +202,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
204 | if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components)) | 202 | if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components)) |
205 | { | 203 | { |
206 | m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID); | 204 | m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID); |
205 | decodedSuccessfully = false; | ||
207 | } | 206 | } |
208 | } | 207 | } |
209 | 208 | ||
@@ -212,6 +211,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
212 | m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults"); | 211 | m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults"); |
213 | // Layer decoding completely failed. Guess at sane defaults for the layer boundaries | 212 | // Layer decoding completely failed. Guess at sane defaults for the layer boundaries |
214 | layers = CreateDefaultLayers(j2kData.Length); | 213 | layers = CreateDefaultLayers(j2kData.Length); |
214 | decodedSuccessfully = false; | ||
215 | } | 215 | } |
216 | 216 | ||
217 | // Cache Decoded layers | 217 | // Cache Decoded layers |
@@ -231,6 +231,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
231 | m_notifyList.Remove(assetID); | 231 | m_notifyList.Remove(assetID); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | |||
235 | return decodedSuccessfully; | ||
234 | } | 236 | } |
235 | 237 | ||
236 | private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) | 238 | private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) |