Tweaks and performance fixes

This commit is contained in:
Deukhoofd committed 2025-08-18 20:25:04 +02:00
1 parent 29ddcd8d74
commit ede4a90639
4 files changed
+54 -38

No files matched your search

+22 -9
View File
@@ -30,7 +30,7 @@ public static class Program
morph.SetDensity(2); // Higher than 1 sets fluid to 0.
morph.SetMotion(InterpolationMethod.Spline);
morph.SetFading(InterpolationMethod.Perlin);
morph.SetThreads(80);
morph.SetThreads(16);
morph.SetCycleLength(10000);
morph.SetFeather(0);
morph.SetKeepBackground(false);
@@ -48,7 +48,7 @@ public static class Program
if (options.Verbose)
{
var duration = programEnd - programStart;
Console.WriteLine($"Program completed in {duration.TotalSeconds:0.00} seconds.");
Console.WriteLine($"Program completed in {duration.TotalSeconds:F2} seconds.");
}
return 0;
@@ -150,6 +150,7 @@ public static class Program
ulong match_blobs = 0;
ulong morph_atoms = 0;
var fs = options.Files.Count;
var stepsWithoutEnergyChange = 0;
while (true)
{
@@ -187,9 +188,9 @@ public static class Program
{
double e = morph.GetEnergy();
if (last_energy < e)
Console.WriteLine($"Matching blobs, absolute energy was {e:30.10f}.");
Console.WriteLine($"Matching blobs, absolute energy was {e:F2}.");
else
Console.WriteLine($"Matching blobs, energy decreased by {last_energy - e:30.10f}.");
Console.WriteLine($"Matching blobs, energy decreased by {last_energy - e:F2}.");
last_energy = e;
}
if (++match_blobs >= options.MatchTime)
@@ -200,15 +201,27 @@ public static class Program
}
else if (morph_state == MorphState.AtomMorphing)
{
double e = morph.GetEnergy();
if (options.Verbose)
{
double e = morph.GetEnergy();
if (last_energy < e)
Console.WriteLine($"Matching atoms, absolute energy was {e:30.10f}.");
Console.WriteLine($"Matching atoms, absolute energy was {e:F2}.");
else
Console.WriteLine($"Matching atoms, energy decreased by {last_energy - e:30.10f}.");
last_energy = e;
Console.WriteLine(
$"Matching atoms, energy decreased by {last_energy - e:F2}");
}
if (last_energy == e)
{
stepsWithoutEnergyChange++;
if (stepsWithoutEnergyChange > 3)
{
if (options.Verbose)
Console.WriteLine("No energy change for 3 steps, moving to next state.");
morph.NextState();
}
}
last_energy = e;
if (++morph_atoms >= options.MorphTime)
{
morph.NextState();
@@ -233,7 +246,7 @@ public static class Program
if (options.Verbose)
{
Console.WriteLine("Frame %lu had the most blobs (%lu).\n", largest_frame, blob_count);
Console.WriteLine($"Frame {largest_frame} had the most blobs {blob_count}.\n");
}
return;