AV1 240 FPS hard-cap now accounts for FPS limiting, fixed GetFloat flaws

This commit is contained in:
n00mkrad
2022-08-11 16:15:20 +02:00
parent 8f36739adc
commit b658a3ddce
3 changed files with 13 additions and 11 deletions

View File

@@ -36,7 +36,7 @@ namespace Flowframes
public static int GetInt(this string str) public static int GetInt(this string str)
{ {
if (str.Length < 1 || str == null) if (str == null || str.Length < 1)
return 0; return 0;
try try
@@ -74,7 +74,7 @@ namespace Flowframes
public static float GetFloat(this string str) public static float GetFloat(this string str)
{ {
if (str.Length < 1 || str == null) if (str == null || str.Length < 1)
return 0f; return 0f;
string num = str.TrimNumbers(true).Replace(",", "."); string num = str.TrimNumbers(true).Replace(",", ".");
@@ -117,7 +117,7 @@ namespace Flowframes
return i; return i;
} }
public static float Clamp(this float i, int min, float max) public static float Clamp(this float i, float min, float max)
{ {
if (i < min) if (i < min)
i = min; i = min;
@@ -159,14 +159,14 @@ namespace Flowframes
public static string Remove(this string str, string stringToRemove) public static string Remove(this string str, string stringToRemove)
{ {
if (str == null || stringToRemove == null) if (str == null || stringToRemove == null)
return str; return "";
return str.Replace(stringToRemove, ""); return str.Replace(stringToRemove, "");
} }
public static string TrimWhitespaces(this string str) public static string TrimWhitespaces(this string str)
{ {
if (str == null) return str; if (str == null) return "";
var newString = new StringBuilder(); var newString = new StringBuilder();
bool previousIsWhitespace = false; bool previousIsWhitespace = false;
for (int i = 0; i < str.Length; i++) for (int i = 0; i < str.Length; i++)

View File

@@ -187,24 +187,24 @@ namespace Flowframes.IO
public static float GetFloat(Key key) public static float GetFloat(Key key)
{ {
return float.Parse(Get(key, Type.Float), CultureInfo.InvariantCulture); return Get(key, Type.Float).GetFloat();
} }
public static float GetFloat(Key key, float defaultVal) public static float GetFloat(Key key, float defaultVal)
{ {
WriteIfDoesntExist(key.ToString(), defaultVal.ToStringDot()); WriteIfDoesntExist(key.ToString(), defaultVal.ToStringDot());
return float.Parse(Get(key, Type.Float), CultureInfo.InvariantCulture); return Get(key, Type.Float).GetFloat();
} }
public static float GetFloat(string key) public static float GetFloat(string key)
{ {
return float.Parse(Get(key, Type.Float), CultureInfo.InvariantCulture); return Get(key, Type.Float).GetFloat();
} }
public static float GetFloat(string key, float defaultVal) public static float GetFloat(string key, float defaultVal)
{ {
WriteIfDoesntExist(key.ToString(), defaultVal.ToStringDot()); WriteIfDoesntExist(key.ToString(), defaultVal.ToStringDot());
return float.Parse(Get(key, Type.Float), CultureInfo.InvariantCulture); return Get(key, Type.Float).GetFloat();
} }
public static string GetFloatString (Key key) public static string GetFloatString (Key key)

View File

@@ -221,11 +221,13 @@ namespace Flowframes.Main
return true; return true;
} }
public static async Task<bool> CheckEncoderValid (float encodeFps) public static async Task<bool> CheckEncoderValid (float interpFps)
{ {
string enc = FfmpegUtils.GetEnc(FfmpegUtils.GetCodec(I.currentSettings.outMode)); string enc = FfmpegUtils.GetEnc(FfmpegUtils.GetCodec(I.currentSettings.outMode));
float maxAv1Fps = 240; float maxAv1Fps = 240; // SVT-AV1 only supports up to 240 FPS as of 2022-08
float maxFps = Config.GetFloat(Config.Key.maxFps);
float encodeFps = maxFps > 0 ? interpFps.Clamp(0, maxFps) : interpFps;
if (enc.ToLower().Contains("av1") && encodeFps > maxAv1Fps) if (enc.ToLower().Contains("av1") && encodeFps > maxAv1Fps)
{ {