Fixed GetHash file lock, AE safety buffers in config, increased to 90 for ncnn

This commit is contained in:
N00MKRAD
2021-01-17 20:05:39 +01:00
parent 9e52c25b2b
commit f13dffbeb8
5 changed files with 18 additions and 10 deletions

View File

@@ -27,7 +27,8 @@ namespace Flowframes.Main
public static void UpdateChunkAndBufferSizes ()
{
chunkSize = GetChunkSize(IOUtils.GetAmountOfFiles(Interpolate.current.framesFolder, false, "*.png") * Interpolate.current.interpFactor);
safetyBufferFrames = Interpolate.current.ai.aiName.ToUpper().Contains("NCNN") ? 60 : 30; // Use bigger safety buffer for NCNN
bool isNcnn = Interpolate.current.ai.aiName.ToUpper().Contains("NCNN");
safetyBufferFrames = isNcnn ? Config.GetInt("autoEncSafeBufferNcnn", 90) : Config.GetInt("autoEncSafeBufferCuda", 30); // Use bigger safety buffer for NCNN
}
public static async Task MainLoop(string interpFramesPath)

View File

@@ -43,17 +43,14 @@ namespace Flowframes
currentInputFrameCount = await Utils.GetInputFrameCountAsync(current.inPath);
Program.mainForm.SetStatus("Starting...");
Program.mainForm.SetWorking(true);
await Task.Delay(10);
if (!current.inputIsFrames) // Input is video - extract frames first
await ExtractFrames(current.inPath, current.framesFolder);
else
await FFmpegCommands.ImportImages(current.inPath, current.framesFolder, await Utils.GetOutputResolution(current.inPath, true));
if (canceled) return;
sw.Restart();
await Task.Delay(10);
await PostProcessFrames();
if (canceled) return;
Program.mainForm.SetStatus("Running AI...");
await RunAi(current.interpFolder, current.ai);
if (canceled) return;
Program.mainForm.SetProgress(100);
@@ -135,6 +132,7 @@ namespace Flowframes
public static async Task RunAi(string outpath, AI ai, bool stepByStep = false)
{
Program.mainForm.SetStatus("Downloading models...");
await ModelDownloader.DownloadModelFiles(Path.GetFileNameWithoutExtension(ai.pkg.fileName), current.model);
if (canceled) return;
@@ -156,6 +154,7 @@ namespace Flowframes
tasks.Add(AutoEncode.MainLoop(outpath));
}
Program.mainForm.SetStatus("Running AI...");
await Task.WhenAll(tasks);
}

View File

@@ -354,7 +354,7 @@ namespace Flowframes.Main
}
}
public static int RoundDiv2(int n) // Round to a number that's divisible by 2 (for h264)
public static int RoundDiv2(int n) // Round to a number that's divisible by 2 (for h264 etc)
{
int a = (n / 2) * 2; // Smaller multiple
int b = a + 2; // Larger multiple