mirror of https://github.com/n00mkrad/flowframes
Smarter deduplication messages
This commit is contained in:
parent
979eca6b50
commit
058820bc8e
|
@ -67,7 +67,7 @@ namespace Flowframes.Magick
|
|||
string frame1_name = framePaths[i].FullName;
|
||||
|
||||
// its likely we carried over an already loaded image from a previous iteration
|
||||
if(!(img1 != null && img1.FileName == frame1_name))
|
||||
if (!(img1 != null && img1.FileName == frame1_name))
|
||||
img1 = GetImage(framePaths[i].FullName);
|
||||
|
||||
if (img1 == null) continue;
|
||||
|
@ -81,7 +81,7 @@ namespace Flowframes.Magick
|
|||
|
||||
string frame2_name = framePaths[j].FullName;
|
||||
|
||||
if(j>=indEnd)
|
||||
if (j >= indEnd)
|
||||
{
|
||||
// if we are already extending outside of this thread's range and j is already flagged, then we need to abort
|
||||
bool isFlaggedForDeletion = false;
|
||||
|
@ -115,7 +115,7 @@ namespace Flowframes.Magick
|
|||
|
||||
Interlocked.Increment(ref statsFramesDeleted);
|
||||
|
||||
if (j+1 == framePaths.Length)
|
||||
if (j + 1 == framePaths.Length)
|
||||
return;
|
||||
|
||||
continue; // test next frame
|
||||
|
@ -190,7 +190,7 @@ namespace Flowframes.Magick
|
|||
foreach (string frame in framesToDelete)
|
||||
IoUtils.TryDeleteIfExists(frame);
|
||||
|
||||
string testStr = testRun ? " [TestRun]" : "";
|
||||
string testStr = testRun ? "[TESTRUN] " : "";
|
||||
|
||||
if (Interpolate.canceled) return;
|
||||
|
||||
|
@ -199,15 +199,17 @@ namespace Flowframes.Magick
|
|||
float percentDeleted = ((float)framesDeleted / framePaths.Length) * 100f;
|
||||
string keptPercent = $"{(100f - percentDeleted).ToString("0.0")}%";
|
||||
|
||||
Logger.Log($"[Deduplication]{testStr} Done. Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.", false, true);
|
||||
|
||||
if (statsFramesKept <= 0)
|
||||
if (framesDeleted <= 0)
|
||||
{
|
||||
Interpolate.Cancel("No frames were left after de-duplication!\n\nTry decreasing the de-duplication threshold.");
|
||||
Logger.Log($"Deduplication: No duplicate frames detected on this video.", false, true);
|
||||
}
|
||||
else if (statsFramesKept <= 0)
|
||||
{
|
||||
Interpolate.Cancel("No frames were left after de-duplication!\n\nTry lowering the de-duplication threshold.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Interpolate.InterpProgressMultiplier = (framePaths.Length / (float)framesLeft);
|
||||
Logger.Log($"{testStr}Deduplication: Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.", false, true);
|
||||
}
|
||||
}
|
||||
static float GetDifference(MagickImage img1, MagickImage img2)
|
||||
|
@ -243,14 +245,14 @@ namespace Flowframes.Magick
|
|||
|
||||
frames[fnameCur] = new List<string>();
|
||||
|
||||
if(!isLastItem)
|
||||
if (!isLastItem)
|
||||
{
|
||||
String fnameNext = Path.GetFileNameWithoutExtension(frameFiles[i + 1].Name);
|
||||
int frameNumNext = fnameNext.GetInt();
|
||||
|
||||
for(int j = frameNumCur + 1; j < frameNumNext; j++)
|
||||
for (int j = frameNumCur + 1; j < frameNumNext; j++)
|
||||
{
|
||||
frames[fnameCur].Add(j.ToString().PadLeft(9,'0'));
|
||||
frames[fnameCur].Add(j.ToString().PadLeft(9, '0'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,12 +146,13 @@ namespace Flowframes
|
|||
float percentDeleted = ((float)framesDeleted / currentMediaFile.FrameCount) * 100f;
|
||||
string keptPercent = $"{(100f - percentDeleted).ToString("0.0")}%";
|
||||
|
||||
if (framesDeleted > 0)
|
||||
{
|
||||
if (QuickSettingsTab.trimEnabled)
|
||||
Logger.Log($"Deduplication: Kept {framesLeft} frames.");
|
||||
else
|
||||
Logger.Log($"Deduplication: Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.");
|
||||
|
||||
// InterpProgressMultiplier = (currentMediaFile.FrameCount / (float)framesLeft);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Config.GetBool("allowConsecutiveSceneChanges", true))
|
||||
|
|
Loading…
Reference in New Issue