* Added code to support either CSJ2K or OpenJPEG texture decoding. Currently hardcoded to CSJ2K (so no functional change) but this could easily be switched to a config option

slimupdates
John Hurliman 2010-03-07 17:03:56 -08:00
parent d71ed7081b
commit fa38cf3ee8
1 changed files with 33 additions and 20 deletions

View File

@ -144,11 +144,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
/// <param name="j2kData">JPEG2000 data</param> /// <param name="j2kData">JPEG2000 data</param>
private void DoJ2KDecode(UUID assetID, byte[] j2kData) private void DoJ2KDecode(UUID assetID, byte[] j2kData)
{ {
bool USE_CSJ2K = true;
//int DecodeTime = 0; //int DecodeTime = 0;
//DecodeTime = Environment.TickCount; //DecodeTime = Environment.TickCount;
OpenJPEG.J2KLayerInfo[] layers; OpenJPEG.J2KLayerInfo[] layers;
if (!TryLoadCacheForAsset(assetID, out layers)) if (!TryLoadCacheForAsset(assetID, out layers))
{
if (USE_CSJ2K)
{ {
try try
{ {
@ -180,6 +184,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{ {
m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message); m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message);
} }
}
else
{
int components;
if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components))
{
m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID);
}
}
if (layers == null || layers.Length == 0) if (layers == null || layers.Length == 0)
{ {