diff options
author | Melanie | 2012-01-06 00:08:18 +0000 |
---|---|---|
committer | Melanie | 2012-01-06 00:08:18 +0000 |
commit | fdfc4ab2a8e171139caf9751a23eb75afe881c2b (patch) | |
tree | bc0d8d3066ecf5fe87e0778e23190d14a58d3bc1 /OpenSim/Region/CoreModules | |
parent | That needs to be callable from elsewhere! (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-fdfc4ab2a8e171139caf9751a23eb75afe881c2b.zip opensim-SC_OLD-fdfc4ab2a8e171139caf9751a23eb75afe881c2b.tar.gz opensim-SC_OLD-fdfc4ab2a8e171139caf9751a23eb75afe881c2b.tar.bz2 opensim-SC_OLD-fdfc4ab2a8e171139caf9751a23eb75afe881c2b.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | 35 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 7 |
2 files changed, 30 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 14dee84..a1a2501 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -133,18 +133,20 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
133 | 133 | ||
134 | // Do Decode! | 134 | // Do Decode! |
135 | if (decode) | 135 | if (decode) |
136 | DoJ2KDecode(assetID, j2kData); | 136 | Decode(assetID, j2kData); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | /// <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 | 141 | { |
142 | /// </summary> | 142 | OpenJPEG.J2KLayerInfo[] layers; |
143 | /// <param name="assetID"></param> | 143 | int components; |
144 | /// <param name="j2kData"></param> | 144 | return Decode(assetID, j2kData, out layers, out components); |
145 | public void Decode(UUID assetID, byte[] j2kData) | 145 | } |
146 | |||
147 | public bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components) | ||
146 | { | 148 | { |
147 | DoJ2KDecode(assetID, j2kData); | 149 | return DoJ2KDecode(assetID, j2kData, out layers, out components); |
148 | } | 150 | } |
149 | 151 | ||
150 | #endregion IJ2KDecoder | 152 | #endregion IJ2KDecoder |
@@ -154,14 +156,21 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
154 | /// </summary> | 156 | /// </summary> |
155 | /// <param name="assetID">UUID of Asset</param> | 157 | /// <param name="assetID">UUID of Asset</param> |
156 | /// <param name="j2kData">JPEG2000 data</param> | 158 | /// <param name="j2kData">JPEG2000 data</param> |
157 | private void DoJ2KDecode(UUID assetID, byte[] j2kData) | 159 | /// <param name="layers">layer data</param> |
160 | /// <param name="components">number of components</param> | ||
161 | /// <returns>true if decode was successful. false otherwise.</returns> | ||
162 | private bool DoJ2KDecode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components) | ||
158 | { | 163 | { |
159 | // m_log.DebugFormat( | 164 | // m_log.DebugFormat( |
160 | // "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID); | 165 | // "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID); |
161 | 166 | ||
167 | bool decodedSuccessfully = true; | ||
168 | |||
162 | //int DecodeTime = 0; | 169 | //int DecodeTime = 0; |
163 | //DecodeTime = Environment.TickCount; | 170 | //DecodeTime = Environment.TickCount; |
164 | OpenJPEG.J2KLayerInfo[] layers; | 171 | |
172 | // We don't get this from CSJ2K. Is it relevant? | ||
173 | components = 0; | ||
165 | 174 | ||
166 | if (!TryLoadCacheForAsset(assetID, out layers)) | 175 | if (!TryLoadCacheForAsset(assetID, out layers)) |
167 | { | 176 | { |
@@ -196,14 +205,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
196 | catch (Exception ex) | 205 | catch (Exception ex) |
197 | { | 206 | { |
198 | m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message); | 207 | m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message); |
208 | decodedSuccessfully = false; | ||
199 | } | 209 | } |
200 | } | 210 | } |
201 | else | 211 | else |
202 | { | 212 | { |
203 | int components; | ||
204 | if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components)) | 213 | if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components)) |
205 | { | 214 | { |
206 | m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID); | 215 | m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID); |
216 | decodedSuccessfully = false; | ||
207 | } | 217 | } |
208 | } | 218 | } |
209 | 219 | ||
@@ -212,6 +222,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
212 | m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults"); | 222 | 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 | 223 | // Layer decoding completely failed. Guess at sane defaults for the layer boundaries |
214 | layers = CreateDefaultLayers(j2kData.Length); | 224 | layers = CreateDefaultLayers(j2kData.Length); |
225 | decodedSuccessfully = false; | ||
215 | } | 226 | } |
216 | 227 | ||
217 | // Cache Decoded layers | 228 | // Cache Decoded layers |
@@ -231,6 +242,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
231 | m_notifyList.Remove(assetID); | 242 | m_notifyList.Remove(assetID); |
232 | } | 243 | } |
233 | } | 244 | } |
245 | |||
246 | return decodedSuccessfully; | ||
234 | } | 247 | } |
235 | 248 | ||
236 | private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) | 249 | private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 9df0592..d68d28c 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -321,8 +321,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
321 | return (defonly ? false : true); | 321 | return (defonly ? false : true); |
322 | } | 322 | } |
323 | 323 | ||
324 | public void RequestRebake(IScenePresence sp, bool missingTexturesOnly) | 324 | public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) |
325 | { | 325 | { |
326 | int texturesRebaked = 0; | ||
327 | |||
326 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) | 328 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) |
327 | { | 329 | { |
328 | int idx = AvatarAppearance.BAKE_INDICES[i]; | 330 | int idx = AvatarAppearance.BAKE_INDICES[i]; |
@@ -359,8 +361,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
359 | face.TextureID, idx, sp.Name); | 361 | face.TextureID, idx, sp.Name); |
360 | } | 362 | } |
361 | 363 | ||
364 | texturesRebaked++; | ||
362 | sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | 365 | sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); |
363 | } | 366 | } |
367 | |||
368 | return texturesRebaked; | ||
364 | } | 369 | } |
365 | 370 | ||
366 | #endregion | 371 | #endregion |