From 55c6452be7e5cf79d0eed8461e9268570fa021e2 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 26 Dec 2016 02:44:10 +0100 Subject: [PATCH] type names instead of var with primitive types, removed ImageSharp.Formats.Jpg subnamespaces, Block8x8F cleanup --- .../Jpg/Components/Block8x8F.Generated.cs | 11 +- .../Jpg/Components/Block8x8F.Generated.tt | 11 +- .../Formats/Jpg/Components/Block8x8F.cs | 179 +++++++++--------- src/ImageSharp/Formats/Jpg/Components/DCT.cs | 2 +- .../Formats/Jpg/Components/Decoder/Bits.cs | 2 +- .../Formats/Jpg/Components/Decoder/Bytes.cs | 2 +- .../Jpg/Components/Decoder/Component.cs | 2 +- .../Jpg/Components/Decoder/GrayImage.cs | 2 +- .../Jpg/Components/Decoder/HuffmanTree.cs | 2 +- .../Jpg/Components/Decoder/YCbCrImage.cs | 2 +- .../Jpg/Components/Encoder/HuffIndex.cs | 2 +- .../Jpg/Components/Encoder/HuffmanLut.cs | 2 +- .../Jpg/Components/Encoder/HuffmanSpec.cs | 2 +- .../Jpg/Components/Encoder/QuantIndex.cs | 2 +- src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs | 23 +-- src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs | 3 +- src/ImageSharp/Formats/Jpg/Utils/JpegUtils.cs | 4 +- .../Formats/Jpg/Utils/MutableSpan.cs | 2 +- .../Jpg/Utils/MutableSpanExtensions.cs | 2 +- src/ImageSharp/Image/PixelArea{TColor}.cs | 2 +- src/ImageSharp/ImageSharp.xproj | 3 + src/ImageSharp/Numerics/RectangleF.cs | 2 +- .../Formats/Jpg/Block8x8FTests.cs | 2 +- .../ImageSharp.Tests/Formats/Jpg/JpegTests.cs | 2 +- .../Formats/Jpg/ReferenceImplementations.cs | 2 +- .../Jpg/ReferenceImplementationsTests.cs | 2 +- .../Formats/Jpg/UtilityTestClassBase.cs | 2 +- 27 files changed, 139 insertions(+), 135 deletions(-) diff --git a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.Generated.cs b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.Generated.cs index 3b48dc572..211b66dac 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.Generated.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.Generated.cs @@ -1,11 +1,16 @@ -// - +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// +// ReSharper disable InconsistentNaming +// +#pragma warning disable using System; using System.Numerics; using System.Runtime.CompilerServices; -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg { internal partial struct Block8x8F { diff --git a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.Generated.tt b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.Generated.tt index 951d62d91..be198a6fa 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.Generated.tt +++ b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.Generated.tt @@ -1,11 +1,16 @@ -<#@ template debug="false" hostspecific="false" language="C#" #> +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// +// ReSharper disable InconsistentNaming +<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".cs" #> // - +#pragma warning disable using System; using System.Numerics; using System.Runtime.CompilerServices; @@ -14,7 +19,7 @@ using System.Runtime.CompilerServices; char[] coordz = {'X', 'Y', 'Z', 'W'}; #> -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg { internal partial struct Block8x8F { diff --git a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs index 4cd852f10..723ccd6b8 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs @@ -3,21 +3,22 @@ // Licensed under the Apache License, Version 2.0. // // ReSharper disable InconsistentNaming -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg { using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - using ImageSharp.Formats.Jpg.Utils; - /// /// DCT code Ported from https://github.com/norishigefukushima/dct_simd /// internal partial struct Block8x8F { -#pragma warning disable SA1204 // Static members must appear before non-static members + // Most of the static methods of this struct are instance methods by actual semantics: they use Block8x8F* as their first parameter. + // Example: GetScalarAt() and SetScalarAt() are really just other (optimized) versions of the indexer. + // It's much cleaner, easier and safer to work with the code, if the methods with same semantics are next to each other. +#pragma warning disable SA1204 // StaticElementsMustAppearBeforeInstanceElements /// /// Vector count @@ -56,7 +57,7 @@ namespace ImageSharp.Formats #pragma warning restore SA1600 // ElementsMustBeDocumented /// - /// Index into the block + /// Get/Set scalar elements at a given index /// /// The index /// The float value at the specified index @@ -83,6 +84,55 @@ namespace ImageSharp.Formats } } + /// + /// Pointer-based "Indexer" (getter part) + /// + /// Block pointer + /// Index + /// The scaleVec value at the specified index + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe float GetScalarAt(Block8x8F* blockPtr, int idx) + { + float* fp = (float*)blockPtr; + return fp[idx]; + } + + /// + /// Pointer-based "Indexer" (setter part) + /// + /// Block pointer + /// Index + /// Value + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void SetScalarAt(Block8x8F* blockPtr, int idx, float value) + { + float* fp = (float*)blockPtr; + fp[idx] = value; + } + + /// + /// Fill the block with defaults (zeroes) + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Clear() + { + // The cheapest way to do this in C#: + this = default(Block8x8F); + } + + /// + /// Load raw 32bit floating point data from source + /// + /// Source + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public unsafe void LoadFrom(MutableSpan source) + { + fixed (void* ptr = &this.V0L) + { + Marshal.Copy(source.Data, source.Offset, (IntPtr)ptr, ScalarCount); + } + } + /// /// Load raw 32bit floating point data from source /// @@ -94,15 +144,33 @@ namespace ImageSharp.Formats Marshal.Copy(source.Data, source.Offset, (IntPtr)blockPtr, ScalarCount); } + /// + /// Load raw 32bit floating point data from source + /// + /// Source + public unsafe void LoadFrom(MutableSpan source) + { + fixed (Vector4* ptr = &this.V0L) + { + float* fp = (float*)ptr; + for (int i = 0; i < ScalarCount; i++) + { + fp[i] = source[i]; + } + } + } + /// /// Copy raw 32bit floating point data to dest /// - /// Block pointer /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void CopyTo(Block8x8F* blockPtr, MutableSpan dest) + public unsafe void CopyTo(MutableSpan dest) { - Marshal.Copy((IntPtr)blockPtr, dest.Data, dest.Offset, ScalarCount); + fixed (void* ptr = &this.V0L) + { + Marshal.Copy((IntPtr)ptr, dest.Data, dest.Offset, ScalarCount); + } } /// @@ -122,16 +190,14 @@ namespace ImageSharp.Formats } /// - /// Load raw 32bit floating point data from source + /// Copy raw 32bit floating point data to dest /// - /// Source + /// Block pointer + /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe void LoadFrom(MutableSpan source) + public static unsafe void CopyTo(Block8x8F* blockPtr, MutableSpan dest) { - fixed (void* ptr = &this.V0L) - { - Marshal.Copy(source.Data, source.Offset, (IntPtr)ptr, ScalarCount); - } + Marshal.Copy((IntPtr)blockPtr, dest.Data, dest.Offset, ScalarCount); } /// @@ -139,11 +205,11 @@ namespace ImageSharp.Formats /// /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe void CopyTo(MutableSpan dest) + public unsafe void CopyTo(float[] dest) { fixed (void* ptr = &this.V0L) { - Marshal.Copy((IntPtr)ptr, dest.Data, dest.Offset, ScalarCount); + Marshal.Copy((IntPtr)ptr, dest, 0, ScalarCount); } } @@ -151,12 +217,15 @@ namespace ImageSharp.Formats /// Copy raw 32bit floating point data to dest /// /// Destination - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe void CopyTo(float[] dest) + public unsafe void CopyTo(MutableSpan dest) { - fixed (void* ptr = &this.V0L) + fixed (Vector4* ptr = &this.V0L) { - Marshal.Copy((IntPtr)ptr, dest, 0, ScalarCount); + float* fp = (float*)ptr; + for (int i = 0; i < ScalarCount; i++) + { + dest[i] = (int)fp[i]; + } } } @@ -210,32 +279,6 @@ namespace ImageSharp.Formats this.V7R += diff; } - /// - /// Pointer-based "Indexer" (getter part) - /// - /// Block pointer - /// Index - /// The scaleVec value at the specified index - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe float GetScalarAt(Block8x8F* blockPtr, int idx) - { - float* fp = (float*)blockPtr; - return fp[idx]; - } - - /// - /// Pointer-based "Indexer" (setter part) - /// - /// Block pointer - /// Index - /// Value - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void SetScalarAt(Block8x8F* blockPtr, int idx, float value) - { - float* fp = (float*)blockPtr; - fp[idx] = value; - } - /// /// Un-zig /// @@ -256,48 +299,6 @@ namespace ImageSharp.Formats } } - /// - /// Copy raw 32bit floating point data to dest - /// - /// Destination - public unsafe void CopyTo(MutableSpan dest) - { - fixed (Vector4* ptr = &this.V0L) - { - float* fp = (float*)ptr; - for (int i = 0; i < ScalarCount; i++) - { - dest[i] = (int)fp[i]; - } - } - } - - /// - /// Load raw 32bit floating point data from source - /// - /// Source - public unsafe void LoadFrom(MutableSpan source) - { - fixed (Vector4* ptr = &this.V0L) - { - float* fp = (float*)ptr; - for (int i = 0; i < ScalarCount; i++) - { - fp[i] = source[i]; - } - } - } - - /// - /// Fill the block with defaults (zeroes) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Clear() - { - // The cheapest way to do this in C#: - this = default(Block8x8F); - } - /// /// Level shift by +128, clip to [0, 255], and write to buffer. /// diff --git a/src/ImageSharp/Formats/Jpg/Components/DCT.cs b/src/ImageSharp/Formats/Jpg/Components/DCT.cs index a207df670..186a23862 100644 --- a/src/ImageSharp/Formats/Jpg/Components/DCT.cs +++ b/src/ImageSharp/Formats/Jpg/Components/DCT.cs @@ -4,7 +4,7 @@ // // ReSharper disable InconsistentNaming -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg { using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/Bits.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/Bits.cs index c9624c444..dbe9035af 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/Bits.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/Bits.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Decoder +namespace ImageSharp.Formats.Jpg { using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/Bytes.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/Bytes.cs index 55326a37c..b91420b42 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/Bytes.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/Bytes.cs @@ -2,7 +2,7 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Decoder +namespace ImageSharp.Formats.Jpg { using System; using System.Buffers; diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/Component.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/Component.cs index 29117e492..5b53db190 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/Component.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/Component.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Decoder +namespace ImageSharp.Formats.Jpg { /// /// Represents a single color component diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/GrayImage.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/GrayImage.cs index ccb42a1a6..caa30e62d 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/GrayImage.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/GrayImage.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Decoder +namespace ImageSharp.Formats.Jpg { /// /// Represents a grayscale image diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs index 744ed363b..a148cc558 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs @@ -2,7 +2,7 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Decoder +namespace ImageSharp.Formats.Jpg { using System; using System.Buffers; diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/YCbCrImage.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/YCbCrImage.cs index 018150aeb..cba9c4461 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/YCbCrImage.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/YCbCrImage.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Decoder +namespace ImageSharp.Formats.Jpg { /// /// Represents an image made up of three color components (luminance, blue chroma, red chroma) diff --git a/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffIndex.cs b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffIndex.cs index d53ac90a8..3875cc12f 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffIndex.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffIndex.cs @@ -2,7 +2,7 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Encoder +namespace ImageSharp.Formats.Jpg { /// /// Enumerates the Huffman tables diff --git a/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanLut.cs b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanLut.cs index ec6c86041..d0003b919 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanLut.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanLut.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Encoder +namespace ImageSharp.Formats.Jpg { /// /// A compiled look-up table representation of a huffmanSpec. diff --git a/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanSpec.cs b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanSpec.cs index 25d0fcfb1..a0eea6e71 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanSpec.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanSpec.cs @@ -2,7 +2,7 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Encoder +namespace ImageSharp.Formats.Jpg { /// /// The Huffman encoding specifications. diff --git a/src/ImageSharp/Formats/Jpg/Components/Encoder/QuantIndex.cs b/src/ImageSharp/Formats/Jpg/Components/Encoder/QuantIndex.cs index 5efd1a321..5a469e0e9 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Encoder/QuantIndex.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Encoder/QuantIndex.cs @@ -2,7 +2,7 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Components.Encoder +namespace ImageSharp.Formats.Jpg { /// /// Enumerates the quantization tables diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs index 9e1ab8d00..761ad891e 100644 --- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs @@ -10,9 +10,7 @@ namespace ImageSharp.Formats using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading.Tasks; - - using ImageSharp.Formats.Jpg.Components.Decoder; - using ImageSharp.Formats.Jpg.Utils; + using ImageSharp.Formats.Jpg; /// /// Performs the jpeg decoding operation. @@ -652,7 +650,7 @@ namespace ImageSharp.Formats if (this.bits.UnreadBits < 8) { - var errorCode = this.bits.EnsureNBits(8, this); + ErrorCodes errorCode = this.bits.EnsureNBits(8, this); if (errorCode == ErrorCodes.NoError) { @@ -677,7 +675,7 @@ namespace ImageSharp.Formats { if (this.bits.UnreadBits == 0) { - var errorCode = this.bits.EnsureNBits(1, this); + ErrorCodes errorCode = this.bits.EnsureNBits(1, this); if (errorCode != ErrorCodes.NoError) { throw new MissingFF00Exception(); @@ -711,7 +709,7 @@ namespace ImageSharp.Formats { if (this.bits.UnreadBits == 0) { - var errorCode = this.bits.EnsureNBits(1, this); + ErrorCodes errorCode = this.bits.EnsureNBits(1, this); if (errorCode != ErrorCodes.NoError) { throw new MissingFF00Exception(); @@ -733,7 +731,7 @@ namespace ImageSharp.Formats { if (this.bits.UnreadBits < count) { - var errorCode = this.bits.EnsureNBits(count, this); + ErrorCodes errorCode = this.bits.EnsureNBits(count, this); if (errorCode != ErrorCodes.NoError) { throw new MissingFF00Exception(); @@ -1521,7 +1519,7 @@ namespace ImageSharp.Formats int compIndex = scan[i].Index; if (this.progCoeffs[compIndex] == null) { - var size = mxx * myy * this.componentArray[compIndex].HorizontalFactor + int size = mxx * myy * this.componentArray[compIndex].HorizontalFactor * this.componentArray[compIndex].VerticalFactor; this.progCoeffs[compIndex] = new Block8x8F[size]; @@ -1601,7 +1599,7 @@ namespace ImageSharp.Formats } } - var qtIndex = this.componentArray[compIndex].Selector; + int qtIndex = this.componentArray[compIndex].Selector; // TODO: Find a way to clean up this mess fixed (Block8x8F* qtp = &this.quantizationTables[qtIndex]) @@ -1716,7 +1714,7 @@ namespace ImageSharp.Formats int bx, Block8x8F* qt) { - var huffmannIdx = (AcTable * ThRowSize) + scan[i].AcTableSelector; + int huffmannIdx = (AcTable * ThRowSize) + scan[i].AcTableSelector; if (ah != 0) { this.Refine(b, ref this.huffmanTrees[huffmannIdx], unzigPtr, zigStart, zigEnd, 1 << al); @@ -2237,11 +2235,6 @@ namespace ImageSharp.Formats public byte AcTableSelector { get; set; } } - private struct StackallocUnzigData - { - internal fixed int Data[64]; - } - /// /// The missing ff00 exception. /// diff --git a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs index 42b9d7814..4413163d3 100644 --- a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs @@ -10,8 +10,7 @@ namespace ImageSharp.Formats using System.Numerics; using System.Runtime.CompilerServices; - using ImageSharp.Formats.Jpg.Components.Encoder; - using ImageSharp.Formats.Jpg.Utils; + using ImageSharp.Formats.Jpg; /// /// Image encoder for writing an image to a stream as a jpeg. diff --git a/src/ImageSharp/Formats/Jpg/Utils/JpegUtils.cs b/src/ImageSharp/Formats/Jpg/Utils/JpegUtils.cs index 3a87723bc..fa2647751 100644 --- a/src/ImageSharp/Formats/Jpg/Utils/JpegUtils.cs +++ b/src/ImageSharp/Formats/Jpg/Utils/JpegUtils.cs @@ -2,13 +2,11 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Utils +namespace ImageSharp.Formats.Jpg { using System; using System.Runtime.CompilerServices; - using ImageSharp.Formats.Jpg.Components.Encoder; - /// /// Jpeg specific utilities and extension methods /// diff --git a/src/ImageSharp/Formats/Jpg/Utils/MutableSpan.cs b/src/ImageSharp/Formats/Jpg/Utils/MutableSpan.cs index f4c1468d6..99d1c3e04 100644 --- a/src/ImageSharp/Formats/Jpg/Utils/MutableSpan.cs +++ b/src/ImageSharp/Formats/Jpg/Utils/MutableSpan.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Utils +namespace ImageSharp.Formats.Jpg { using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Formats/Jpg/Utils/MutableSpanExtensions.cs b/src/ImageSharp/Formats/Jpg/Utils/MutableSpanExtensions.cs index a725c3e93..45ecfc092 100644 --- a/src/ImageSharp/Formats/Jpg/Utils/MutableSpanExtensions.cs +++ b/src/ImageSharp/Formats/Jpg/Utils/MutableSpanExtensions.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats.Jpg.Utils +namespace ImageSharp.Formats.Jpg { using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Image/PixelArea{TColor}.cs b/src/ImageSharp/Image/PixelArea{TColor}.cs index 40e9e4e88..12ccdd5ba 100644 --- a/src/ImageSharp/Image/PixelArea{TColor}.cs +++ b/src/ImageSharp/Image/PixelArea{TColor}.cs @@ -134,7 +134,7 @@ namespace ImageSharp this.ComponentOrder = componentOrder; this.RowByteCount = (width * GetComponentCount(componentOrder)) + padding; - var bufferSize = this.RowByteCount * height; + int bufferSize = this.RowByteCount * height; if (usePool) { diff --git a/src/ImageSharp/ImageSharp.xproj b/src/ImageSharp/ImageSharp.xproj index dcd5b9ed1..bf2f6a67b 100644 --- a/src/ImageSharp/ImageSharp.xproj +++ b/src/ImageSharp/ImageSharp.xproj @@ -18,5 +18,8 @@ True + + + \ No newline at end of file diff --git a/src/ImageSharp/Numerics/RectangleF.cs b/src/ImageSharp/Numerics/RectangleF.cs index c55608f4b..2ed57c841 100644 --- a/src/ImageSharp/Numerics/RectangleF.cs +++ b/src/ImageSharp/Numerics/RectangleF.cs @@ -249,7 +249,7 @@ namespace ImageSharp /// public static RectangleF Outset(RectangleF region, float width) { - var dblWidth = width * 2; + float dblWidth = width * 2; return new RectangleF(region.X - width, region.Y - width, region.Width + dblWidth, region.Height + dblWidth); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs index ea198350b..57b3c56f8 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Tests using System.Numerics; using ImageSharp.Formats; - using ImageSharp.Formats.Jpg.Utils; + using ImageSharp.Formats.Jpg; using Xunit; using Xunit.Abstractions; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs index 13cf515bb..70ddb3000 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs @@ -11,7 +11,7 @@ namespace ImageSharp.Tests { using System.Numerics; - using ImageSharp.Formats.Jpg.Utils; + using ImageSharp.Formats.Jpg; public class JpegTests { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementations.cs b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementations.cs index bdd66d1d1..c045d8937 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementations.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementations.cs @@ -7,7 +7,7 @@ namespace ImageSharp.Tests using System.Runtime.CompilerServices; using ImageSharp.Formats; - using ImageSharp.Formats.Jpg.Utils; + using ImageSharp.Formats.Jpg; /// /// This class contains simplified (unefficient) reference implementations to produce verification data for unit tests diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.cs index aadbf2c62..dcccc58be 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.cs @@ -3,7 +3,7 @@ namespace ImageSharp.Tests.Formats.Jpg { using System.Numerics; using ImageSharp.Formats; - using ImageSharp.Formats.Jpg.Utils; + using ImageSharp.Formats.Jpg; using Xunit; using Xunit.Abstractions; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/UtilityTestClassBase.cs b/tests/ImageSharp.Tests/Formats/Jpg/UtilityTestClassBase.cs index a52395f17..74c6772b7 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/UtilityTestClassBase.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/UtilityTestClassBase.cs @@ -10,7 +10,7 @@ namespace ImageSharp.Tests using System.Diagnostics; using System.Runtime.CompilerServices; - using ImageSharp.Formats.Jpg.Utils; + using ImageSharp.Formats.Jpg; /// /// Utility class to measure the execution of an operation.