mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-17 00:47:48 +01:00
Smarter deduplication messages
This commit is contained in:
@@ -67,7 +67,7 @@ namespace Flowframes.Magick
|
|||||||
string frame1_name = framePaths[i].FullName;
|
string frame1_name = framePaths[i].FullName;
|
||||||
|
|
||||||
// its likely we carried over an already loaded image from a previous iteration
|
// 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);
|
img1 = GetImage(framePaths[i].FullName);
|
||||||
|
|
||||||
if (img1 == null) continue;
|
if (img1 == null) continue;
|
||||||
@@ -81,7 +81,7 @@ namespace Flowframes.Magick
|
|||||||
|
|
||||||
string frame2_name = framePaths[j].FullName;
|
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
|
// if we are already extending outside of this thread's range and j is already flagged, then we need to abort
|
||||||
bool isFlaggedForDeletion = false;
|
bool isFlaggedForDeletion = false;
|
||||||
@@ -115,7 +115,7 @@ namespace Flowframes.Magick
|
|||||||
|
|
||||||
Interlocked.Increment(ref statsFramesDeleted);
|
Interlocked.Increment(ref statsFramesDeleted);
|
||||||
|
|
||||||
if (j+1 == framePaths.Length)
|
if (j + 1 == framePaths.Length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
continue; // test next frame
|
continue; // test next frame
|
||||||
@@ -190,7 +190,7 @@ namespace Flowframes.Magick
|
|||||||
foreach (string frame in framesToDelete)
|
foreach (string frame in framesToDelete)
|
||||||
IoUtils.TryDeleteIfExists(frame);
|
IoUtils.TryDeleteIfExists(frame);
|
||||||
|
|
||||||
string testStr = testRun ? " [TestRun]" : "";
|
string testStr = testRun ? "[TESTRUN] " : "";
|
||||||
|
|
||||||
if (Interpolate.canceled) return;
|
if (Interpolate.canceled) return;
|
||||||
|
|
||||||
@@ -199,15 +199,17 @@ namespace Flowframes.Magick
|
|||||||
float percentDeleted = ((float)framesDeleted / framePaths.Length) * 100f;
|
float percentDeleted = ((float)framesDeleted / framePaths.Length) * 100f;
|
||||||
string keptPercent = $"{(100f - percentDeleted).ToString("0.0")}%";
|
string keptPercent = $"{(100f - percentDeleted).ToString("0.0")}%";
|
||||||
|
|
||||||
Logger.Log($"[Deduplication]{testStr} Done. Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.", false, true);
|
if (framesDeleted <= 0)
|
||||||
|
|
||||||
if (statsFramesKept <= 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
|
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)
|
static float GetDifference(MagickImage img1, MagickImage img2)
|
||||||
@@ -243,14 +245,14 @@ namespace Flowframes.Magick
|
|||||||
|
|
||||||
frames[fnameCur] = new List<string>();
|
frames[fnameCur] = new List<string>();
|
||||||
|
|
||||||
if(!isLastItem)
|
if (!isLastItem)
|
||||||
{
|
{
|
||||||
String fnameNext = Path.GetFileNameWithoutExtension(frameFiles[i + 1].Name);
|
String fnameNext = Path.GetFileNameWithoutExtension(frameFiles[i + 1].Name);
|
||||||
int frameNumNext = fnameNext.GetInt();
|
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;
|
float percentDeleted = ((float)framesDeleted / currentMediaFile.FrameCount) * 100f;
|
||||||
string keptPercent = $"{(100f - percentDeleted).ToString("0.0")}%";
|
string keptPercent = $"{(100f - percentDeleted).ToString("0.0")}%";
|
||||||
|
|
||||||
|
if (framesDeleted > 0)
|
||||||
|
{
|
||||||
if (QuickSettingsTab.trimEnabled)
|
if (QuickSettingsTab.trimEnabled)
|
||||||
Logger.Log($"Deduplication: Kept {framesLeft} frames.");
|
Logger.Log($"Deduplication: Kept {framesLeft} frames.");
|
||||||
else
|
else
|
||||||
Logger.Log($"Deduplication: Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.");
|
Logger.Log($"Deduplication: Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.");
|
||||||
|
}
|
||||||
// InterpProgressMultiplier = (currentMediaFile.FrameCount / (float)framesLeft);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.GetBool("allowConsecutiveSceneChanges", true))
|
if (!Config.GetBool("allowConsecutiveSceneChanges", true))
|
||||||
|
|||||||
Reference in New Issue
Block a user