diff --git a/src/ImageSharp/Formats/Jpg/Components/Huffman.cs b/src/ImageSharp/Formats/Jpg/Components/Huffman.cs index 7a6f031e86..30b80d4f84 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Huffman.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Huffman.cs @@ -23,9 +23,8 @@ namespace ImageSharp.Formats this.Lut = UshortBuffer.Rent(1 << lutSize); this.Values = ByteBuffer.Rent(maxNCodes); this.MinCodes = IntBuffer.Rent(maxCodeLength); - this.MaxCodes = IntBuffer.Rent(maxCodeLength); + this.MaxCodes = IntBuffer.Rent(maxCodeLength); this.Indices = IntBuffer.Rent(maxCodeLength); - } /// diff --git a/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs b/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs index 492f28f5b4..2d762fdfa8 100644 --- a/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs +++ b/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs @@ -43,6 +43,7 @@ namespace ImageSharp.Formats { return this.Data[idx + this.Offset]; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] set { diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs index 446da29dbd..be125f4b1e 100644 --- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs @@ -89,7 +89,6 @@ namespace ImageSharp.Formats /// /// The huffman trees /// - //private readonly Huffman[,] huffmanTrees; private readonly Huffman[] huffmanTrees; /// @@ -1310,7 +1309,7 @@ namespace ImageSharp.Formats struct StackallocUnzigData { - internal fixed int Data [64]; + internal fixed int Data[64]; } /// @@ -1508,7 +1507,7 @@ namespace ImageSharp.Formats fixed (Block8x8F* qtp = &this.quantizationTables[qtIndex]) { if (this.isProgressive) - // Load the previous partially decoded coefficients, if applicable. + // Load the previous partially decoded coefficients, if applicable. { this.blockIndex = ((@by * mxx) * hi) + bx; @@ -2172,6 +2171,7 @@ namespace ImageSharp.Formats { this.huffmanTrees[i].Dispose(); } + this.bytes.Dispose(); } } diff --git a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs index 66d7cdc7b6..c813c2cb77 100644 --- a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs @@ -542,10 +542,11 @@ namespace ImageSharp.Formats /// The blue chroma block. // ReSharper disable StyleCop.SA1305 private void ToYCbCr(PixelAccessor pixels, int x, int y, ref Block yBlock, ref Block cbBlock, ref Block crBlock) - // ReSharper restore StyleCop.SA1305 where TColor : struct, IPackedPixel where TPacked : struct { + + // ReSharper restore StyleCop.SA1305 int xmax = pixels.Width - 1; int ymax = pixels.Height - 1; byte[] color = new byte[3]; diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index d5cb40e3fd..b318449a8b 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -30,12 +30,12 @@ namespace ImageSharp.Formats private static readonly int[] Adam7ColumnIncrement = { 8, 8, 4, 4, 2, 2, 1 }; /// - /// The index to start at when processing each column per scanline for each interlaced pass + /// The index to start at when processing each column per scanline for each interlaced pass /// private static readonly int[] Adam7FirstColumn = { 0, 4, 0, 2, 0, 1, 0 }; /// - /// The index to start at when processing each row per scanline for each interlaced pass + /// The index to start at when processing each row per scanline for each interlaced pass /// private static readonly int[] Adam7FirstRow = { 0, 0, 4, 0, 2, 0, 1 }; diff --git a/src/ImageSharp/Profiles/Exif/ExifValue.cs b/src/ImageSharp/Profiles/Exif/ExifValue.cs index c5bc2e3924..56dc410cea 100644 --- a/src/ImageSharp/Profiles/Exif/ExifValue.cs +++ b/src/ImageSharp/Profiles/Exif/ExifValue.cs @@ -155,7 +155,7 @@ namespace ImageSharp /// /// The first ExifValue to compare. /// The second ExifValue to compare. - /// + /// The public static bool operator ==(ExifValue left, ExifValue right) { return Equals(left, right); @@ -172,10 +172,7 @@ namespace ImageSharp return !Equals(left, right); } - /// - /// Determines whether the specified object is equal to the current exif value. - /// - /// The object to compare this exif value with. + /// public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) @@ -186,10 +183,7 @@ namespace ImageSharp return this.Equals(obj as ExifValue); } - /// - /// Determines whether the specified exif value is equal to the current exif value. - /// - /// The exif value to compare this exif value with. + /// public bool Equals(ExifValue other) { if (ReferenceEquals(other, null)) @@ -205,7 +199,7 @@ namespace ImageSharp return this.Tag == other.Tag && this.DataType == other.DataType && - Equals(this.exifValue, other.exifValue); + object.Equals(this.exifValue, other.exifValue); } /// @@ -549,6 +543,16 @@ namespace ImageSharp return exifValue; } + /// + /// Gets the size in bytes of the given data type. + /// + /// The data type. + /// + /// The . + /// + /// + /// Thrown if the type is unsupported. + /// internal static uint GetSize(ExifDataType dataType) { switch (dataType) diff --git a/src/ImageSharp/Profiles/Exif/ExifWriter.cs b/src/ImageSharp/Profiles/Exif/ExifWriter.cs index e75f3f23ec..daf0d9f2f7 100644 --- a/src/ImageSharp/Profiles/Exif/ExifWriter.cs +++ b/src/ImageSharp/Profiles/Exif/ExifWriter.cs @@ -283,6 +283,11 @@ namespace ImageSharp private Collection exifIndexes; private Collection gpsIndexes; + /// + /// Initializes a new instance of the class. + /// + /// The values. + /// The allowed parts. public ExifWriter(Collection values, ExifParts allowedParts) { this.values = values; @@ -292,9 +297,15 @@ namespace ImageSharp this.gpsIndexes = this.GetIndexes(ExifParts.GPSTags, GPSTags); } + /// + /// Returns the EXIF data. + /// + /// + /// The . + /// public byte[] GetData() { - uint length = 0; + uint length; int exifIndex = -1; int gpsIndex = -1;