From 9672c31fba1673a3e4363b2e69091aa2201fb5e5 Mon Sep 17 00:00:00 2001 From: N00MKRAD <61149547+n00mkrad@users.noreply.github.com> Date: Tue, 3 Sep 2024 22:08:38 +0200 Subject: [PATCH] Always use Invariant shortcuts for ToLower/ToUpper --- CodeLegacy/Data/AiInfo.cs | 2 +- CodeLegacy/Data/InterpSettings.cs | 2 +- CodeLegacy/Data/MediaFile.cs | 2 +- CodeLegacy/Data/SubtitleTrack.cs | 2 +- CodeLegacy/Extensions/ExtensionMethods.cs | 2 +- CodeLegacy/IO/IoUtils.cs | 8 +-- CodeLegacy/IO/ModelDownloader.cs | 2 +- CodeLegacy/Magick/Converter.cs | 2 +- CodeLegacy/Main/Export.cs | 8 +-- CodeLegacy/Main/InterpolateUtils.cs | 4 +- CodeLegacy/Media/FfmpegCommands.cs | 2 +- CodeLegacy/Media/FfmpegExtract.cs | 6 +- CodeLegacy/Media/FfmpegUtils.cs | 16 ++--- CodeLegacy/Media/GetVideoInfo.cs | 4 +- CodeLegacy/MiscUtils/FormatUtils.cs | 2 +- CodeLegacy/Os/AiProcess.cs | 26 ++++---- CodeLegacy/Os/OsUtils.cs | 4 +- CodeLegacy/Os/Python.cs | 2 +- CodeLegacy/Os/StartupChecks.cs | 2 +- CodeLegacy/Program.cs | 2 +- CodeLegacy/Ui/DebugFormHelper.cs | 2 +- CodeLegacy/Ui/UiUtils.cs | 2 +- CodeLegacy/Utilities/ColorDataUtils.cs | 8 +-- Flowframes/Data/AI.cs | 2 +- Flowframes/Data/InterpSettings.cs | 2 +- Flowframes/Data/MediaFile.cs | 2 +- Flowframes/Data/SubtitleTrack.cs | 2 +- Flowframes/Extensions/ExtensionMethods.cs | 4 +- Flowframes/IO/IoUtils.cs | 8 +-- Flowframes/IO/ModelDownloader.cs | 2 +- Flowframes/Magick/Converter.cs | 2 +- Flowframes/Main/Export.cs | 8 +-- Flowframes/Main/InterpolateUtils.cs | 4 +- Flowframes/Media/FfmpegCommands.cs | 2 +- Flowframes/Media/FfmpegExtract.cs | 6 +- Flowframes/Media/FfmpegUtils.cs | 16 ++--- Flowframes/Media/GetVideoInfo.cs | 4 +- Flowframes/MiscUtils/FormatUtils.cs | 2 +- Flowframes/Os/AiProcess.cs | 26 ++++---- Flowframes/Os/OsUtils.cs | 4 +- Flowframes/Os/Python.cs | 2 +- Flowframes/Os/StartupChecks.cs | 6 +- Flowframes/Program.cs | 2 +- Flowframes/Ui/DebugFormHelper.cs | 2 +- Flowframes/Ui/UiUtils.cs | 2 +- Flowframes/Utilities/ColorDataUtils.cs | 8 +-- Pkgs/rife-ncnn-vs/models.json | 72 ++++------------------- Pkgs/rife-ncnn/models.json | 72 ++++------------------- 48 files changed, 139 insertions(+), 235 deletions(-) diff --git a/CodeLegacy/Data/AiInfo.cs b/CodeLegacy/Data/AiInfo.cs index 514d1e5..1418902 100644 --- a/CodeLegacy/Data/AiInfo.cs +++ b/CodeLegacy/Data/AiInfo.cs @@ -18,7 +18,7 @@ namespace Flowframes.Data public string NameLong { get; set; } = ""; public string FriendlyName { get { return $"{NameShort} ({GetFrameworkString(Backend)})"; } } public string Description { get { return $"{GetImplemString(Backend)} of {NameShort}{(Backend == AiBackend.Pytorch ? " (Nvidia Only!)" : "")}"; } } - public string PkgDir { get { return NameInternal.Replace("_", "-").ToLowerInvariant(); } } + public string PkgDir { get { return NameInternal.Replace("_", "-").Lower(); } } public enum InterpFactorSupport { Fixed, AnyPowerOfTwo, AnyInteger, AnyFloat } public InterpFactorSupport FactorSupport { get; set; } = InterpFactorSupport.Fixed; public int[] SupportedFactors { get; set; } = new int[0]; diff --git a/CodeLegacy/Data/InterpSettings.cs b/CodeLegacy/Data/InterpSettings.cs index a360122..87cf9c9 100644 --- a/CodeLegacy/Data/InterpSettings.cs +++ b/CodeLegacy/Data/InterpSettings.cs @@ -184,7 +184,7 @@ namespace Flowframes bool gifOutput = outSettings.Encoder == Enums.Encoding.Encoder.Gif; bool proResAlpha = outSettings.Encoder == Enums.Encoding.Encoder.ProResKs && OutputUtils.AlphaFormats.Contains(outSettings.PixelFormat); bool outputSupportsAlpha = pngOutput || gifOutput || proResAlpha; - string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).ToLowerInvariant() : Path.GetExtension(inPath).ToLowerInvariant(); + string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).Lower() : Path.GetExtension(inPath).Lower(); alpha = (alphaModel && outputSupportsAlpha && (ext == ".gif" || ext == ".png" || ext == ".apng" || ext == ".mov")); Logger.Log($"RefreshAlpha: model.supportsAlpha = {alphaModel} - outputSupportsAlpha = {outputSupportsAlpha} - input ext: {ext} => alpha = {alpha}", true); } diff --git a/CodeLegacy/Data/MediaFile.cs b/CodeLegacy/Data/MediaFile.cs index 77954e8..6fdb9bd 100644 --- a/CodeLegacy/Data/MediaFile.cs +++ b/CodeLegacy/Data/MediaFile.cs @@ -66,7 +66,7 @@ namespace Flowframes.Data Name = FileInfo.Name; SourcePath = FileInfo.FullName; ImportPath = FileInfo.FullName; - Format = FileInfo.Extension.Remove(".").ToUpper(); + Format = FileInfo.Extension.Remove(".").Upper(); InputRate = new Fraction(-1, 1); } diff --git a/CodeLegacy/Data/SubtitleTrack.cs b/CodeLegacy/Data/SubtitleTrack.cs index c199826..e24964e 100644 --- a/CodeLegacy/Data/SubtitleTrack.cs +++ b/CodeLegacy/Data/SubtitleTrack.cs @@ -13,7 +13,7 @@ namespace Flowframes.Data { streamIndex = streamNum; lang = metaStr.Trim().Replace("_", ".").Replace(" ", "."); - //langFriendly = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaStr.ToLowerInvariant().Trim().Replace("_", ".").Replace(" ", ".")); + //langFriendly = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaStr.Lower().Trim().Replace("_", ".").Replace(" ", ".")); encoding = encodingStr.Trim(); } } diff --git a/CodeLegacy/Extensions/ExtensionMethods.cs b/CodeLegacy/Extensions/ExtensionMethods.cs index f0ce0d5..c532077 100644 --- a/CodeLegacy/Extensions/ExtensionMethods.cs +++ b/CodeLegacy/Extensions/ExtensionMethods.cs @@ -272,7 +272,7 @@ namespace Flowframes { try { - return Path.GetExtension(filePath)?.ToLowerInvariant() == ".concat"; + return Path.GetExtension(filePath)?.Lower() == ".concat"; } catch { diff --git a/CodeLegacy/IO/IoUtils.cs b/CodeLegacy/IO/IoUtils.cs index 056a903..7521e46 100644 --- a/CodeLegacy/IO/IoUtils.cs +++ b/CodeLegacy/IO/IoUtils.cs @@ -27,7 +27,7 @@ namespace Flowframes.IO try { - string ext = new FileInfo(path).Extension.TrimStart('.').ToUpper(); + string ext = new FileInfo(path).Extension.TrimStart('.').Upper(); if (incompatibleExtensions.Contains(ext)) return null; @@ -330,7 +330,7 @@ namespace Flowframes.IO public static async Task GetVideoFramerate(string path) { string[] preferFfmpegReadoutFormats = new string[] { ".gif", ".png", ".apng", ".webp" }; - bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).ToLowerInvariant()); + bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).Lower()); Fraction fps = new Fraction(); @@ -612,7 +612,7 @@ namespace Flowframes.IO filename = filename.Replace("[NAME]", inName); filename = filename.Replace("[FULLNAME]", Path.GetFileName(curr.inPath)); filename = filename.Replace("[FACTOR]", curr.interpFactor.ToStringDot()); - filename = filename.Replace("[AI]", curr.ai.NameShort.ToUpper()); + filename = filename.Replace("[AI]", curr.ai.NameShort.Upper()); filename = filename.Replace("[MODEL]", curr.model.Name.Remove(" ")); filename = filename.Replace("[FPS]", fps.ToStringDot("0.###")); filename = filename.Replace("[ROUNDFPS]", fps.RoundToInt().ToString()); @@ -758,7 +758,7 @@ namespace Flowframes.IO { MD5 md5 = MD5.Create(); var hash = md5.ComputeHash(stream); - hashStr = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); + hashStr = BitConverter.ToString(hash).Replace("-", "").Lower(); } if (hashType == Hash.CRC32) diff --git a/CodeLegacy/IO/ModelDownloader.cs b/CodeLegacy/IO/ModelDownloader.cs index 6fe8eb3..322740d 100644 --- a/CodeLegacy/IO/ModelDownloader.cs +++ b/CodeLegacy/IO/ModelDownloader.cs @@ -20,7 +20,7 @@ namespace Flowframes.IO string custServer = Config.Get(Config.Key.customServer); string server = custServer.Trim().Length > 3 ? custServer : Servers.GetServer().GetUrl(); string baseUrl = $"{server}/flowframes/mdl/"; - return Path.Combine(baseUrl, ai.ToLowerInvariant(), relPath); + return Path.Combine(baseUrl, ai.Lower(), relPath); } static string GetMdlFileUrl(string ai, string model, string relPath) diff --git a/CodeLegacy/Magick/Converter.cs b/CodeLegacy/Magick/Converter.cs index f216e4a..409e918 100644 --- a/CodeLegacy/Magick/Converter.cs +++ b/CodeLegacy/Magick/Converter.cs @@ -22,7 +22,7 @@ namespace Flowframes.Magick int counter = 0; foreach (string file in files) { - if (print) Logger.Log("Converting " + Path.GetFileName(file) + " to " + format.ToString().StripNumbers().ToUpper(), false, true); + if (print) Logger.Log("Converting " + Path.GetFileName(file) + " to " + format.ToString().StripNumbers().Upper(), false, true); MagickImage img = new MagickImage(file); img.Format = format; img.Quality = quality; diff --git a/CodeLegacy/Main/Export.cs b/CodeLegacy/Main/Export.cs index 064480d..0cd2ff0 100644 --- a/CodeLegacy/Main/Export.cs +++ b/CodeLegacy/Main/Export.cs @@ -126,7 +126,7 @@ namespace Flowframes.Main { Program.mainForm.SetStatus("Copying output frames..."); Enums.Encoding.Encoder desiredFormat = I.currentSettings.outSettings.Encoder; - string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(framesPath, "*.*")[0]).Remove(".").ToUpper(); + string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(framesPath, "*.*")[0]).Remove(".").Upper(); string max = Config.Get(Config.Key.maxFps); Fraction maxFps = max.Contains("/") ? new Fraction(max) : new Fraction(max.GetFloat()); bool fpsLimit = maxFps.GetFloat() > 0f && I.currentSettings.outFps.GetFloat() > maxFps.GetFloat(); @@ -139,7 +139,7 @@ namespace Flowframes.Main IoUtils.RenameExistingFolder(outputFolderPath); Logger.Log($"Exporting {desiredFormat.ToString().Upper()} frames to '{Path.GetFileName(outputFolderPath)}'..."); - if (desiredFormat.GetInfo().OverideExtension.ToUpper() == availableFormat.ToUpper()) // Move if frames are already in the desired format + if (desiredFormat.GetInfo().OverideExtension.Upper() == availableFormat.Upper()) // Move if frames are already in the desired format await CopyOutputFrames(framesPath, framesFile, outputFolderPath, 1, fpsLimit, false); else // Encode if frames are not in desired format await FfmpegEncode.FramesToFrames(framesFile, outputFolderPath, 1, I.currentSettings.outFps, new Fraction(), desiredFormat, OutputUtils.GetImgSeqQ(I.currentSettings.outSettings)); @@ -301,7 +301,7 @@ namespace Flowframes.Main if (settings.Encoder.GetInfo().IsImageSequence) // Image Sequence output mode, not video { string desiredFormat = settings.Encoder.GetInfo().OverideExtension; - string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").ToUpper(); + string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").Upper(); if (!dontEncodeFullFpsVid) { @@ -311,7 +311,7 @@ namespace Flowframes.Main if (chunkNo == 1) // Only check for existing folder on first chunk, otherwise each chunk makes a new folder IoUtils.RenameExistingFolder(outFolderPath); - if (desiredFormat.ToUpper() == availableFormat.ToUpper()) // Move if frames are already in the desired format + if (desiredFormat.Upper() == availableFormat.Upper()) // Move if frames are already in the desired format await CopyOutputFrames(interpDir, concatFile, outFolderPath, startNo, fpsLimit, true); else // Encode if frames are not in desired format await FfmpegEncode.FramesToFrames(concatFile, outFolderPath, startNo, I.currentSettings.outFps, new Fraction(), settings.Encoder, OutputUtils.GetImgSeqQ(settings), AvProcess.LogMode.Hidden); diff --git a/CodeLegacy/Main/InterpolateUtils.cs b/CodeLegacy/Main/InterpolateUtils.cs index 4199c6d..feb5764 100644 --- a/CodeLegacy/Main/InterpolateUtils.cs +++ b/CodeLegacy/Main/InterpolateUtils.cs @@ -176,7 +176,7 @@ namespace Flowframes.Main return false; } - if (I.currentSettings.ai.NameInternal.ToUpper().Contains("CUDA") && NvApi.gpuList.Count < 1) + if (I.currentSettings.ai.NameInternal.Upper().Contains("CUDA") && NvApi.gpuList.Count < 1) { UiUtils.ShowMessageBox("Warning: No Nvidia GPU was detected. CUDA might fall back to CPU!\n\nTry an NCNN implementation instead if you don't have an Nvidia GPU.", UiUtils.MessageType.Error); @@ -240,7 +240,7 @@ namespace Flowframes.Main { string enc = I.currentSettings.outSettings.Encoder.GetInfo().Name; - if (enc.ToLowerInvariant().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc))) + if (enc.Lower().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc))) { UiUtils.ShowMessageBox("NVENC encoding is not available on your hardware!\nPlease use a different encoder.", UiUtils.MessageType.Error); I.Cancel(); diff --git a/CodeLegacy/Media/FfmpegCommands.cs b/CodeLegacy/Media/FfmpegCommands.cs index 888d2ae..6ae63b8 100644 --- a/CodeLegacy/Media/FfmpegCommands.cs +++ b/CodeLegacy/Media/FfmpegCommands.cs @@ -241,7 +241,7 @@ namespace Flowframes try { string[] lines = info.SplitIntoLines(); - string lastLine = lines.Last().ToLowerInvariant(); + string lastLine = lines.Last().Lower(); return lastLine.Substring(0, lastLine.IndexOf("fps")).GetInt(); } catch diff --git a/CodeLegacy/Media/FfmpegExtract.cs b/CodeLegacy/Media/FfmpegExtract.cs index 33c09c5..c2fc037 100644 --- a/CodeLegacy/Media/FfmpegExtract.cs +++ b/CodeLegacy/Media/FfmpegExtract.cs @@ -306,7 +306,7 @@ namespace Flowframes.Media public static async Task ImportSingleImage(string inputFile, string outPath, Size size) { string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : ""; - bool isPng = (Path.GetExtension(outPath).ToLowerInvariant() == ".png"); + bool isPng = (Path.GetExtension(outPath).Lower() == ".png"); string comprArg = isPng ? pngCompr : ""; string pixFmt = isPng ? $"rgb24 {comprArg}" : "yuv420p -color_range full"; string args = $"-i {inputFile.Wrap()} {comprArg} {sizeStr} -pix_fmt {pixFmt} -vf {GetPadFilter()} {outPath.Wrap()}"; @@ -315,7 +315,7 @@ namespace Flowframes.Media public static async Task ExtractSingleFrame(string inputFile, string outputPath, int frameNum) { - bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png"); + bool isPng = (Path.GetExtension(outputPath).Lower() == ".png"); string comprArg = isPng ? pngCompr : ""; string pixFmt = isPng ? $"rgb24 {comprArg}" : "yuv420p -color_range full"; string args = $"-i {inputFile.Wrap()} -vf \"select=eq(n\\,{frameNum})\" -vframes 1 -update 1 -pix_fmt {pixFmt} {outputPath.Wrap()}"; @@ -330,7 +330,7 @@ namespace Flowframes.Media if (IoUtils.IsPathDirectory(outputPath)) outputPath = Path.Combine(outputPath, "last.png"); - bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png"); + bool isPng = (Path.GetExtension(outputPath).Lower() == ".png"); string comprArg = isPng ? pngCompr : ""; string pixFmt = isPng ? $"rgb24 {comprArg}" : "yuv420p -color_range full"; string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : ""; diff --git a/CodeLegacy/Media/FfmpegUtils.cs b/CodeLegacy/Media/FfmpegUtils.cs index cbd41c7..1371c02 100644 --- a/CodeLegacy/Media/FfmpegUtils.cs +++ b/CodeLegacy/Media/FfmpegUtils.cs @@ -65,7 +65,7 @@ namespace Flowframes.Media string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx); string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx); string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx); - string pixFmt = (await GetFfprobeInfoAsync(path, showStreams, "pix_fmt", idx)).ToUpper(); + string pixFmt = (await GetFfprobeInfoAsync(path, showStreams, "pix_fmt", idx)).Upper(); int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024; Size res = await GetMediaResolutionCached.GetSizeAsync(path); Size sar = SizeFromString(await GetFfprobeInfoAsync(path, showStreams, "sample_aspect_ratio", idx)); @@ -86,7 +86,7 @@ namespace Flowframes.Media string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx); string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx); string profile = await GetFfprobeInfoAsync(path, showStreams, "profile", idx); - if (codec.ToLowerInvariant() == "dts" && profile != "unknown") codec = profile; + if (codec.Lower() == "dts" && profile != "unknown") codec = profile; string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx); int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024; int sampleRate = (await GetFfprobeInfoAsync(path, showStreams, "sample_rate", idx)).GetInt(); @@ -250,14 +250,14 @@ namespace Flowframes.Media if (enc == Encoder.X264) { - string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); // TODO: Replace this ugly stuff with enums + string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); // TODO: Replace this ugly stuff with enums int crf = GetCrf(settings); args.Add($"-crf {crf} -preset {preset}"); } if (enc == Encoder.X265) { - string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); // TODO: Replace this ugly stuff with enums + string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); // TODO: Replace this ugly stuff with enums int crf = GetCrf(settings); args.Add($"{(crf > 0 ? $"-crf {crf}" : "-x265-params lossless=1")} -preset {preset}"); } @@ -402,7 +402,7 @@ namespace Flowframes.Media static string GetVp9Speed() { - string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); + string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); string arg = ""; if (preset == "veryslow") arg = "0"; @@ -418,7 +418,7 @@ namespace Flowframes.Media static string GetSvtAv1Speed() { - string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); + string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); string arg = "8"; if (preset == "veryslow") arg = "3"; @@ -548,10 +548,10 @@ namespace Flowframes.Media { containerExt = containerExt.Lower().Remove("."); bool supported = (containerExt == "mp4" || containerExt == "mkv" || containerExt == "webm" || containerExt == "mov"); - // Logger.Log($"Subtitles {(supported ? "are supported" : "not supported")} by {containerExt.ToUpper()}", true); + // Logger.Log($"Subtitles {(supported ? "are supported" : "not supported")} by {containerExt.Upper()}", true); if (showWarningIfNotSupported && Config.GetBool(Config.Key.keepSubs) && !supported) - Logger.Log($"Warning: {containerExt.ToUpper()} exports do not include subtitles."); + Logger.Log($"Warning: {containerExt.Upper()} exports do not include subtitles."); return supported; } diff --git a/CodeLegacy/Media/GetVideoInfo.cs b/CodeLegacy/Media/GetVideoInfo.cs index 6567cbb..e1ec9bb 100644 --- a/CodeLegacy/Media/GetVideoInfo.cs +++ b/CodeLegacy/Media/GetVideoInfo.cs @@ -79,13 +79,13 @@ namespace Flowframes.Media if (stripKeyName) { - List filtered = output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToList(); // Filter + List filtered = output.SplitIntoLines().Where(x => x.Lower().Contains(lineFilter.Lower())).ToList(); // Filter filtered = filtered.Select(x => string.Join("", x.Split('=').Skip(1))).ToList(); // Ignore everything before (and including) the first '=' sign output = string.Join("\n", filtered); } else { - output = string.Join("\n", output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToArray()); + output = string.Join("\n", output.SplitIntoLines().Where(x => x.Lower().Contains(lineFilter.Lower())).ToArray()); } } diff --git a/CodeLegacy/MiscUtils/FormatUtils.cs b/CodeLegacy/MiscUtils/FormatUtils.cs index 1f4e687..d2305cd 100644 --- a/CodeLegacy/MiscUtils/FormatUtils.cs +++ b/CodeLegacy/MiscUtils/FormatUtils.cs @@ -193,7 +193,7 @@ namespace Flowframes.MiscUtils public static string CapsIfShort(string codec, int capsIfShorterThan = 5) { if (codec.Length < capsIfShorterThan) - return codec.ToUpper(); + return codec.Upper(); else return codec.ToTitleCase(); } diff --git a/CodeLegacy/Os/AiProcess.cs b/CodeLegacy/Os/AiProcess.cs index 66b533b..d7ddf22 100644 --- a/CodeLegacy/Os/AiProcess.cs +++ b/CodeLegacy/Os/AiProcess.cs @@ -139,8 +139,8 @@ namespace Flowframes.Os { if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited) { - if (Logger.LastLogLine.ToLowerInvariant().Contains("frame: ")) - Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.ToLowerInvariant().Contains("frame")); + if (Logger.LastLogLine.Lower().Contains("frame: ")) + Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.Lower().Contains("frame")); } if (AvProcess.lastAvProcess.HasExited && !AutoEncode.HasWorkToDo()) // Stop logging if ffmpeg is not running & AE is done @@ -325,7 +325,7 @@ namespace Flowframes.Os string ttaStr = Config.GetBool(Config.Key.rifeNcnnUseTta, false) ? "-x" : ""; rifeNcnn.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {Path.Combine(Paths.GetPkgPath(), Implementations.rifeNcnn.PkgDir).Wrap()} & rife-ncnn-vulkan.exe " + - $" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.ToLowerInvariant()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads(Implementations.rifeNcnn)}"; + $" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.Lower()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads(Implementations.rifeNcnn)}"; Logger.Log("cmd.exe " + rifeNcnn.StartInfo.Arguments, true); @@ -457,7 +457,7 @@ namespace Flowframes.Os SetProgressCheck(outPath, factor); int targetFrames = ((IoUtils.GetAmountOfFiles(lastInPath, false, "*.*") * factor).RoundToInt()); - string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.ToLowerInvariant()}" + + string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.Lower()}" + $" -t {NcnnUtils.GetNcnnTilesize(tilesize)} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j 2:1:2"; dain.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {dainDir.Wrap()} & dain-ncnn-vulkan.exe {args}"; @@ -619,26 +619,26 @@ namespace Flowframes.Os if (line.Contains("ff:nocuda-cpu")) Logger.Log("WARNING: CUDA-capable GPU device is not available, running on CPU instead!"); - if (!hasShownError && err && line.ToLowerInvariant().Contains("modulenotfounderror")) + if (!hasShownError && err && line.Lower().Contains("modulenotfounderror")) { hasShownError = true; UiUtils.ShowMessageBox($"A python module is missing.\nCheck {ai.LogFilename} for details.\n\n{line}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("no longer supports this gpu")) + if (!hasShownError && line.Lower().Contains("no longer supports this gpu")) { hasShownError = true; UiUtils.ShowMessageBox($"Your GPU seems to be outdated and is not supported!\n\n{line}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("error(s) in loading state_dict")) + if (!hasShownError && line.Lower().Contains("error(s) in loading state_dict")) { hasShownError = true; string msg = (Interpolate.currentSettings.ai.NameInternal == Implementations.flavrCuda.NameInternal) ? "\n\nFor FLAVR, you need to select the correct model for each scale!" : ""; UiUtils.ShowMessageBox($"Error loading the AI model!\n\n{line}{msg}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("unicodeencodeerror")) + if (!hasShownError && line.Lower().Contains("unicodeencodeerror")) { hasShownError = true; UiUtils.ShowMessageBox($"It looks like your path contains invalid characters - remove them and try again!\n\n{line}", UiUtils.MessageType.Error); @@ -682,32 +682,32 @@ namespace Flowframes.Os if (ai.Piped) // VS specific { - if (!hasShownError && Interpolate.currentSettings.outSettings.Format != Enums.Output.Format.Realtime && line.ToLowerInvariant().Contains("fwrite() call failed")) + if (!hasShownError && Interpolate.currentSettings.outSettings.Format != Enums.Output.Format.Realtime && line.Lower().Contains("fwrite() call failed")) { hasShownError = true; UiUtils.ShowMessageBox($"VapourSynth interpolation failed with an unknown error. Check the log for details:\n\n{lastLogLines}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("allocate memory failed")) + if (!hasShownError && line.Lower().Contains("allocate memory failed")) { hasShownError = true; UiUtils.ShowMessageBox($"Out of memory!\nTry reducing your RAM usage by closing some programs.\n\n{line}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("vapoursynth.error:")) + if (!hasShownError && line.Lower().Contains("vapoursynth.error:")) { hasShownError = true; UiUtils.ShowMessageBox($"VapourSynth Error:\n\n{line}", UiUtils.MessageType.Error); } } - if (!hasShownError && err && line.ToLowerInvariant().Contains("out of memory")) + if (!hasShownError && err && line.Lower().Contains("out of memory")) { hasShownError = true; UiUtils.ShowMessageBox($"Your GPU ran out of VRAM! Please try a video with a lower resolution or use the Max Video Size option in the settings.\n\n{line}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("illegal memory access")) + if (!hasShownError && line.Lower().Contains("illegal memory access")) { hasShownError = true; UiUtils.ShowMessageBox($"Your GPU appears to be unstable! If you have an overclock enabled, please disable it!\n\n{line}", UiUtils.MessageType.Error); diff --git a/CodeLegacy/Os/OsUtils.cs b/CodeLegacy/Os/OsUtils.cs index 29cb1a5..8625b88 100644 --- a/CodeLegacy/Os/OsUtils.cs +++ b/CodeLegacy/Os/OsUtils.cs @@ -149,10 +149,10 @@ namespace Flowframes.Os var detectedDrives = Detector.DetectFixedDrives(QueryType.SeekPenalty); if (detectedDrives.Count != 0) { - char pathDriveLetter = (path[0].ToString().ToUpper())[0]; + char pathDriveLetter = (path[0].ToString().Upper())[0]; foreach (var detectedDrive in detectedDrives) { - if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().ToLowerInvariant().Trim() == "ssd") + if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().Lower().Trim() == "ssd") return true; } } diff --git a/CodeLegacy/Os/Python.cs b/CodeLegacy/Os/Python.cs index 653da72..30430c8 100644 --- a/CodeLegacy/Os/Python.cs +++ b/CodeLegacy/Os/Python.cs @@ -165,7 +165,7 @@ namespace Flowframes.Os Logger.Log("Checking if system Python is available...", true); string sysPyVer = GetSysPyVersion(); - if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.ToLowerInvariant().Contains("not found") && sysPyVer.Length <= 35) + if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.Lower().Contains("not found") && sysPyVer.Length <= 35) { isInstalled = true; Logger.Log("Using Python installation: " + sysPyVer, true); diff --git a/CodeLegacy/Os/StartupChecks.cs b/CodeLegacy/Os/StartupChecks.cs index 17ae672..7f2c14b 100644 --- a/CodeLegacy/Os/StartupChecks.cs +++ b/CodeLegacy/Os/StartupChecks.cs @@ -56,7 +56,7 @@ namespace Flowframes.Os if (winVer.IsEmpty()) return; - if (!winVer.ToLowerInvariant().Contains("windows 10") && !winVer.ToLowerInvariant().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false)) + if (!winVer.Lower().Contains("windows 10") && !winVer.Lower().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false)) { UiUtils.ShowMessageBox($"This application was made for Windows 10/11 and is not officially compatible with {winVer}.\n\n" + $"Use it at your own risk and do NOT ask for support as long as your are on {winVer}.", UiUtils.MessageType.Warning); diff --git a/CodeLegacy/Program.cs b/CodeLegacy/Program.cs index 7087e2f..6fbb8af 100644 --- a/CodeLegacy/Program.cs +++ b/CodeLegacy/Program.cs @@ -53,7 +53,7 @@ namespace Flowframes Config.Init(); Task.Run(() => DiskSpaceCheckLoop()); - args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).ToLowerInvariant()).ToArray(); + args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).Lower()).ToArray(); Logger.Log($"Command Line: {Environment.CommandLine}", true); LaunchGui(); diff --git a/CodeLegacy/Ui/DebugFormHelper.cs b/CodeLegacy/Ui/DebugFormHelper.cs index 69668cb..b497c1e 100644 --- a/CodeLegacy/Ui/DebugFormHelper.cs +++ b/CodeLegacy/Ui/DebugFormHelper.cs @@ -54,7 +54,7 @@ namespace Flowframes.Ui public static void ToggleMonospace(TextBox logBox) { - bool isMonospace = logBox.Font.Name.ToLowerInvariant().Contains("consolas"); + bool isMonospace = logBox.Font.Name.Lower().Contains("consolas"); if (isMonospace) logBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.5f); diff --git a/CodeLegacy/Ui/UiUtils.cs b/CodeLegacy/Ui/UiUtils.cs index 290f3a6..4df088a 100644 --- a/CodeLegacy/Ui/UiUtils.cs +++ b/CodeLegacy/Ui/UiUtils.cs @@ -74,7 +74,7 @@ namespace Flowframes.Ui { for (int i = 0; i < combox.Items.Count; i++) { - if (((string)combox.Items[i]).ToUpper().Contains("NCNN")) + if (((string)combox.Items[i]).Upper().Contains("NCNN")) combox.SelectedIndex = i; } } diff --git a/CodeLegacy/Utilities/ColorDataUtils.cs b/CodeLegacy/Utilities/ColorDataUtils.cs index e5d9c08..fdd6bd0 100644 --- a/CodeLegacy/Utilities/ColorDataUtils.cs +++ b/CodeLegacy/Utilities/ColorDataUtils.cs @@ -15,7 +15,7 @@ namespace Flowframes.Utilities { public static int GetColorPrimaries(string s) // Defined by the "Color primaries" section of ISO/IEC 23091-4/ITU-T H.273 { - s = s.Trim().ToLowerInvariant(); + s = s.Trim().Lower(); if (s == "bt709") return 1; if (s == "bt470m") return 4; if (s == "bt470bg") return 5; @@ -31,7 +31,7 @@ namespace Flowframes.Utilities public static int GetColorTransfer(string s) // Defined by the "Transfer characteristics" section of ISO/IEC 23091-4/ITU-T H.273 { - s = s.Trim().ToLowerInvariant(); + s = s.Trim().Lower(); if (s == "bt709") return 1; if (s == "gamma22" || s == "bt470m") return 4; if (s == "gamma28" || s == "bt470bg") return 5; // BT.470 System B, G (historical) @@ -53,7 +53,7 @@ namespace Flowframes.Utilities public static int GetMatrixCoeffs(string s) // Defined by the "Matrix coefficients" section of ISO/IEC 23091-4/ITU-T H.27 { - s = s.Trim().ToLowerInvariant(); + s = s.Trim().Lower(); if (s == "bt709") return 1; if (s == "fcc") return 4; // US FCC 73.628 if (s == "bt470bg") return 5; // BT.470 System B, G (historical) @@ -71,7 +71,7 @@ namespace Flowframes.Utilities public static int GetColorRange(string s) // Defined by the "Matrix coefficients" section of ISO/IEC 23091-4/ITU-T H.27 { - s = s.Trim().ToLowerInvariant(); + s = s.Trim().Lower(); if (s == "tv") return 1; // TV if (s == "pc") return 2; // PC/Full return 0; // Fallback: Unspecified diff --git a/Flowframes/Data/AI.cs b/Flowframes/Data/AI.cs index 07cada6..6e39de4 100644 --- a/Flowframes/Data/AI.cs +++ b/Flowframes/Data/AI.cs @@ -18,7 +18,7 @@ namespace Flowframes.Data public string NameLong { get; set; } = ""; public string FriendlyName { get { return $"{NameShort} ({GetFrameworkString(Backend)})"; } } public string Description { get { return $"{GetImplemString(Backend)} of {NameShort}{(Backend == AiBackend.Pytorch ? " (Nvidia Only!)" : "")}"; } } - public string PkgDir { get { return NameInternal.Replace("_", "-").ToLowerInvariant(); } } + public string PkgDir { get { return NameInternal.Replace("_", "-").Lower(); } } public enum InterpFactorSupport { Fixed, AnyPowerOfTwo, AnyInteger, AnyFloat } public InterpFactorSupport FactorSupport { get; set; } = InterpFactorSupport.Fixed; public int[] SupportedFactors { get; set; } = new int[0]; diff --git a/Flowframes/Data/InterpSettings.cs b/Flowframes/Data/InterpSettings.cs index 97399b2..a88453b 100644 --- a/Flowframes/Data/InterpSettings.cs +++ b/Flowframes/Data/InterpSettings.cs @@ -184,7 +184,7 @@ namespace Flowframes bool gifOutput = outSettings.Encoder == Enums.Encoding.Encoder.Gif; bool proResAlpha = outSettings.Encoder == Enums.Encoding.Encoder.ProResKs && OutputUtils.AlphaFormats.Contains(outSettings.PixelFormat); bool outputSupportsAlpha = pngOutput || gifOutput || proResAlpha; - string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).ToLowerInvariant() : Path.GetExtension(inPath).ToLowerInvariant(); + string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).Lower() : Path.GetExtension(inPath).Lower(); alpha = (alphaModel && outputSupportsAlpha && (ext == ".gif" || ext == ".png" || ext == ".apng" || ext == ".mov")); Logger.Log($"RefreshAlpha: model.supportsAlpha = {alphaModel} - outputSupportsAlpha = {outputSupportsAlpha} - input ext: {ext} => alpha = {alpha}", true); } diff --git a/Flowframes/Data/MediaFile.cs b/Flowframes/Data/MediaFile.cs index 77954e8..6fdb9bd 100644 --- a/Flowframes/Data/MediaFile.cs +++ b/Flowframes/Data/MediaFile.cs @@ -66,7 +66,7 @@ namespace Flowframes.Data Name = FileInfo.Name; SourcePath = FileInfo.FullName; ImportPath = FileInfo.FullName; - Format = FileInfo.Extension.Remove(".").ToUpper(); + Format = FileInfo.Extension.Remove(".").Upper(); InputRate = new Fraction(-1, 1); } diff --git a/Flowframes/Data/SubtitleTrack.cs b/Flowframes/Data/SubtitleTrack.cs index c199826..e24964e 100644 --- a/Flowframes/Data/SubtitleTrack.cs +++ b/Flowframes/Data/SubtitleTrack.cs @@ -13,7 +13,7 @@ namespace Flowframes.Data { streamIndex = streamNum; lang = metaStr.Trim().Replace("_", ".").Replace(" ", "."); - //langFriendly = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaStr.ToLowerInvariant().Trim().Replace("_", ".").Replace(" ", ".")); + //langFriendly = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaStr.Lower().Trim().Replace("_", ".").Replace(" ", ".")); encoding = encodingStr.Trim(); } } diff --git a/Flowframes/Extensions/ExtensionMethods.cs b/Flowframes/Extensions/ExtensionMethods.cs index f548c12..138a287 100644 --- a/Flowframes/Extensions/ExtensionMethods.cs +++ b/Flowframes/Extensions/ExtensionMethods.cs @@ -249,7 +249,7 @@ namespace Flowframes { try { - return Path.GetExtension(filePath)?.ToLowerInvariant() == ".concat"; + return Path.GetExtension(filePath)?.Lower() == ".concat"; } catch { @@ -367,7 +367,7 @@ namespace Flowframes if (s == null) return s; - return s.ToLowerInvariant(); + return s.Lower(); } public static string Upper(this string s) diff --git a/Flowframes/IO/IoUtils.cs b/Flowframes/IO/IoUtils.cs index 25f70ee..ddc34ec 100644 --- a/Flowframes/IO/IoUtils.cs +++ b/Flowframes/IO/IoUtils.cs @@ -27,7 +27,7 @@ namespace Flowframes.IO try { - string ext = new FileInfo(path).Extension.TrimStart('.').ToUpper(); + string ext = new FileInfo(path).Extension.TrimStart('.').Upper(); if (incompatibleExtensions.Contains(ext)) return null; @@ -328,7 +328,7 @@ namespace Flowframes.IO public static async Task GetVideoFramerate(string path) { string[] preferFfmpegReadoutFormats = new string[] { ".gif", ".png", ".apng", ".webp" }; - bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).ToLowerInvariant()); + bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).Lower()); Fraction fps = new Fraction(); @@ -620,7 +620,7 @@ namespace Flowframes.IO filename = filename.Replace("[NAME]", inName); filename = filename.Replace("[FULLNAME]", Path.GetFileName(curr.inPath)); filename = filename.Replace("[FACTOR]", curr.interpFactor.ToStringDot()); - filename = filename.Replace("[AI]", curr.ai.NameShort.ToUpper()); + filename = filename.Replace("[AI]", curr.ai.NameShort.Upper()); filename = filename.Replace("[MODEL]", curr.model.Name.Remove(" ")); filename = filename.Replace("[FPS]", fps.ToStringDot("0.###")); filename = filename.Replace("[ROUNDFPS]", fps.RoundToInt().ToString()); @@ -766,7 +766,7 @@ namespace Flowframes.IO { MD5 md5 = MD5.Create(); var hash = md5.ComputeHash(stream); - hashStr = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); + hashStr = BitConverter.ToString(hash).Replace("-", "").Lower(); } if (hashType == Hash.CRC32) diff --git a/Flowframes/IO/ModelDownloader.cs b/Flowframes/IO/ModelDownloader.cs index 59d6750..1bc5340 100644 --- a/Flowframes/IO/ModelDownloader.cs +++ b/Flowframes/IO/ModelDownloader.cs @@ -20,7 +20,7 @@ namespace Flowframes.IO string custServer = Config.Get(Config.Key.customServer); string server = custServer.Trim().Length > 3 ? custServer : Servers.GetServer().GetUrl(); string baseUrl = $"{server}/flowframes/mdl/"; - return Path.Combine(baseUrl, ai.ToLowerInvariant(), relPath); + return Path.Combine(baseUrl, ai.Lower(), relPath); } static string GetMdlFileUrl(string ai, string model, string relPath) diff --git a/Flowframes/Magick/Converter.cs b/Flowframes/Magick/Converter.cs index f216e4a..409e918 100644 --- a/Flowframes/Magick/Converter.cs +++ b/Flowframes/Magick/Converter.cs @@ -22,7 +22,7 @@ namespace Flowframes.Magick int counter = 0; foreach (string file in files) { - if (print) Logger.Log("Converting " + Path.GetFileName(file) + " to " + format.ToString().StripNumbers().ToUpper(), false, true); + if (print) Logger.Log("Converting " + Path.GetFileName(file) + " to " + format.ToString().StripNumbers().Upper(), false, true); MagickImage img = new MagickImage(file); img.Format = format; img.Quality = quality; diff --git a/Flowframes/Main/Export.cs b/Flowframes/Main/Export.cs index 75fa092..e9d08d3 100644 --- a/Flowframes/Main/Export.cs +++ b/Flowframes/Main/Export.cs @@ -126,7 +126,7 @@ namespace Flowframes.Main { Program.mainForm.SetStatus("Copying output frames..."); Enums.Encoding.Encoder desiredFormat = I.currentSettings.outSettings.Encoder; - string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(framesPath, "*.*")[0]).Remove(".").ToUpper(); + string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(framesPath, "*.*")[0]).Remove(".").Upper(); string max = Config.Get(Config.Key.maxFps); Fraction maxFps = max.Contains("/") ? new Fraction(max) : new Fraction(max.GetFloat()); bool fpsLimit = maxFps.GetFloat() > 0f && I.currentSettings.outFps.GetFloat() > maxFps.GetFloat(); @@ -139,7 +139,7 @@ namespace Flowframes.Main IoUtils.RenameExistingFolder(outputFolderPath); Logger.Log($"Exporting {desiredFormat.ToString().Upper()} frames to '{Path.GetFileName(outputFolderPath)}'..."); - if (desiredFormat.GetInfo().OverideExtension.ToUpper() == availableFormat.ToUpper()) // Move if frames are already in the desired format + if (desiredFormat.GetInfo().OverideExtension.Upper() == availableFormat.Upper()) // Move if frames are already in the desired format await CopyOutputFrames(framesPath, framesFile, outputFolderPath, 1, fpsLimit, false); else // Encode if frames are not in desired format await FfmpegEncode.FramesToFrames(framesFile, outputFolderPath, 1, I.currentSettings.outFps, new Fraction(), desiredFormat, OutputUtils.GetImgSeqQ(I.currentSettings.outSettings)); @@ -301,7 +301,7 @@ namespace Flowframes.Main if (settings.Encoder.GetInfo().IsImageSequence) // Image Sequence output mode, not video { string desiredFormat = settings.Encoder.GetInfo().OverideExtension; - string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").ToUpper(); + string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").Upper(); if (!dontEncodeFullFpsVid) { @@ -311,7 +311,7 @@ namespace Flowframes.Main if (chunkNo == 1) // Only check for existing folder on first chunk, otherwise each chunk makes a new folder IoUtils.RenameExistingFolder(outFolderPath); - if (desiredFormat.ToUpper() == availableFormat.ToUpper()) // Move if frames are already in the desired format + if (desiredFormat.Upper() == availableFormat.Upper()) // Move if frames are already in the desired format await CopyOutputFrames(interpDir, concatFile, outFolderPath, startNo, fpsLimit, true); else // Encode if frames are not in desired format await FfmpegEncode.FramesToFrames(concatFile, outFolderPath, startNo, I.currentSettings.outFps, new Fraction(), settings.Encoder, OutputUtils.GetImgSeqQ(settings), AvProcess.LogMode.Hidden); diff --git a/Flowframes/Main/InterpolateUtils.cs b/Flowframes/Main/InterpolateUtils.cs index 297983d..9399125 100644 --- a/Flowframes/Main/InterpolateUtils.cs +++ b/Flowframes/Main/InterpolateUtils.cs @@ -170,7 +170,7 @@ namespace Flowframes.Main return false; } - if (I.currentSettings.ai.NameInternal.ToUpper().Contains("CUDA") && NvApi.gpuList.Count < 1) + if (I.currentSettings.ai.NameInternal.Upper().Contains("CUDA") && NvApi.gpuList.Count < 1) { UiUtils.ShowMessageBox("Warning: No Nvidia GPU was detected. CUDA might fall back to CPU!\n\nTry an NCNN implementation instead if you don't have an Nvidia GPU.", UiUtils.MessageType.Error); @@ -234,7 +234,7 @@ namespace Flowframes.Main { string enc = I.currentSettings.outSettings.Encoder.GetInfo().Name; - if (enc.ToLowerInvariant().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc))) + if (enc.Lower().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc))) { UiUtils.ShowMessageBox("NVENC encoding is not available on your hardware!\nPlease use a different encoder.", UiUtils.MessageType.Error); I.Cancel(); diff --git a/Flowframes/Media/FfmpegCommands.cs b/Flowframes/Media/FfmpegCommands.cs index 888d2ae..6ae63b8 100644 --- a/Flowframes/Media/FfmpegCommands.cs +++ b/Flowframes/Media/FfmpegCommands.cs @@ -241,7 +241,7 @@ namespace Flowframes try { string[] lines = info.SplitIntoLines(); - string lastLine = lines.Last().ToLowerInvariant(); + string lastLine = lines.Last().Lower(); return lastLine.Substring(0, lastLine.IndexOf("fps")).GetInt(); } catch diff --git a/Flowframes/Media/FfmpegExtract.cs b/Flowframes/Media/FfmpegExtract.cs index adc29dd..150e26d 100644 --- a/Flowframes/Media/FfmpegExtract.cs +++ b/Flowframes/Media/FfmpegExtract.cs @@ -307,7 +307,7 @@ namespace Flowframes.Media public static async Task ImportSingleImage(string inputFile, string outPath, Size size) { string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : ""; - bool isPng = (Path.GetExtension(outPath).ToLowerInvariant() == ".png"); + bool isPng = (Path.GetExtension(outPath).Lower() == ".png"); string comprArg = isPng ? pngCompr : ""; string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p"); string args = $"-i {inputFile.Wrap()} {comprArg} {sizeStr} {pixFmt} -vf {GetPadFilter()} {outPath.Wrap()}"; @@ -316,7 +316,7 @@ namespace Flowframes.Media public static async Task ExtractSingleFrame(string inputFile, string outputPath, int frameNum) { - bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png"); + bool isPng = (Path.GetExtension(outputPath).Lower() == ".png"); string comprArg = isPng ? pngCompr : ""; string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p"); string args = $"-i {inputFile.Wrap()} -vf \"select=eq(n\\,{frameNum})\" -vframes 1 {pixFmt} {outputPath.Wrap()}"; @@ -331,7 +331,7 @@ namespace Flowframes.Media if (IoUtils.IsPathDirectory(outputPath)) outputPath = Path.Combine(outputPath, "last.png"); - bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png"); + bool isPng = (Path.GetExtension(outputPath).Lower() == ".png"); string comprArg = isPng ? pngCompr : ""; string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p"); string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : ""; diff --git a/Flowframes/Media/FfmpegUtils.cs b/Flowframes/Media/FfmpegUtils.cs index b6e8e2c..a96667d 100644 --- a/Flowframes/Media/FfmpegUtils.cs +++ b/Flowframes/Media/FfmpegUtils.cs @@ -66,7 +66,7 @@ namespace Flowframes.Media string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx); string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx); string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx); - string pixFmt = (await GetFfprobeInfoAsync(path, showStreams, "pix_fmt", idx)).ToUpper(); + string pixFmt = (await GetFfprobeInfoAsync(path, showStreams, "pix_fmt", idx)).Upper(); int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024; Size res = await GetMediaResolutionCached.GetSizeAsync(path); Size sar = SizeFromString(await GetFfprobeInfoAsync(path, showStreams, "sample_aspect_ratio", idx)); @@ -87,7 +87,7 @@ namespace Flowframes.Media string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx); string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx); string profile = await GetFfprobeInfoAsync(path, showStreams, "profile", idx); - if (codec.ToLowerInvariant() == "dts" && profile != "unknown") codec = profile; + if (codec.Lower() == "dts" && profile != "unknown") codec = profile; string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx); int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024; int sampleRate = (await GetFfprobeInfoAsync(path, showStreams, "sample_rate", idx)).GetInt(); @@ -251,14 +251,14 @@ namespace Flowframes.Media if (enc == Encoder.X264) { - string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); // TODO: Replace this ugly stuff with enums + string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); // TODO: Replace this ugly stuff with enums int crf = GetCrf(settings); args.Add($"-crf {crf} -preset {preset}"); } if (enc == Encoder.X265) { - string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); // TODO: Replace this ugly stuff with enums + string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); // TODO: Replace this ugly stuff with enums int crf = GetCrf(settings); args.Add($"{(crf > 0 ? $"-crf {crf}" : "-x265-params lossless=1")} -preset {preset}"); } @@ -403,7 +403,7 @@ namespace Flowframes.Media static string GetVp9Speed() { - string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); + string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); string arg = ""; if (preset == "veryslow") arg = "0"; @@ -419,7 +419,7 @@ namespace Flowframes.Media static string GetSvtAv1Speed() { - string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); + string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); string arg = "8"; if (preset == "veryslow") arg = "3"; @@ -549,10 +549,10 @@ namespace Flowframes.Media { containerExt = containerExt.Remove("."); bool supported = (containerExt == "mp4" || containerExt == "mkv" || containerExt == "webm" || containerExt == "mov"); - Logger.Log($"Subtitles {(supported ? "are supported" : "not supported")} by {containerExt.ToUpper()}", true); + Logger.Log($"Subtitles {(supported ? "are supported" : "not supported")} by {containerExt.Upper()}", true); if (showWarningIfNotSupported && Config.GetBool(Config.Key.keepSubs) && !supported) - Logger.Log($"Warning: {containerExt.ToUpper()} exports do not include subtitles."); + Logger.Log($"Warning: {containerExt.Upper()} exports do not include subtitles."); return supported; } diff --git a/Flowframes/Media/GetVideoInfo.cs b/Flowframes/Media/GetVideoInfo.cs index ceca63b..3949b7b 100644 --- a/Flowframes/Media/GetVideoInfo.cs +++ b/Flowframes/Media/GetVideoInfo.cs @@ -79,13 +79,13 @@ namespace Flowframes.Media if (stripKeyName) { - List filtered = output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToList(); // Filter + List filtered = output.SplitIntoLines().Where(x => x.Lower().Contains(lineFilter.Lower())).ToList(); // Filter filtered = filtered.Select(x => string.Join("", x.Split('=').Skip(1))).ToList(); // Ignore everything before (and including) the first '=' sign output = string.Join("\n", filtered); } else { - output = string.Join("\n", output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToArray()); + output = string.Join("\n", output.SplitIntoLines().Where(x => x.Lower().Contains(lineFilter.Lower())).ToArray()); } } diff --git a/Flowframes/MiscUtils/FormatUtils.cs b/Flowframes/MiscUtils/FormatUtils.cs index 1f4e687..d2305cd 100644 --- a/Flowframes/MiscUtils/FormatUtils.cs +++ b/Flowframes/MiscUtils/FormatUtils.cs @@ -193,7 +193,7 @@ namespace Flowframes.MiscUtils public static string CapsIfShort(string codec, int capsIfShorterThan = 5) { if (codec.Length < capsIfShorterThan) - return codec.ToUpper(); + return codec.Upper(); else return codec.ToTitleCase(); } diff --git a/Flowframes/Os/AiProcess.cs b/Flowframes/Os/AiProcess.cs index 1d0fcf7..8fbe13e 100644 --- a/Flowframes/Os/AiProcess.cs +++ b/Flowframes/Os/AiProcess.cs @@ -140,8 +140,8 @@ namespace Flowframes.Os { if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited) { - if (Logger.LastLogLine.ToLowerInvariant().Contains("frame: ")) - Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.ToLowerInvariant().Contains("frame")); + if (Logger.LastLogLine.Lower().Contains("frame: ")) + Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.Lower().Contains("frame")); } if (AvProcess.lastAvProcess.HasExited && !AutoEncode.HasWorkToDo()) // Stop logging if ffmpeg is not running & AE is done @@ -326,7 +326,7 @@ namespace Flowframes.Os string ttaStr = Config.GetBool(Config.Key.rifeNcnnUseTta, false) ? "-x" : ""; rifeNcnn.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {Path.Combine(Paths.GetPkgPath(), Implementations.rifeNcnn.PkgDir).Wrap()} & rife-ncnn-vulkan.exe " + - $" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.ToLowerInvariant()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads(Implementations.rifeNcnn)}"; + $" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.Lower()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads(Implementations.rifeNcnn)}"; Logger.Log("cmd.exe " + rifeNcnn.StartInfo.Arguments, true); @@ -458,7 +458,7 @@ namespace Flowframes.Os SetProgressCheck(outPath, factor); int targetFrames = ((IoUtils.GetAmountOfFiles(lastInPath, false, "*.*") * factor).RoundToInt()); - string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.ToLowerInvariant()}" + + string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.Lower()}" + $" -t {NcnnUtils.GetNcnnTilesize(tilesize)} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j 2:1:2"; dain.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {dainDir.Wrap()} & dain-ncnn-vulkan.exe {args}"; @@ -620,26 +620,26 @@ namespace Flowframes.Os if (line.Contains("ff:nocuda-cpu")) Logger.Log("WARNING: CUDA-capable GPU device is not available, running on CPU instead!"); - if (!hasShownError && err && line.ToLowerInvariant().Contains("modulenotfounderror")) + if (!hasShownError && err && line.Lower().Contains("modulenotfounderror")) { hasShownError = true; UiUtils.ShowMessageBox($"A python module is missing.\nCheck {ai.LogFilename} for details.\n\n{line}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("no longer supports this gpu")) + if (!hasShownError && line.Lower().Contains("no longer supports this gpu")) { hasShownError = true; UiUtils.ShowMessageBox($"Your GPU seems to be outdated and is not supported!\n\n{line}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("error(s) in loading state_dict")) + if (!hasShownError && line.Lower().Contains("error(s) in loading state_dict")) { hasShownError = true; string msg = (Interpolate.currentSettings.ai.NameInternal == Implementations.flavrCuda.NameInternal) ? "\n\nFor FLAVR, you need to select the correct model for each scale!" : ""; UiUtils.ShowMessageBox($"Error loading the AI model!\n\n{line}{msg}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("unicodeencodeerror")) + if (!hasShownError && line.Lower().Contains("unicodeencodeerror")) { hasShownError = true; UiUtils.ShowMessageBox($"It looks like your path contains invalid characters - remove them and try again!\n\n{line}", UiUtils.MessageType.Error); @@ -683,32 +683,32 @@ namespace Flowframes.Os if (ai.Piped) // VS specific { - if (!hasShownError && Interpolate.currentSettings.outSettings.Format != Enums.Output.Format.Realtime && line.ToLowerInvariant().Contains("fwrite() call failed")) + if (!hasShownError && Interpolate.currentSettings.outSettings.Format != Enums.Output.Format.Realtime && line.Lower().Contains("fwrite() call failed")) { hasShownError = true; UiUtils.ShowMessageBox($"VapourSynth interpolation failed with an unknown error. Check the log for details:\n\n{lastLogLines}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("allocate memory failed")) + if (!hasShownError && line.Lower().Contains("allocate memory failed")) { hasShownError = true; UiUtils.ShowMessageBox($"Out of memory!\nTry reducing your RAM usage by closing some programs.\n\n{line}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("vapoursynth.error:")) + if (!hasShownError && line.Lower().Contains("vapoursynth.error:")) { hasShownError = true; UiUtils.ShowMessageBox($"VapourSynth Error:\n\n{line}", UiUtils.MessageType.Error); } } - if (!hasShownError && err && line.ToLowerInvariant().Contains("out of memory")) + if (!hasShownError && err && line.Lower().Contains("out of memory")) { hasShownError = true; UiUtils.ShowMessageBox($"Your GPU ran out of VRAM! Please try a video with a lower resolution or use the Max Video Size option in the settings.\n\n{line}", UiUtils.MessageType.Error); } - if (!hasShownError && line.ToLowerInvariant().Contains("illegal memory access")) + if (!hasShownError && line.Lower().Contains("illegal memory access")) { hasShownError = true; UiUtils.ShowMessageBox($"Your GPU appears to be unstable! If you have an overclock enabled, please disable it!\n\n{line}", UiUtils.MessageType.Error); diff --git a/Flowframes/Os/OsUtils.cs b/Flowframes/Os/OsUtils.cs index 7c64673..ebdd209 100644 --- a/Flowframes/Os/OsUtils.cs +++ b/Flowframes/Os/OsUtils.cs @@ -148,10 +148,10 @@ namespace Flowframes.Os var detectedDrives = Detector.DetectFixedDrives(QueryType.SeekPenalty); if (detectedDrives.Count != 0) { - char pathDriveLetter = (path[0].ToString().ToUpper())[0]; + char pathDriveLetter = (path[0].ToString().Upper())[0]; foreach (var detectedDrive in detectedDrives) { - if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().ToLowerInvariant().Trim() == "ssd") + if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().Lower().Trim() == "ssd") return true; } } diff --git a/Flowframes/Os/Python.cs b/Flowframes/Os/Python.cs index e033d26..b2618e0 100644 --- a/Flowframes/Os/Python.cs +++ b/Flowframes/Os/Python.cs @@ -160,7 +160,7 @@ namespace Flowframes.Os Logger.Log("Checking if system Python is available...", true); string sysPyVer = GetSysPyVersion(); - if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.ToLowerInvariant().Contains("not found") && sysPyVer.Length <= 35) + if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.Lower().Contains("not found") && sysPyVer.Length <= 35) { isInstalled = true; Logger.Log("Using Python installation: " + sysPyVer, true); diff --git a/Flowframes/Os/StartupChecks.cs b/Flowframes/Os/StartupChecks.cs index 3ff7f1d..a6f4f3e 100644 --- a/Flowframes/Os/StartupChecks.cs +++ b/Flowframes/Os/StartupChecks.cs @@ -22,7 +22,7 @@ namespace Flowframes.Os string[] osInfo = osInfoStr.Split(" | "); string version = osInfo[0].Remove("Microsoft").Trim(); - return (version.ToLowerInvariant().Contains("windows 10") || version.ToLowerInvariant().Contains("windows 11")); + return (version.Lower().Contains("windows 10") || version.Lower().Contains("windows 11")); } static bool Is32Bit() @@ -39,7 +39,7 @@ namespace Flowframes.Os public static void CheckOs() { - if (!File.Exists(Paths.GetVerPath()) && Paths.GetExeDir().ToLowerInvariant().Contains("temp")) + if (!File.Exists(Paths.GetVerPath()) && Paths.GetExeDir().Lower().Contains("temp")) { UiUtils.ShowMessageBox("You seem to be running Flowframes out of an archive.\nPlease extract the whole archive first!", UiUtils.MessageType.Error); IoUtils.TryDeleteIfExists(Paths.GetDataPath()); @@ -58,7 +58,7 @@ namespace Flowframes.Os if (string.IsNullOrWhiteSpace(version)) return; - if (!version.ToLowerInvariant().Contains("windows 10") && !version.ToLowerInvariant().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false)) + if (!version.Lower().Contains("windows 10") && !version.Lower().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false)) { UiUtils.ShowMessageBox($"This application was made for Windows 10/11 and is not officially compatible with {version}.\n\n" + $"Use it at your own risk and do NOT ask for support as long as your are on {version}.", UiUtils.MessageType.Warning); diff --git a/Flowframes/Program.cs b/Flowframes/Program.cs index e8bcb55..fe99a14 100644 --- a/Flowframes/Program.cs +++ b/Flowframes/Program.cs @@ -66,7 +66,7 @@ namespace Flowframes Task.Run(() => DiskSpaceCheckLoop()); fileArgs = Environment.GetCommandLineArgs().Where(a => a[0] != '-' && File.Exists(a)).ToList().Skip(1).ToArray(); - args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).ToLowerInvariant()).ToArray(); + args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).Lower()).ToArray(); Logger.Log($"Command Line: {Environment.CommandLine}", true); Logger.Log($"Files: {(fileArgs.Length > 0 ? string.Join(", ", fileArgs) : "None")}", true); Logger.Log($"Args: {(args.Length > 0 ? string.Join(", ", args) : "None")}", true); diff --git a/Flowframes/Ui/DebugFormHelper.cs b/Flowframes/Ui/DebugFormHelper.cs index 9da82a0..9cdf8af 100644 --- a/Flowframes/Ui/DebugFormHelper.cs +++ b/Flowframes/Ui/DebugFormHelper.cs @@ -54,7 +54,7 @@ namespace Flowframes.Ui public static void ToggleMonospace(TextBox logBox) { - bool isMonospace = logBox.Font.Name.ToLowerInvariant().Contains("consolas"); + bool isMonospace = logBox.Font.Name.Lower().Contains("consolas"); if (isMonospace) logBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.5f); diff --git a/Flowframes/Ui/UiUtils.cs b/Flowframes/Ui/UiUtils.cs index f4cc6d5..455fcff 100644 --- a/Flowframes/Ui/UiUtils.cs +++ b/Flowframes/Ui/UiUtils.cs @@ -74,7 +74,7 @@ namespace Flowframes.Ui { for (int i = 0; i < combox.Items.Count; i++) { - if (((string)combox.Items[i]).ToUpper().Contains("NCNN")) + if (((string)combox.Items[i]).Upper().Contains("NCNN")) combox.SelectedIndex = i; } } diff --git a/Flowframes/Utilities/ColorDataUtils.cs b/Flowframes/Utilities/ColorDataUtils.cs index e5d9c08..fdd6bd0 100644 --- a/Flowframes/Utilities/ColorDataUtils.cs +++ b/Flowframes/Utilities/ColorDataUtils.cs @@ -15,7 +15,7 @@ namespace Flowframes.Utilities { public static int GetColorPrimaries(string s) // Defined by the "Color primaries" section of ISO/IEC 23091-4/ITU-T H.273 { - s = s.Trim().ToLowerInvariant(); + s = s.Trim().Lower(); if (s == "bt709") return 1; if (s == "bt470m") return 4; if (s == "bt470bg") return 5; @@ -31,7 +31,7 @@ namespace Flowframes.Utilities public static int GetColorTransfer(string s) // Defined by the "Transfer characteristics" section of ISO/IEC 23091-4/ITU-T H.273 { - s = s.Trim().ToLowerInvariant(); + s = s.Trim().Lower(); if (s == "bt709") return 1; if (s == "gamma22" || s == "bt470m") return 4; if (s == "gamma28" || s == "bt470bg") return 5; // BT.470 System B, G (historical) @@ -53,7 +53,7 @@ namespace Flowframes.Utilities public static int GetMatrixCoeffs(string s) // Defined by the "Matrix coefficients" section of ISO/IEC 23091-4/ITU-T H.27 { - s = s.Trim().ToLowerInvariant(); + s = s.Trim().Lower(); if (s == "bt709") return 1; if (s == "fcc") return 4; // US FCC 73.628 if (s == "bt470bg") return 5; // BT.470 System B, G (historical) @@ -71,7 +71,7 @@ namespace Flowframes.Utilities public static int GetColorRange(string s) // Defined by the "Matrix coefficients" section of ISO/IEC 23091-4/ITU-T H.27 { - s = s.Trim().ToLowerInvariant(); + s = s.Trim().Lower(); if (s == "tv") return 1; // TV if (s == "pc") return 2; // PC/Full return 0; // Fallback: Unspecified diff --git a/Pkgs/rife-ncnn-vs/models.json b/Pkgs/rife-ncnn-vs/models.json index f33161b..d729199 100644 --- a/Pkgs/rife-ncnn-vs/models.json +++ b/Pkgs/rife-ncnn-vs/models.json @@ -6,76 +6,28 @@ "isDefault": "false", "fixedFactors": [2] }, -{ - "name": "RIFE 4.0", - "desc": "v4 General Model", - "dir": "rife-v4", - "isDefault": "false" -}, -{ - "name": "RIFE 4.3", - "desc": "v4 General Model", - "dir": "rife-v4.3", - "isDefault": "false" -}, -{ - "name": "RIFE 4.4", - "desc": "v4 General Model", - "dir": "rife-v4.4", - "isDefault": "false" -}, -{ - "name": "RIFE 4.6", - "desc": "v4 General Model", - "dir": "rife-v4.6", - "isDefault": "false" -}, -{ - "name": "RIFE 4.7", - "desc": "v4 General Model", - "dir": "rife-v4.7", - "isDefault": "false" -}, -{ - "name": "RIFE 4.8", - "desc": "v4 General Model", - "dir": "rife-v4.8", - "isDefault": "false" -}, { "name": "RIFE 4.9", "desc": "v4 General Model", "dir": "rife-v4.9", "isDefault": "false" }, -{ - "name": "RIFE 4.10", - "desc": "v4 General Model", - "dir": "rife-v4.10", - "isDefault": "false" -}, -{ - "name": "RIFE 4.11", - "desc": "v4 General Model", - "dir": "rife-v4.11", - "isDefault": "false" -}, -{ - "name": "RIFE 4.12", - "desc": "v4 General Model", - "dir": "rife-v4.12", - "isDefault": "false" -}, -{ - "name": "RIFE 4.12 Lite", - "desc": "Small v4 General Model", - "dir": "rife-v4.12_lite", - "isDefault": "false" -}, { "name": "RIFE 4.13", "desc": "v4 General Model", "dir": "rife-v4.13", + "isDefault": "false" +}, +{ + "name": "RIFE 4.18", + "desc": "v4 Model - Recommended for real-world video", + "dir": "rife-v4.18", + "isDefault": "false" +}, +{ + "name": "RIFE 4.22", + "desc": "v4 Model - Recommended for anime video", + "dir": "rife-v4.22", "isDefault": "true" }, ] \ No newline at end of file diff --git a/Pkgs/rife-ncnn/models.json b/Pkgs/rife-ncnn/models.json index f33161b..d729199 100644 --- a/Pkgs/rife-ncnn/models.json +++ b/Pkgs/rife-ncnn/models.json @@ -6,76 +6,28 @@ "isDefault": "false", "fixedFactors": [2] }, -{ - "name": "RIFE 4.0", - "desc": "v4 General Model", - "dir": "rife-v4", - "isDefault": "false" -}, -{ - "name": "RIFE 4.3", - "desc": "v4 General Model", - "dir": "rife-v4.3", - "isDefault": "false" -}, -{ - "name": "RIFE 4.4", - "desc": "v4 General Model", - "dir": "rife-v4.4", - "isDefault": "false" -}, -{ - "name": "RIFE 4.6", - "desc": "v4 General Model", - "dir": "rife-v4.6", - "isDefault": "false" -}, -{ - "name": "RIFE 4.7", - "desc": "v4 General Model", - "dir": "rife-v4.7", - "isDefault": "false" -}, -{ - "name": "RIFE 4.8", - "desc": "v4 General Model", - "dir": "rife-v4.8", - "isDefault": "false" -}, { "name": "RIFE 4.9", "desc": "v4 General Model", "dir": "rife-v4.9", "isDefault": "false" }, -{ - "name": "RIFE 4.10", - "desc": "v4 General Model", - "dir": "rife-v4.10", - "isDefault": "false" -}, -{ - "name": "RIFE 4.11", - "desc": "v4 General Model", - "dir": "rife-v4.11", - "isDefault": "false" -}, -{ - "name": "RIFE 4.12", - "desc": "v4 General Model", - "dir": "rife-v4.12", - "isDefault": "false" -}, -{ - "name": "RIFE 4.12 Lite", - "desc": "Small v4 General Model", - "dir": "rife-v4.12_lite", - "isDefault": "false" -}, { "name": "RIFE 4.13", "desc": "v4 General Model", "dir": "rife-v4.13", + "isDefault": "false" +}, +{ + "name": "RIFE 4.18", + "desc": "v4 Model - Recommended for real-world video", + "dir": "rife-v4.18", + "isDefault": "false" +}, +{ + "name": "RIFE 4.22", + "desc": "v4 Model - Recommended for anime video", + "dir": "rife-v4.22", "isDefault": "true" }, ] \ No newline at end of file