mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-24 04:09:29 +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.Size = new System.Drawing.Size(100, 23);
|
||||||
this.interpFactorCombox.TabIndex = 7;
|
this.interpFactorCombox.TabIndex = 7;
|
||||||
this.interpFactorCombox.SelectedIndexChanged += new System.EventHandler(this.interpFactorCombox_SelectedIndexChanged);
|
this.interpFactorCombox.SelectedIndexChanged += new System.EventHandler(this.interpFactorCombox_SelectedIndexChanged);
|
||||||
|
this.interpFactorCombox.TextUpdate += new System.EventHandler(this.interpFactorCombox_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ namespace Flowframes
|
|||||||
NvApi.Init();
|
NvApi.Init();
|
||||||
InitAis();
|
InitAis();
|
||||||
InterpolationProgress.preview = previewPicturebox;
|
InterpolationProgress.preview = previewPicturebox;
|
||||||
|
UnlockInterpFactorIfEnabled();
|
||||||
RemovePreviewIfDisabled();
|
RemovePreviewIfDisabled();
|
||||||
UpdateStepByStepControls();
|
UpdateStepByStepControls();
|
||||||
Initialized();
|
Initialized();
|
||||||
@@ -120,6 +121,14 @@ namespace Flowframes
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UnlockInterpFactorIfEnabled ()
|
||||||
|
{
|
||||||
|
if (!Config.GetBool(Config.Key.allowCustomInterpFactor))
|
||||||
|
return;
|
||||||
|
|
||||||
|
interpFactorCombox.DropDownStyle = ComboBoxStyle.DropDown;
|
||||||
|
}
|
||||||
|
|
||||||
void RemovePreviewIfDisabled ()
|
void RemovePreviewIfDisabled ()
|
||||||
{
|
{
|
||||||
if (!Config.GetBool(Config.Key.disablePreview))
|
if (!Config.GetBool(Config.Key.disablePreview))
|
||||||
@@ -300,6 +309,8 @@ namespace Flowframes
|
|||||||
|
|
||||||
public void runBtn_Click(object sender, EventArgs e)
|
public void runBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
ValidateFactor();
|
||||||
|
|
||||||
if (!BatchProcessing.busy) // Don't load values from gui if batch processing is used
|
if (!BatchProcessing.busy) // Don't load values from gui if batch processing is used
|
||||||
Interpolate.current = GetCurrentSettings();
|
Interpolate.current = GetCurrentSettings();
|
||||||
|
|
||||||
@@ -342,7 +353,7 @@ namespace Flowframes
|
|||||||
outModeCombox.SelectedIndex = targetIndex;
|
outModeCombox.SelectedIndex = targetIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
AI GetAi()
|
public AI GetAi()
|
||||||
{
|
{
|
||||||
return Implementations.networks[aiCombox.SelectedIndex];
|
return Implementations.networks[aiCombox.SelectedIndex];
|
||||||
}
|
}
|
||||||
@@ -392,15 +403,20 @@ namespace Flowframes
|
|||||||
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
|
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateUiFps();
|
UpdateUiFps();
|
||||||
int guiInterpFactor = interpFactorCombox.GetInt();
|
int guiFactor = interpFactorCombox.GetInt();
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string aiName = GetAi().aiName.Replace("_", "-");
|
string aiName = GetAi().aiName.Replace("_", "-");
|
||||||
|
|
||||||
if (!Program.busy && guiInterpFactor > 2 && GetAi().multiPass && Config.GetInt(Config.Key.autoEncMode) > 0 && !Logger.GetLastLine().Contains(aiName))
|
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 {guiInterpFactor}x. Auto-Encode will only work on the last run.");
|
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)
|
public void SetWorking(bool state, bool allowCancel = true)
|
||||||
@@ -542,6 +558,8 @@ namespace Flowframes
|
|||||||
|
|
||||||
private void queueBtn_Click(object sender, EventArgs e)
|
private void queueBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
ValidateFactor();
|
||||||
|
|
||||||
if (BatchProcessing.currentBatchForm != null)
|
if (BatchProcessing.currentBatchForm != null)
|
||||||
{
|
{
|
||||||
BatchProcessing.currentBatchForm.WindowState = FormWindowState.Normal;
|
BatchProcessing.currentBatchForm.WindowState = FormWindowState.Normal;
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ namespace Flowframes.IO
|
|||||||
aiCombox,
|
aiCombox,
|
||||||
allowConsecutiveSceneChanges,
|
allowConsecutiveSceneChanges,
|
||||||
allowCustomInputRate,
|
allowCustomInputRate,
|
||||||
|
allowCustomInterpFactor,
|
||||||
allowSymlinkEncoding,
|
allowSymlinkEncoding,
|
||||||
allowSymlinkImport,
|
allowSymlinkImport,
|
||||||
alwaysWaitForAutoEnc,
|
alwaysWaitForAutoEnc,
|
||||||
|
|||||||
@@ -123,5 +123,28 @@ namespace Flowframes.Ui
|
|||||||
return null;
|
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