From 62b7650e692bedf3aa25ba63a46cdcdc5124e948 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 11 Feb 2021 12:33:09 +0100 Subject: [PATCH] better implementation that works for all three AIs --- Code/Main/InterpolateUtils.cs | 23 ++++------------------- Code/OS/AiProcess.cs | 4 ++-- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/Code/Main/InterpolateUtils.cs b/Code/Main/InterpolateUtils.cs index 24fc2c5..958ab90 100644 --- a/Code/Main/InterpolateUtils.cs +++ b/Code/Main/InterpolateUtils.cs @@ -96,25 +96,10 @@ namespace Flowframes.Main public static void UpdateLastFrameFromInterpOutput(string output) { - switch (AiProcess.currentAiName) - { - case "RIFE-CUDA": - { - Regex frameRegex = new Regex($@"(?<=> )\d*(?=.{GetOutExt()})"); - if (!frameRegex.IsMatch(output)) return; - lastFrame = int.Parse(frameRegex.Match(output).Value); - break; - } - case "RIFE-NCNN": - { - break; - } - case "DAIN": - { - break; - } - default: return; - } + string dainStr = AiProcess.currentAiName == "DAIN" ? " done" : ""; + Regex frameRegex = new Regex($@"(?<=.)\d*(?=.{GetOutExt()}{dainStr})"); + if (!frameRegex.IsMatch(output)) return; + lastFrame = Math.Max(int.Parse(frameRegex.Match(output).Value), lastFrame); } public static int interpolatedInputFramesCount; diff --git a/Code/OS/AiProcess.cs b/Code/OS/AiProcess.cs index 923e408..36d0b3e 100644 --- a/Code/OS/AiProcess.cs +++ b/Code/OS/AiProcess.cs @@ -93,7 +93,7 @@ namespace Flowframes if(Interpolate.currentlyUsingAutoEnc) // Ensure AutoEnc is not paused AutoEncode.paused = false; - currentAiName = "RIFE-CUDA"; + currentAiName = "RIFE"; string rifeDir = Path.Combine(Paths.GetPkgPath(), Path.GetFileNameWithoutExtension(Packages.rifeCuda.fileName)); string script = "rife.py"; @@ -154,7 +154,7 @@ namespace Flowframes processTimeMulti.Restart(); Logger.Log($"Running RIFE{(await InterpolateUtils.UseUHD() ? " (UHD Mode)" : "")}...", false); - currentAiName = "RIFE-NCNN"; + currentAiName = "RIFE"; await RunRifeNcnnMulti(framesPath, outPath, factor, mdl);