Browse Source

Added debug guard to the estimate quality

pull/1706/head
Dmitry Pentin 5 years ago
parent
commit
51e1366790
  1. 6
      src/ImageSharp/Formats/Jpeg/Components/Decoder/QualityEvaluator.cs

6
src/ImageSharp/Formats/Jpeg/Components/Decoder/QualityEvaluator.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
@ -78,6 +78,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
/// <returns>The <see cref="int"/>.</returns>
public static int EstimateQuality(Block8x8F[] quantizationTables)
{
DebugGuard.MustBeGreaterThan(quantizationTables.Length, 2, nameof(quantizationTables));
int quality = 75;
float sum = 0;
@ -141,4 +143,4 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
return quality;
}
}
}
}

Loading…
Cancel
Save