Skip to content

Commit eaf23dd

Browse files
Merge branch 'main' into js/gif-fixes
2 parents 0d4a23a + bf43044 commit eaf23dd

File tree

82 files changed

+184
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+184
-155
lines changed

src/ImageSharp/Processing/Processors/Quantization/EuclideanPixelMap{TPixel}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ private static int DistanceSquared(Rgba32 a, Rgba32 b)
149149
/// The granularity of the cache has been determined based upon the current
150150
/// suite of test images and provides the lowest possible memory usage while
151151
/// providing enough match accuracy.
152-
/// Entry count is currently limited to 1185921 entries (2371842 bytes ~2.26MB).
152+
/// Entry count is currently limited to 2335905 entries (4671810 bytes ~4.45MB).
153153
/// </para>
154154
/// </remarks>
155155
private unsafe struct ColorDistanceCache : IDisposable
156156
{
157157
private const int IndexBits = 5;
158-
private const int IndexAlphaBits = 5;
158+
private const int IndexAlphaBits = 6;
159159
private const int IndexCount = (1 << IndexBits) + 1;
160160
private const int IndexAlphaCount = (1 << IndexAlphaBits) + 1;
161161
private const int RgbShift = 8 - IndexBits;

tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using SixLabors.ImageSharp.Formats.Png;
88
using SixLabors.ImageSharp.Memory;
99
using SixLabors.ImageSharp.PixelFormats;
10+
using SixLabors.ImageSharp.Processing.Processors.Quantization;
1011
using SixLabors.ImageSharp.Tests.TestUtilities;
1112
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
1213
using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
@@ -537,7 +538,6 @@ public void Issue2209_Decode_HasTransparencyIsTrue<TPixel>(TestImageProvider<TPi
537538
where TPixel : unmanaged, IPixel<TPixel>
538539
{
539540
using Image<TPixel> image = provider.GetImage(PngDecoder.Instance);
540-
image.DebugSave(provider);
541541
PngMetadata metadata = image.Metadata.GetPngMetadata();
542542
Assert.True(metadata.HasTransparency);
543543
}

tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,20 @@ public void EncodeFixesInvalidOptions()
548548
image.Save(ms, new PngEncoder { ColorType = PngColorType.RgbWithAlpha });
549549
}
550550

551+
// https://github.com/SixLabors/ImageSharp/issues/2469
552+
[Theory]
553+
[WithFile(TestImages.Png.Issue2469, PixelTypes.Rgba32)]
554+
public void Issue2469_Quantized_Encode_Artifacts<TPixel>(TestImageProvider<TPixel> provider)
555+
where TPixel : unmanaged, IPixel<TPixel>
556+
{
557+
using Image<TPixel> image = provider.GetImage(PngDecoder.Instance);
558+
PngEncoder encoder = new() { BitDepth = PngBitDepth.Bit8, ColorType = PngColorType.Palette };
559+
560+
string actualOutputFile = provider.Utility.SaveTestOutputFile(image, "png", encoder);
561+
using Image<Rgba32> encoded = Image.Load<Rgba32>(actualOutputFile);
562+
encoded.CompareToReferenceOutput(ImageComparer.Exact, provider);
563+
}
564+
551565
private static void TestPngEncoderCore<TPixel>(
552566
TestImageProvider<TPixel> provider,
553567
PngColorType pngColorType,

tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,15 @@ static void LeakPoolInstance()
113113
public static readonly bool Is32BitProcess = !Environment.Is64BitProcess;
114114
private static readonly List<byte[]> PressureArrays = new();
115115

116-
[ConditionalFact(nameof(Is32BitProcess))]
116+
[Fact]
117117
public static void GC_Collect_OnHighLoad_TrimsEntirePool()
118118
{
119+
if (!Is32BitProcess)
120+
{
121+
// This test is only relevant for 32-bit processes.
122+
return;
123+
}
124+
119125
RemoteExecutor.Invoke(RunTest).Dispose();
120126

121127
static void RunTest()

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,12 @@ public static class Png
129129
// Issue 2209: https://github.com/SixLabors/ImageSharp/issues/2209
130130
public const string Issue2209IndexedWithTransparency = "Png/issues/Issue_2209.png";
131131

132-
// Issue 2259: https://github.com/SixLabors/ImageSharp/issues/2259
132+
// Issue 2259: https://github.com/SixLabors/ImageSharp/issues/2469
133133
public const string Issue2259 = "Png/issues/Issue_2259.png";
134134

135+
// Issue 2259: https://github.com/SixLabors/ImageSharp/issues/2469
136+
public const string Issue2469 = "Png/issues/issue_2469.png";
137+
135138
// Issue 2447: https://github.com/SixLabors/ImageSharp/issues/2447
136139
public const string Issue2447 = "Png/issues/issue_2447.png";
137140

Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)