mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
config option to allow using custom interp factor
This commit is contained in:
1
Code/Form1.Designer.cs
generated
1
Code/Form1.Designer.cs
generated
@@ -322,6 +322,7 @@
|
||||
this.interpFactorCombox.Size = new System.Drawing.Size(100, 23);
|
||||
this.interpFactorCombox.TabIndex = 7;
|
||||
this.interpFactorCombox.SelectedIndexChanged += new System.EventHandler(this.interpFactorCombox_SelectedIndexChanged);
|
||||
this.interpFactorCombox.TextUpdate += new System.EventHandler(this.interpFactorCombox_SelectedIndexChanged);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Flowframes
|
||||
NvApi.Init();
|
||||
InitAis();
|
||||
InterpolationProgress.preview = previewPicturebox;
|
||||
UnlockInterpFactorIfEnabled();
|
||||
RemovePreviewIfDisabled();
|
||||
UpdateStepByStepControls();
|
||||
Initialized();
|
||||
@@ -120,6 +121,14 @@ namespace Flowframes
|
||||
|
||||
}
|
||||
|
||||
void UnlockInterpFactorIfEnabled ()
|
||||
{
|
||||
if (!Config.GetBool(Config.Key.allowCustomInterpFactor))
|
||||
return;
|
||||
|
||||
interpFactorCombox.DropDownStyle = ComboBoxStyle.DropDown;
|
||||
}
|
||||
|
||||
void RemovePreviewIfDisabled ()
|
||||
{
|
||||
if (!Config.GetBool(Config.Key.disablePreview))
|
||||
@@ -300,6 +309,8 @@ namespace Flowframes
|
||||
|
||||
public void runBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
ValidateFactor();
|
||||
|
||||
if (!BatchProcessing.busy) // Don't load values from gui if batch processing is used
|
||||
Interpolate.current = GetCurrentSettings();
|
||||
|
||||
@@ -342,7 +353,7 @@ namespace Flowframes
|
||||
outModeCombox.SelectedIndex = targetIndex;
|
||||
}
|
||||
|
||||
AI GetAi()
|
||||
public AI GetAi()
|
||||
{
|
||||
return Implementations.networks[aiCombox.SelectedIndex];
|
||||
}
|
||||
@@ -392,15 +403,20 @@ namespace Flowframes
|
||||
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateUiFps();
|
||||
int guiInterpFactor = interpFactorCombox.GetInt();
|
||||
int guiFactor = interpFactorCombox.GetInt();
|
||||
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
string aiName = GetAi().aiName.Replace("_", "-");
|
||||
|
||||
if (!Program.busy && guiInterpFactor > 2 && GetAi().multiPass && Config.GetInt(Config.Key.autoEncMode) > 0 && !Logger.GetLastLine().Contains(aiName))
|
||||
Logger.Log($"Warning: {aiName} doesn't natively support 4x/8x and will run multiple times for {guiInterpFactor}x. Auto-Encode will only work on the last run.");
|
||||
if (!Program.busy && guiFactor > 2 && GetAi().multiPass && Config.GetInt(Config.Key.autoEncMode) > 0 && !Logger.GetLastLine().Contains(aiName))
|
||||
Logger.Log($"Warning: {aiName} doesn't natively support 4x/8x and will run multiple times for {guiFactor}x. Auto-Encode will only work on the last run.");
|
||||
}
|
||||
|
||||
public void ValidateFactor ()
|
||||
{
|
||||
interpFactorCombox.Text = $"x{MainUiFunctions.ValidateInterpFactor(interpFactorCombox.GetInt())}";
|
||||
}
|
||||
|
||||
public void SetWorking(bool state, bool allowCancel = true)
|
||||
@@ -542,6 +558,8 @@ namespace Flowframes
|
||||
|
||||
private void queueBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
ValidateFactor();
|
||||
|
||||
if (BatchProcessing.currentBatchForm != null)
|
||||
{
|
||||
BatchProcessing.currentBatchForm.WindowState = FormWindowState.Normal;
|
||||
|
||||
@@ -306,6 +306,7 @@ namespace Flowframes.IO
|
||||
aiCombox,
|
||||
allowConsecutiveSceneChanges,
|
||||
allowCustomInputRate,
|
||||
allowCustomInterpFactor,
|
||||
allowSymlinkEncoding,
|
||||
allowSymlinkImport,
|
||||
alwaysWaitForAutoEnc,
|
||||
|
||||
@@ -123,5 +123,28 @@ namespace Flowframes.Ui
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int ValidateInterpFactor (int factor)
|
||||
{
|
||||
AI ai = Program.mainForm.GetAi();
|
||||
|
||||
if (factor > 256)
|
||||
return 256;
|
||||
|
||||
if (ai.aiName == Implementations.rifeCuda.aiName)
|
||||
{
|
||||
if (!IsPowerOfTwo(factor))
|
||||
{
|
||||
return Implementations.rifeCuda.supportedFactors.Last();
|
||||
}
|
||||
}
|
||||
|
||||
return factor;
|
||||
}
|
||||
|
||||
static bool IsPowerOfTwo(int x)
|
||||
{
|
||||
return (x != 0) && ((x & (x - 1)) == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user