Test "1x interpolation" (dedupe, then interp back to orig. frame count)

Also fixes issue with having dedupe enabled on videos that have no (<5%) dupes
This commit is contained in:
N00MKRAD
2025-02-10 21:03:05 +01:00
parent c38df3f872
commit 4447731cbc
4 changed files with 21 additions and 4 deletions

View File

@@ -31,6 +31,7 @@ namespace Flowframes
public string interpFolder;
public bool inputIsFrames;
public bool dedupe;
public bool noRedupe;
private Size _inputResolution = new Size();
public Size InputResolution
@@ -93,6 +94,7 @@ namespace Flowframes
framesExt = "";
interpExt = "";
_inputResolution = new Size(0, 0);
noRedupe = dedupe && interpFactor == 1;
SetPaths(inPath);
RefreshExtensions(ai: ai);
}

View File

@@ -228,7 +228,7 @@ namespace Flowframes.Magick
public static async Task CreateDupesFile(string framesPath, string ext)
{
bool debug = Config.GetBool("dupeScanDebug", false);
bool debug = true; Config.GetBool("dupeScanDebug", false);
FileInfo[] frameFiles = IoUtils.GetFileInfosSorted(framesPath, false, "*" + ext);
@@ -259,7 +259,8 @@ namespace Flowframes.Magick
}
}
File.WriteAllText(Path.Combine(framesPath.GetParentDir(), "dupes.json"), frames.ToJson(true));
// string tempDir =
// File.WriteAllText(Path.Combine(framesPath.GetParentDir(), "dupes.json"), frames.ToJson(true));
}
public static async Task CreateFramesFileVideo(string videoPath, bool loop)
@@ -300,6 +301,14 @@ namespace Flowframes.Magick
float keepPercentage = (float)inputFrames.Count / frameCount * 100f;
Logger.Log($"Dedupe: Kept {inputFrames.Count}/{frameCount} frames ({keepPercentage.ToString("0.#")}%)");
if(Interpolate.currentSettings != null && Interpolate.currentSettings.interpFactor == 1)
{
Interpolate.currentSettings.interpFactor = ((float)frameCount / inputFrames.Count);
Logger.Log($"Dedupe: Factor is 1, will not redupe; overriding factor to {frameCount}/{inputFrames.Count} = {Interpolate.currentSettings.interpFactor.ToString("0.######")}", true);
}
Logger.Log($"");
if (keepPercentage > 95f)
{
Logger.Log("Dedupe: Less than 5% duplicate frames detected, will not dedupe.");

View File

@@ -98,7 +98,10 @@ namespace Flowframes.Os
l.Add($"");
l.Add($"srcFrames = len(clip)");
l.Add(Debugger.IsAttached ? $"clip = core.text.FrameNum(clip, alignment=7, scale={txtScale}) # Input frame counter" : "");
l.Add(GetDedupeLines(s));
if(s.InterpSettings.dedupe)
l.Add(GetDedupeLines(s));
l.Add($"");
if (trim)
@@ -140,7 +143,7 @@ namespace Flowframes.Os
string interpStr = alwaysPreferFactorOverFps || Interpolate.currentMediaFile.IsVfr ? $"factor_num={factor.Numerator}, factor_den={factor.Denominator}" : $"fps_num={outFps.Numerator}, fps_den={outFps.Denominator}";
l.Add($"clip = core.rife.RIFE(clip, {interpStr}, model_path={mdlPath}, gpu_id={s.GpuId.ToString().Replace("-1", "None")}, gpu_thread={s.GpuThreads}, tta={s.Tta}, uhd={s.Uhd}, sc={sc})"); // Interpolate
if (s.Dedupe && !s.Realtime)
if (s.Dedupe && !s.InterpSettings.noRedupe && !s.Realtime)
{
l.Add(GetRedupeLines(s));
l.Add($"");

View File

@@ -169,6 +169,9 @@ namespace Flowframes.Ui
public static float ValidateInterpFactor (float factor)
{
if (factor == 1)
return factor;
AiInfo ai = Program.mainForm.GetAi();
if (ai.NameInternal == Implementations.rifeNcnn.NameInternal && !Program.mainForm.GetModel(ai).Dir.Contains("v4"))