perf: Various fixes

This commit is contained in:
ManicSteiner
2023-12-23 23:30:09 +08:00
parent 53d8fdd844
commit eb60e27378
3 changed files with 10 additions and 5 deletions

View File

@@ -103,6 +103,9 @@ namespace GameRes.Formats.Ivory
bool IsValidInput (Stream input, uint width, uint height, int pixel_size)
{
int total = (int)width * (int)height;
// Other formats will be incorrectly recognized as this format, try to correct it.
if (total * pixel_size < input.Length / 10)
return false;
int dst = 0;
while (dst < total)
{