mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-09-01 19:51:28 +02:00
Added RIFE-NCNN 2.0 workaround, fixed current.stepByStep wrong value
This commit is contained in:
@@ -99,7 +99,7 @@ namespace Flowframes.IO
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Copy(string sourceDirectoryName, string targetDirectoryName, bool move = false)
|
||||
public static void CopyDir(string sourceDirectoryName, string targetDirectoryName, bool move = false)
|
||||
{
|
||||
Directory.CreateDirectory(targetDirectoryName);
|
||||
DirectoryInfo source = new DirectoryInfo(sourceDirectoryName);
|
||||
@@ -195,7 +195,7 @@ namespace Flowframes.IO
|
||||
}
|
||||
}
|
||||
|
||||
static bool TryCopy(string source, string target, bool overwrite = true)
|
||||
static bool TryCopy(string source, string target, bool overwrite = true, bool showLog = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -203,14 +203,14 @@ namespace Flowframes.IO
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($"Failed to move '{source}' to '{target}' (Overwrite: {overwrite}): {e.Message}");
|
||||
Logger.Log($"Failed to move '{source}' to '{target}' (Overwrite: {overwrite}): {e.Message}, !showLog");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryMove(string source, string target, bool overwrite = true)
|
||||
public static bool TryMove(string source, string target, bool overwrite = true, bool showLog = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -221,7 +221,7 @@ namespace Flowframes.IO
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($"Failed to move '{source}' to '{target}' (Overwrite: {overwrite}): {e.Message}");
|
||||
Logger.Log($"Failed to move '{source}' to '{target}' (Overwrite: {overwrite}): {e.Message}", !showLog);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,6 +223,7 @@ namespace Flowframes
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Log("Deleting temp folder because current.stepByStep = " + current.stepByStep);
|
||||
IOUtils.TryDeleteIfExists(current.tempFolder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Flowframes.Main
|
||||
Program.mainForm.SetWorking(true);
|
||||
current = Program.mainForm.GetCurrentSettings();
|
||||
current.RefreshAlpha();
|
||||
current.stepByStep = false;
|
||||
current.stepByStep = true;
|
||||
|
||||
if (!InterpolateUtils.InputIsValid(current.inPath, current.outPath, current.outFps, current.interpFactor, current.outMode)) return; // General input checks
|
||||
|
||||
|
||||
@@ -203,6 +203,9 @@ namespace Flowframes
|
||||
string uhdStr = await InterpolateUtils.UseUHD() ? "-u" : "";
|
||||
string ttaStr = Config.GetBool("rifeNcnnUseTta", false) ? "-x" : "";
|
||||
|
||||
string oldMdlName = mdl;
|
||||
mdl = RifeNcnn2Workaround(mdl); // TODO: REMOVE ONCE NIHUI HAS GOTTEN RID OF THE SHITTY HARDCODED VERSION CHECK
|
||||
|
||||
rifeNcnn.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {PkgUtils.GetPkgFolder(Packages.rifeNcnn).Wrap()} & rife-ncnn-vulkan.exe " +
|
||||
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} -m {mdl.ToLower()} {ttaStr} {uhdStr} -g {Config.Get("ncnnGpus")} -f {GetNcnnPattern()} -j {GetNcnnThreads()}";
|
||||
|
||||
@@ -223,6 +226,7 @@ namespace Flowframes
|
||||
}
|
||||
|
||||
while (!rifeNcnn.HasExited) await Task.Delay(1);
|
||||
RifeNcnn2Workaround(oldMdlName, true);
|
||||
}
|
||||
|
||||
public static async Task RunDainNcnn(string framesPath, string outPath, float factor, string mdl, int tilesize)
|
||||
@@ -363,5 +367,27 @@ namespace Flowframes
|
||||
|
||||
return $"4:{progThreadsStr}:4"; ;
|
||||
}
|
||||
|
||||
static string RifeNcnn2Workaround (string modelName, bool reset = false)
|
||||
{
|
||||
if (modelName != "RIFE20") return modelName;
|
||||
string validMdlName = "rife-v2";
|
||||
string rifeFolderPath = Path.Combine(Paths.GetPkgPath(), Path.GetFileNameWithoutExtension(Packages.rifeNcnn.fileName));
|
||||
string modelFolderPath = Path.Combine(rifeFolderPath, modelName);
|
||||
string fixedModelFolderPath = Path.Combine(rifeFolderPath, validMdlName);
|
||||
|
||||
if (!reset)
|
||||
{
|
||||
IOUtils.TryDeleteIfExists(fixedModelFolderPath);
|
||||
Directory.Move(modelFolderPath, fixedModelFolderPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
IOUtils.TryDeleteIfExists(modelFolderPath);
|
||||
Directory.Move(fixedModelFolderPath, modelFolderPath);
|
||||
}
|
||||
|
||||
return validMdlName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user