Remove predecode-j2k and it's assoaciated logic
parent
d0bf084da5
commit
67fefdb5a0
|
@ -306,10 +306,6 @@ namespace OpenSim
|
||||||
"delete-region <name>",
|
"delete-region <name>",
|
||||||
"Delete a region from disk", RunCommand);
|
"Delete a region from disk", RunCommand);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "predecode-j2k",
|
|
||||||
"predecode-j2k [<num threads>]>",
|
|
||||||
"Precache assets,decode j2k layerdata", RunCommand);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "modules list",
|
m_console.Commands.AddCommand("region", false, "modules list",
|
||||||
"modules list",
|
"modules list",
|
||||||
"List modules", HandleModules);
|
"List modules", HandleModules);
|
||||||
|
@ -744,22 +740,6 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
break;
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -540,127 +540,5 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_localScenes.ForEach(action);
|
m_localScenes.ForEach(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CacheJ2kDecode(int threads)
|
|
||||||
{
|
|
||||||
if (threads < 1) threads = 1;
|
|
||||||
|
|
||||||
IJ2KDecoder m_decoder = m_localScenes[0].RequestModuleInterface<IJ2KDecoder>();
|
|
||||||
|
|
||||||
List<UUID> assetRequestList = new List<UUID>();
|
|
||||||
|
|
||||||
#region AssetGathering!
|
|
||||||
foreach (Scene scene in m_localScenes)
|
|
||||||
{
|
|
||||||
List<EntityBase> 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<te.FaceTextures.Length; i++)
|
|
||||||
{
|
|
||||||
if (te.FaceTextures[i] != null)
|
|
||||||
{
|
|
||||||
if (te.FaceTextures[i].TextureID != UUID.Zero)
|
|
||||||
{
|
|
||||||
assetRequestList.Add(te.FaceTextures[i].TextureID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (part.Shape.SculptTexture != UUID.Zero)
|
|
||||||
{
|
|
||||||
assetRequestList.Add(part.Shape.SculptTexture);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
int entries_per_thread = (assetRequestList.Count / threads) + 1;
|
|
||||||
|
|
||||||
UUID[] arrAssetRequestList = assetRequestList.ToArray();
|
|
||||||
|
|
||||||
List<UUID[]> arrvalus = new List<UUID[]>();
|
|
||||||
|
|
||||||
//split into separate arrays
|
|
||||||
for (int j = 0; j < threads; j++)
|
|
||||||
{
|
|
||||||
List<UUID> val = new List<UUID>();
|
|
||||||
|
|
||||||
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<arrassets.Length;i++)
|
|
||||||
{
|
|
||||||
AssetBase ab = sn.AssetService.Get(arrassets[i].ToString());
|
|
||||||
if (ab != null && ab.Data != null)
|
|
||||||
{
|
|
||||||
j2kdecode.Decode(arrassets[i], ab.Data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ThreadTracker.Remove(thisthread);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetThread(System.Threading.Thread thr)
|
|
||||||
{
|
|
||||||
thisthread = thr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue