mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
Allow fractional factor input (WIP: Disallow for FLAVR/RIFE-CUDA)
This commit is contained in:
@@ -45,7 +45,7 @@ namespace Flowframes
|
||||
|
||||
public InterpSettings() { }
|
||||
|
||||
public InterpSettings(string inPathArg, string outPathArg, AI aiArg, Fraction inFpsDetectedArg, Fraction inFpsArg, int interpFactorArg, float itsScale, Interpolate.OutMode outModeArg, ModelCollection.ModelInfo modelArg)
|
||||
public InterpSettings(string inPathArg, string outPathArg, AI aiArg, Fraction inFpsDetectedArg, Fraction inFpsArg, float interpFactorArg, float itsScale, Interpolate.OutMode outModeArg, ModelCollection.ModelInfo modelArg)
|
||||
{
|
||||
inPath = inPathArg;
|
||||
outPath = outPathArg;
|
||||
|
||||
@@ -102,10 +102,11 @@ namespace Flowframes
|
||||
|
||||
if (arg.StartsWith("factor="))
|
||||
{
|
||||
int factor = arg.Split('=').Last().GetInt();
|
||||
if (factor == 2) interpFactorCombox.SelectedIndex = 0;
|
||||
if (factor == 4) interpFactorCombox.SelectedIndex = 1;
|
||||
if (factor == 8) interpFactorCombox.SelectedIndex = 2;
|
||||
float factor = arg.Split('=').Last().GetFloat();
|
||||
interpFactorCombox.Text = factor.ToString();
|
||||
//if (factor == 2) interpFactorCombox.SelectedIndex = 0;
|
||||
//if (factor == 4) interpFactorCombox.SelectedIndex = 1;
|
||||
//if (factor == 8) interpFactorCombox.SelectedIndex = 2;
|
||||
}
|
||||
|
||||
if (arg.StartsWith("ai="))
|
||||
@@ -165,7 +166,7 @@ namespace Flowframes
|
||||
{
|
||||
SetTab("interpolate");
|
||||
return new InterpSettings(inputTbox.Text.Trim(), outputTbox.Text.Trim(), GetAi(), currInFpsDetected, currInFps,
|
||||
interpFactorCombox.GetInt(), outSpeedCombox.GetInt().Clamp(1, 64), GetOutMode(), GetModel(GetAi()));
|
||||
interpFactorCombox.GetFloat(), outSpeedCombox.GetInt().Clamp(1, 64), GetOutMode(), GetModel(GetAi()));
|
||||
}
|
||||
|
||||
public InterpSettings UpdateCurrentSettings(InterpSettings settings)
|
||||
@@ -183,7 +184,7 @@ namespace Flowframes
|
||||
settings.ai = GetAi();
|
||||
settings.inFpsDetected = currInFpsDetected;
|
||||
settings.inFps = currInFps;
|
||||
settings.interpFactor = interpFactorCombox.GetInt();
|
||||
settings.interpFactor = interpFactorCombox.GetFloat();
|
||||
settings.outFps = settings.inFps * settings.interpFactor;
|
||||
settings.outMode = GetOutMode();
|
||||
settings.model = GetModel(GetAi());
|
||||
@@ -414,17 +415,17 @@ namespace Flowframes
|
||||
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateUiFps();
|
||||
int guiFactor = interpFactorCombox.GetInt();
|
||||
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
string aiName = GetAi().aiName.Replace("_", "-");
|
||||
//int guiFactor = interpFactorCombox.GetInt();
|
||||
//
|
||||
//if (!initialized)
|
||||
// return;
|
||||
//
|
||||
//string aiName = GetAi().aiName.Replace("_", "-");
|
||||
}
|
||||
|
||||
public void ValidateFactor()
|
||||
{
|
||||
interpFactorCombox.Text = $"x{MainUiFunctions.ValidateInterpFactor(interpFactorCombox.GetInt())}";
|
||||
interpFactorCombox.Text = $"x{MainUiFunctions.ValidateInterpFactor(interpFactorCombox.GetFloat())}";
|
||||
}
|
||||
|
||||
public void SetWorking(bool state, bool allowCancel = true)
|
||||
|
||||
@@ -260,37 +260,6 @@ namespace Flowframes.Os
|
||||
await AiFinished("RIFE");
|
||||
}
|
||||
|
||||
// static async Task RunRifeNcnnMulti(string framesPath, string outPath, int factor, string mdl)
|
||||
// {
|
||||
// int times = (int)Math.Log(factor, 2);
|
||||
//
|
||||
// if (times > 1)
|
||||
// AutoEncode.paused = true; // Disable autoenc until the last iteration
|
||||
// else
|
||||
// AutoEncode.paused = false;
|
||||
//
|
||||
// for (int iteration = 1; iteration <= times; iteration++)
|
||||
// {
|
||||
// if (Interpolate.canceled) return;
|
||||
//
|
||||
// if (Interpolate.currentlyUsingAutoEnc && iteration == times) // Enable autoenc if this is the last iteration
|
||||
// AutoEncode.paused = false;
|
||||
//
|
||||
// if (iteration > 1)
|
||||
// {
|
||||
// Logger.Log($"Re-Running RIFE for {Math.Pow(2, iteration)}x interpolation...", false);
|
||||
// string lastInterpPath = outPath + $"-run{iteration - 1}";
|
||||
// Directory.Move(outPath, lastInterpPath); // Rename last interp folder
|
||||
// await RunRifeNcnnProcess(lastInterpPath, outPath, mdl);
|
||||
// await IoUtils.TryDeleteIfExistsAsync(lastInterpPath);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// await RunRifeNcnnProcess(framesPath, outPath, mdl);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
static async Task RunRifeNcnnProcess(string inPath, float factor, string outPath, string mdl)
|
||||
{
|
||||
Directory.CreateDirectory(outPath);
|
||||
|
||||
@@ -153,12 +153,12 @@ namespace Flowframes.Ui
|
||||
}
|
||||
}
|
||||
|
||||
public static int ValidateInterpFactor (int factor)
|
||||
public static float ValidateInterpFactor (float factor)
|
||||
{
|
||||
AI ai = Program.mainForm.GetAi();
|
||||
|
||||
if (factor > 256)
|
||||
return 256;
|
||||
if (factor > 256f)
|
||||
return 256f;
|
||||
|
||||
// NO LONGER NEEDED WITH RIFE 3.9
|
||||
//if (ai.aiName == Implementations.rifeCuda.aiName)
|
||||
|
||||
Reference in New Issue
Block a user