Added warning for autoenc with chained 4x/8x interp, added option to re-use or delete temp folder for sbs

This commit is contained in:
N00MKRAD
2020-12-08 16:49:47 +01:00
parent fb453216f1
commit 79fd8b82dd
6 changed files with 55 additions and 22 deletions

View File

@@ -16,8 +16,9 @@ namespace Flowframes.Data
public FlowPackage pkg;
public int minPkgVer;
public bool supportsTiling;
public bool supportsAnyExp;
public AI(string aiNameArg, string friendlyNameArg, string descArg, FlowPackage pkgArg, int minPkgVerForThisBuild, bool supportsTilingArg)
public AI(string aiNameArg, string friendlyNameArg, string descArg, FlowPackage pkgArg, int minPkgVerForThisBuild, bool supportsTilingArg, bool supportsAnyExpArg)
{
aiName = aiNameArg;
aiNameShort = aiNameArg.Split(' ')[0];
@@ -27,6 +28,7 @@ namespace Flowframes.Data
pkg = pkgArg;
minPkgVer = minPkgVerForThisBuild;
supportsTiling = supportsTilingArg;
supportsAnyExp = supportsAnyExpArg;
}
}
}

View File

@@ -6,10 +6,10 @@ namespace Flowframes.Data
{
class Networks
{
public static AI rifeCuda = new AI("RIFE_CUDA", "RIFE", "CUDA/Pytorch Implementation of RIFE", Packages.rifeCuda, 2, false);
public static AI rifeNcnn = new AI("RIFE_NCNN", "RIFE (NCNN)", "Vulkan/NCNN Implementation of RIFE", Packages.rifeNcnn, 1, false);
public static AI dainNcnn = new AI("DAIN_NCNN", "DAIN (NCNN)", "Vulkan/NCNN Implementation of DAIN", Packages.dainNcnn, 0, true);
public static AI cainNcnn = new AI("CAIN_NCNN", "CAIN (NCNN)", "Vulkan/NCNN Implementation of CAIN", Packages.cainNcnn, 0, true);
public static AI rifeCuda = new AI("RIFE_CUDA", "RIFE", "CUDA/Pytorch Implementation of RIFE", Packages.rifeCuda, 2, false, true);
public static AI rifeNcnn = new AI("RIFE_NCNN", "RIFE (NCNN)", "Vulkan/NCNN Implementation of RIFE", Packages.rifeNcnn, 1, false, false);
public static AI dainNcnn = new AI("DAIN_NCNN", "DAIN (NCNN)", "Vulkan/NCNN Implementation of DAIN", Packages.dainNcnn, 0, true, true);
public static AI cainNcnn = new AI("CAIN_NCNN", "CAIN (NCNN)", "Vulkan/NCNN Implementation of CAIN", Packages.cainNcnn, 0, true, false);
public static List<AI> networks = new List<AI>();
@@ -19,7 +19,7 @@ namespace Flowframes.Data
networks.Add(rifeCuda);
networks.Add(rifeNcnn);
networks.Add(dainNcnn);
networks.Add(cainNcnn);
//networks.Add(cainNcnn);
}
}
}

View File

@@ -132,10 +132,7 @@ namespace Flowframes
dialog.InitialDirectory = inputTbox.Text.Trim();
dialog.IsFolderPicker = true;
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
inputTbox.Text = dialog.FileName;
MainUiFunctions.InitInput(outputTbox, inputTbox, fpsInTbox);
}
DragDropHandler(new string[] { dialog.FileName });
}
private void browseInputFileBtn_Click(object sender, EventArgs e)
@@ -144,10 +141,7 @@ namespace Flowframes
dialog.InitialDirectory = inputTbox.Text.Trim();
dialog.IsFolderPicker = false;
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
inputTbox.Text = dialog.FileName;
MainUiFunctions.InitInput(outputTbox, inputTbox, fpsInTbox);
}
DragDropHandler(new string[] { dialog.FileName });
}
private void browseOutBtn_Click(object sender, EventArgs e)
@@ -233,6 +227,8 @@ namespace Flowframes
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateOutputFPS();
if (Interpolate.interpFactor > 2 && !GetAi().supportsAnyExp && Config.GetInt("autoEncMode") > 0)
Logger.Log($"Warning: This AI will run multiple times for {Interpolate.interpFactor}x. Auto-Encode will only work on the last run.");
}
public void SetWorking(bool state)

View File

@@ -189,13 +189,20 @@ namespace Flowframes.IO
public static int GetAmountOfFiles (string path, bool recursive, string wildcard = "*")
{
DirectoryInfo d = new DirectoryInfo(path);
FileInfo[] files = null;
if (recursive)
files = d.GetFiles(wildcard, SearchOption.AllDirectories);
else
files = d.GetFiles(wildcard, SearchOption.TopDirectoryOnly);
return files.Length;
try
{
DirectoryInfo d = new DirectoryInfo(path);
FileInfo[] files = null;
if (recursive)
files = d.GetFiles(wildcard, SearchOption.AllDirectories);
else
files = d.GetFiles(wildcard, SearchOption.TopDirectoryOnly);
return files.Length;
}
catch
{
return 0;
}
}
static bool TryCopy(string source, string target)

View File

@@ -12,7 +12,7 @@ namespace Flowframes
{
static class Program
{
public const int version = 17;
public const int version = 18;
public static Form1 mainForm;

View File

@@ -36,6 +36,7 @@ namespace Flowframes.UI
Logger.Log($"Video FPS (Loaded from fps.ini): {fpsStr} - Total Number Of Frames: {InterpolateUtils.GetInputFrameCount(path)}");
else
Logger.Log($"Video FPS: {fpsStr} - Total Number Of Frames: {InterpolateUtils.GetInputFrameCount(path)}");
CheckExistingFolder(path, outputTbox.Text.Trim());
await Task.Delay(10);
await PrintResolution(path);
MagickDedupe.ClearCache();
@@ -43,6 +44,33 @@ namespace Flowframes.UI
InterpolateUtils.SetPreviewImg(await GetThumbnail(path));
}
static void CheckExistingFolder (string inpath, string outpath)
{
if (Config.GetInt("processingMode") == 0) return;
string tmpFolder = InterpolateUtils.GetTempFolderLoc(inpath, outpath);
if (Directory.Exists(tmpFolder))
{
int scnFrmAmount = IOUtils.GetAmountOfFiles(Path.Combine(tmpFolder, Paths.scenesDir), false, "*.png");
string scnFrames = scnFrmAmount > 0 ? $"{scnFrmAmount} scene frames" : "no scene frames";
int srcFrmAmount = IOUtils.GetAmountOfFiles(Path.Combine(tmpFolder, Paths.framesDir), false, "*.png");
string srcFrames = srcFrmAmount > 1 ? $"{srcFrmAmount} source frames" : "no source frames";
int interpFrmAmount = IOUtils.GetAmountOfFiles(Path.Combine(tmpFolder, Paths.interpDir), false);
string interpFrames = interpFrmAmount > 2 ? $"{interpFrmAmount} interpolated frames" : "no interpolated frames";
string msg = $"A temporary folder for this video already exists. It contains {scnFrames}, {srcFrames}, {interpFrames}.";
DialogResult dialogResult = MessageBox.Show($"{msg}\n\nClick \"Yes\" to use the existing files or \"No\" to delete them.", "Use files from existing temp folder?", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
return;
}
else if (dialogResult == DialogResult.No)
{
IOUtils.TryDeleteIfExists(tmpFolder);
Logger.Log("Deleted old temp folder.");
}
}
}
static async Task PrintResolution (string path)
{
Size res = new Size();