Improve "j2k decode" command to tell us how many layers and components were decoded, instead of just success/failure
parent
5ea9740f1b
commit
b86e7715a8
|
@ -133,13 +133,20 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
|
|
||||||
// Do Decode!
|
// Do Decode!
|
||||||
if (decode)
|
if (decode)
|
||||||
DoJ2KDecode(assetID, j2kData);
|
Decode(assetID, j2kData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Decode(UUID assetID, byte[] j2kData)
|
public bool Decode(UUID assetID, byte[] j2kData)
|
||||||
{
|
{
|
||||||
return DoJ2KDecode(assetID, j2kData);
|
OpenJPEG.J2KLayerInfo[] layers;
|
||||||
|
int components;
|
||||||
|
return Decode(assetID, j2kData, out layers, out components);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components)
|
||||||
|
{
|
||||||
|
return DoJ2KDecode(assetID, j2kData, out layers, out components);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion IJ2KDecoder
|
#endregion IJ2KDecoder
|
||||||
|
@ -149,7 +156,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assetID">UUID of Asset</param>
|
/// <param name="assetID">UUID of Asset</param>
|
||||||
/// <param name="j2kData">JPEG2000 data</param>
|
/// <param name="j2kData">JPEG2000 data</param>
|
||||||
private bool DoJ2KDecode(UUID assetID, byte[] j2kData)
|
/// <param name="layers">layer data</param>
|
||||||
|
/// <param name="components">number of components</param>
|
||||||
|
/// <returns>true if decode was successful. false otherwise.</returns>
|
||||||
|
private bool DoJ2KDecode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID);
|
// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID);
|
||||||
|
@ -158,7 +168,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
|
|
||||||
//int DecodeTime = 0;
|
//int DecodeTime = 0;
|
||||||
//DecodeTime = Environment.TickCount;
|
//DecodeTime = Environment.TickCount;
|
||||||
OpenJPEG.J2KLayerInfo[] layers;
|
|
||||||
|
// We don't get this from CSJ2K. Is it relevant?
|
||||||
|
components = 0;
|
||||||
|
|
||||||
if (!TryLoadCacheForAsset(assetID, out layers))
|
if (!TryLoadCacheForAsset(assetID, out layers))
|
||||||
{
|
{
|
||||||
|
@ -198,7 +210,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int components;
|
|
||||||
if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components))
|
if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components))
|
||||||
{
|
{
|
||||||
m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID);
|
m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID);
|
||||||
|
|
|
@ -43,5 +43,15 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="j2kData"></param>
|
/// <param name="j2kData"></param>
|
||||||
/// <returns>true if decode was successful. false otherwise.</returns>
|
/// <returns>true if decode was successful. false otherwise.</returns>
|
||||||
bool Decode(UUID assetID, byte[] j2kData);
|
bool Decode(UUID assetID, byte[] j2kData);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a synchronous decode so that caller can be assured that this executes before the next line
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assetID"></param>
|
||||||
|
/// <param name="j2kData"></param>
|
||||||
|
/// <param name="layers">layer data</param>
|
||||||
|
/// <param name="components">number of components</param>
|
||||||
|
/// <returns>true if decode was successful. false otherwise.</returns>
|
||||||
|
bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ using log4net;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.Imaging;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
@ -137,9 +138,18 @@ namespace OpenSim.Region.OptionalModules.Agent.TextureSender
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decoder.Decode(assetId, asset.Data))
|
OpenJPEG.J2KLayerInfo[] layers;
|
||||||
MainConsole.Instance.OutputFormat("Successfully decoded asset {0}", assetId);
|
int components;
|
||||||
|
if (decoder.Decode(assetId, asset.Data, out layers, out components))
|
||||||
|
{
|
||||||
|
MainConsole.Instance.OutputFormat(
|
||||||
|
"Successfully decoded asset {0} with {1} layers and {2} components",
|
||||||
|
assetId, layers.Length, components);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
MainConsole.Instance.OutputFormat("Decode of asset {0} failed", assetId); }
|
{
|
||||||
|
MainConsole.Instance.OutputFormat("Decode of asset {0} failed", assetId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue