mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-07-13 05:50:33 +02:00
Fixed NCNN tilesize/threads args for multi-gpu
This commit is contained in:
@@ -123,7 +123,7 @@ namespace Flowframes
|
||||
bool replaceLastLine = currentLogMode == LogMode.OnlyLastLine;
|
||||
Logger.Log(outLine.Data, hidden, replaceLastLine);
|
||||
}
|
||||
|
||||
|
||||
static string GetAvDir ()
|
||||
{
|
||||
return Path.Combine(Paths.GetPkgPath(), Path.GetFileNameWithoutExtension(Packages.audioVideo.fileName));
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Flowframes.IO
|
||||
{
|
||||
@@ -10,6 +6,5 @@ namespace Flowframes.IO
|
||||
{
|
||||
public static string[] supported = { ".mp4", ".m4v", ".gif", ".mkv", ".mpg", ".webm", ".avi", ".wmv", ".ts", ".bik" }; // Supported formats
|
||||
public static string[] noEncodeSupport = { ".bik" }; // Files that have no encode support, but decode
|
||||
public static string[] preprocess = { ".gif" }; // Files that get converted to MP4 first for compat reasons
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@
|
||||
<Compile Include="Main\Interpolate.cs" />
|
||||
<Compile Include="IO\CfgStrings.cs" />
|
||||
<Compile Include="IO\Config.cs" />
|
||||
<Compile Include="IO\Formats.cs" />
|
||||
<Compile Include="Data\Formats.cs" />
|
||||
<Compile Include="IO\IOUtils.cs" />
|
||||
<Compile Include="IO\Paths.cs" />
|
||||
<Compile Include="IO\Logger.cs" />
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Flowframes
|
||||
filename = defaultLogName;
|
||||
|
||||
file = Path.Combine(Paths.GetLogPath(), filename);
|
||||
logStr = logStr.Replace(Environment.NewLine, " | ");
|
||||
logStr = logStr.Replace(Environment.NewLine, " ").TrimWhitespaces();
|
||||
string time = DT.Now.Month + "-" + DT.Now.Day + "-" + DT.Now.Year + " " + DT.Now.Hour + ":" + DT.Now.Minute + ":" + DT.Now.Second;
|
||||
|
||||
try
|
||||
|
||||
@@ -48,12 +48,12 @@ namespace Flowframes
|
||||
|
||||
public static async Task RunDainNcnn(string framesPath, string outPath, int targetFrames, int tilesize)
|
||||
{
|
||||
string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -t {tilesize} -g {Config.Get("ncnnGpus")}";
|
||||
string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -t {GetNcnnTilesize(tilesize)} -g {Config.Get("ncnnGpus")}";
|
||||
|
||||
string dainDir = Path.Combine(Paths.GetPkgPath(), Path.GetFileNameWithoutExtension(Packages.dainNcnn.fileName));
|
||||
Process dain = OSUtils.NewProcess(!OSUtils.ShowHiddenCmd());
|
||||
AiStarted(dain, 1500);
|
||||
dain.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {dainDir.Wrap()} & dain-ncnn-vulkan.exe {args} -f {InterpolateUtils.lastExt} -j 4:{Config.Get("ncnnThreads")}:4";
|
||||
dain.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {dainDir.Wrap()} & dain-ncnn-vulkan.exe {args} -f {InterpolateUtils.lastExt} -j {GetNcnnThreads()}";
|
||||
Logger.Log("Running DAIN...", false);
|
||||
Logger.Log("cmd.exe " + dain.StartInfo.Arguments, true);
|
||||
if (!OSUtils.ShowHiddenCmd())
|
||||
@@ -126,7 +126,7 @@ namespace Flowframes
|
||||
string cainExe = "cain-ncnn-vulkan.exe";
|
||||
Process cain = OSUtils.NewProcess(!OSUtils.ShowHiddenCmd());
|
||||
AiStarted(cain, 1500);
|
||||
cain.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {cainDir.Wrap()} & {cainExe} {args} -f {InterpolateUtils.lastExt} -j 4:{Config.Get("ncnnThreads")}:4";
|
||||
cain.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {cainDir.Wrap()} & {cainExe} {args} -f {InterpolateUtils.lastExt} -j {GetNcnnThreads()}";
|
||||
Logger.Log("cmd.exe " + cain.StartInfo.Arguments, true);
|
||||
if (!OSUtils.ShowHiddenCmd())
|
||||
{
|
||||
@@ -236,7 +236,7 @@ namespace Flowframes
|
||||
{
|
||||
Process rifeNcnn = OSUtils.NewProcess(!OSUtils.ShowHiddenCmd());
|
||||
AiStarted(rifeNcnn, 1500);
|
||||
rifeNcnn.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {PkgUtils.GetPkgFolder(Packages.rifeNcnn).Wrap()} & rife-ncnn-vulkan.exe {args} -g {Config.Get("ncnnGpus")} -f {InterpolateUtils.lastExt} -j 4:{Config.Get("ncnnThreads")}:4";
|
||||
rifeNcnn.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {PkgUtils.GetPkgFolder(Packages.rifeNcnn).Wrap()} & rife-ncnn-vulkan.exe {args} -g {Config.Get("ncnnGpus")} -f {InterpolateUtils.lastExt} -j {GetNcnnThreads()}";
|
||||
Logger.Log("cmd.exe " + rifeNcnn.StartInfo.Arguments, true);
|
||||
if (!OSUtils.ShowHiddenCmd())
|
||||
{
|
||||
@@ -295,5 +295,28 @@ namespace Flowframes
|
||||
if (hasShownError)
|
||||
Interpolate.Cancel();
|
||||
}
|
||||
|
||||
static string GetNcnnTilesize(int tilesize)
|
||||
{
|
||||
int gpusAmount = Config.Get("ncnnGpus").Split(',').Length;
|
||||
string tilesizeStr = $"{tilesize}";
|
||||
|
||||
for (int i = 1; i < gpusAmount; i++)
|
||||
tilesizeStr += $",{tilesize}";
|
||||
|
||||
return tilesizeStr;
|
||||
}
|
||||
|
||||
static string GetNcnnThreads ()
|
||||
{
|
||||
int gpusAmount = Config.Get("ncnnGpus").Split(',').Length;
|
||||
int procThreads = Config.GetInt("ncnnThreads");
|
||||
string progThreadsStr = $"{procThreads}";
|
||||
|
||||
for (int i = 1; i < gpusAmount; i++)
|
||||
progThreadsStr += $",{procThreads}";
|
||||
|
||||
return $"4:{progThreadsStr}:4"; ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user