mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
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:
@@ -31,6 +31,7 @@ namespace Flowframes
|
|||||||
public string interpFolder;
|
public string interpFolder;
|
||||||
public bool inputIsFrames;
|
public bool inputIsFrames;
|
||||||
public bool dedupe;
|
public bool dedupe;
|
||||||
|
public bool noRedupe;
|
||||||
|
|
||||||
private Size _inputResolution = new Size();
|
private Size _inputResolution = new Size();
|
||||||
public Size InputResolution
|
public Size InputResolution
|
||||||
@@ -93,6 +94,7 @@ namespace Flowframes
|
|||||||
framesExt = "";
|
framesExt = "";
|
||||||
interpExt = "";
|
interpExt = "";
|
||||||
_inputResolution = new Size(0, 0);
|
_inputResolution = new Size(0, 0);
|
||||||
|
noRedupe = dedupe && interpFactor == 1;
|
||||||
SetPaths(inPath);
|
SetPaths(inPath);
|
||||||
RefreshExtensions(ai: ai);
|
RefreshExtensions(ai: ai);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ namespace Flowframes.Magick
|
|||||||
|
|
||||||
public static async Task CreateDupesFile(string framesPath, string ext)
|
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);
|
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)
|
public static async Task CreateFramesFileVideo(string videoPath, bool loop)
|
||||||
@@ -300,6 +301,14 @@ namespace Flowframes.Magick
|
|||||||
float keepPercentage = (float)inputFrames.Count / frameCount * 100f;
|
float keepPercentage = (float)inputFrames.Count / frameCount * 100f;
|
||||||
Logger.Log($"Dedupe: Kept {inputFrames.Count}/{frameCount} frames ({keepPercentage.ToString("0.#")}%)");
|
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)
|
if (keepPercentage > 95f)
|
||||||
{
|
{
|
||||||
Logger.Log("Dedupe: Less than 5% duplicate frames detected, will not dedupe.");
|
Logger.Log("Dedupe: Less than 5% duplicate frames detected, will not dedupe.");
|
||||||
|
|||||||
@@ -98,7 +98,10 @@ namespace Flowframes.Os
|
|||||||
l.Add($"");
|
l.Add($"");
|
||||||
l.Add($"srcFrames = len(clip)");
|
l.Add($"srcFrames = len(clip)");
|
||||||
l.Add(Debugger.IsAttached ? $"clip = core.text.FrameNum(clip, alignment=7, scale={txtScale}) # Input frame counter" : "");
|
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($"");
|
l.Add($"");
|
||||||
|
|
||||||
if (trim)
|
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}";
|
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
|
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(GetRedupeLines(s));
|
||||||
l.Add($"");
|
l.Add($"");
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ namespace Flowframes.Ui
|
|||||||
|
|
||||||
public static float ValidateInterpFactor (float factor)
|
public static float ValidateInterpFactor (float factor)
|
||||||
{
|
{
|
||||||
|
if (factor == 1)
|
||||||
|
return factor;
|
||||||
|
|
||||||
AiInfo ai = Program.mainForm.GetAi();
|
AiInfo ai = Program.mainForm.GetAi();
|
||||||
|
|
||||||
if (ai.NameInternal == Implementations.rifeNcnn.NameInternal && !Program.mainForm.GetModel(ai).Dir.Contains("v4"))
|
if (ai.NameInternal == Implementations.rifeNcnn.NameInternal && !Program.mainForm.GetModel(ai).Dir.Contains("v4"))
|
||||||
|
|||||||
Reference in New Issue
Block a user