2020-12-17 11:32:45 +01:00
|
|
|
|
using Flowframes.Data;
|
|
|
|
|
|
using Flowframes.IO;
|
|
|
|
|
|
using Flowframes.Main;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2020-12-22 23:45:07 +01:00
|
|
|
|
using System.Drawing;
|
2020-12-17 11:32:45 +01:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Flowframes
|
|
|
|
|
|
{
|
|
|
|
|
|
public struct InterpSettings
|
|
|
|
|
|
{
|
|
|
|
|
|
public string inPath;
|
|
|
|
|
|
public string outPath;
|
|
|
|
|
|
public AI ai;
|
|
|
|
|
|
public float inFps;
|
|
|
|
|
|
public float outFps;
|
|
|
|
|
|
public int interpFactor;
|
|
|
|
|
|
public Interpolate.OutMode outMode;
|
|
|
|
|
|
public int tilesize;
|
|
|
|
|
|
|
|
|
|
|
|
public string tempFolder;
|
|
|
|
|
|
public string framesFolder;
|
|
|
|
|
|
public string interpFolder;
|
|
|
|
|
|
public bool inputIsFrames;
|
|
|
|
|
|
public string outFilename;
|
2020-12-22 23:45:07 +01:00
|
|
|
|
public Size inputResolution;
|
|
|
|
|
|
public Size scaledResolution;
|
2020-12-17 11:32:45 +01:00
|
|
|
|
|
|
|
|
|
|
public InterpSettings(string inPathArg, string outPathArg, AI aiArg, float inFpsArg, int interpFactorArg, Interpolate.OutMode outModeArg, int tilesizeArg = 512)
|
|
|
|
|
|
{
|
|
|
|
|
|
inPath = inPathArg;
|
|
|
|
|
|
outPath = outPathArg;
|
|
|
|
|
|
ai = aiArg;
|
|
|
|
|
|
inFps = inFpsArg;
|
|
|
|
|
|
interpFactor = interpFactorArg;
|
|
|
|
|
|
outFps = inFpsArg * interpFactorArg;
|
|
|
|
|
|
outMode = outModeArg;
|
|
|
|
|
|
tilesize = tilesizeArg;
|
|
|
|
|
|
|
2020-12-18 00:19:08 +01:00
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
tempFolder = InterpolateUtils.GetTempFolderLoc(inPath, outPath);
|
|
|
|
|
|
framesFolder = Path.Combine(tempFolder, Paths.framesDir);
|
|
|
|
|
|
interpFolder = Path.Combine(tempFolder, Paths.interpDir);
|
|
|
|
|
|
inputIsFrames = IOUtils.IsPathDirectory(inPath);
|
|
|
|
|
|
outFilename = Path.Combine(outPath, Path.GetFileNameWithoutExtension(inPath) + IOUtils.GetAiSuffix(ai, interpFactor) + InterpolateUtils.GetExt(outMode));
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
Logger.Log("Tried to create InterpSettings struct without an inpath. Can't set tempFolder, framesFolder and interpFolder.", true);
|
|
|
|
|
|
tempFolder = "";
|
|
|
|
|
|
framesFolder = "";
|
|
|
|
|
|
interpFolder = "";
|
|
|
|
|
|
inputIsFrames = false;
|
|
|
|
|
|
outFilename = "";
|
|
|
|
|
|
}
|
2020-12-22 23:45:07 +01:00
|
|
|
|
|
|
|
|
|
|
inputResolution = new Size(0, 0);
|
|
|
|
|
|
scaledResolution = new Size(0, 0);
|
2020-12-18 00:19:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdatePaths (string inPathArg, string outPathArg)
|
|
|
|
|
|
{
|
|
|
|
|
|
inPath = inPathArg;
|
|
|
|
|
|
outPath = outPathArg;
|
2020-12-17 11:32:45 +01:00
|
|
|
|
tempFolder = InterpolateUtils.GetTempFolderLoc(inPath, outPath);
|
|
|
|
|
|
framesFolder = Path.Combine(tempFolder, Paths.framesDir);
|
|
|
|
|
|
interpFolder = Path.Combine(tempFolder, Paths.interpDir);
|
|
|
|
|
|
inputIsFrames = IOUtils.IsPathDirectory(inPath);
|
|
|
|
|
|
outFilename = Path.Combine(outPath, Path.GetFileNameWithoutExtension(inPath) + IOUtils.GetAiSuffix(ai, interpFactor) + InterpolateUtils.GetExt(outMode));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-12-22 23:45:07 +01:00
|
|
|
|
public Size GetInputRes ()
|
2020-12-17 11:32:45 +01:00
|
|
|
|
{
|
2020-12-22 23:45:07 +01:00
|
|
|
|
RefreshResolutions();
|
|
|
|
|
|
return inputResolution;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Size GetScaledRes()
|
|
|
|
|
|
{
|
|
|
|
|
|
RefreshResolutions();
|
|
|
|
|
|
return scaledResolution;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RefreshResolutions ()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (inputResolution.IsEmpty || scaledResolution.IsEmpty)
|
|
|
|
|
|
{
|
|
|
|
|
|
inputResolution = IOUtils.GetVideoRes(inPath);
|
|
|
|
|
|
scaledResolution = InterpolateUtils.GetOutputResolution(inputResolution, false);
|
|
|
|
|
|
}
|
2020-12-17 11:32:45 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|