From fc66a446c3fb4722dac5eb2abcd18c30c7fbd376 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 14 May 2018 11:58:32 +1000 Subject: [PATCH] Remove prefix in Block8x8F and cleanup --- .../Formats/Jpeg/Components/Block8x8F.cs | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs index 7d42010cb..f0a1632a2 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs @@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components get { GuardBlockIndex(idx); - ref float selfRef = ref Unsafe.As(ref this); + ref float selfRef = ref Unsafe.As(ref this); return Unsafe.Add(ref selfRef, idx); } @@ -69,7 +69,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components set { GuardBlockIndex(idx); - ref float selfRef = ref Unsafe.As(ref this); + ref float selfRef = ref Unsafe.As(ref this); Unsafe.Add(ref selfRef, idx) = value; } } @@ -80,9 +80,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components set => this[(y * 8) + x] = value; } - public static Components.Block8x8F operator *(Components.Block8x8F block, float value) + public static Block8x8F operator *(Block8x8F block, float value) { - Components.Block8x8F result = block; + Block8x8F result = block; for (int i = 0; i < Size; i++) { float val = result[i]; @@ -93,55 +93,55 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components return result; } - public static Components.Block8x8F operator /(Components.Block8x8F block, float value) + public static Block8x8F operator /(Block8x8F block, float value) { - Components.Block8x8F result = block; + Block8x8F result = block; for (int i = 0; i < Size; i++) { float val = result[i]; val /= value; - result[i] = (float)val; + result[i] = val; } return result; } - public static Components.Block8x8F operator +(Components.Block8x8F block, float value) + public static Block8x8F operator +(Block8x8F block, float value) { - Components.Block8x8F result = block; + Block8x8F result = block; for (int i = 0; i < Size; i++) { float val = result[i]; val += value; - result[i] = (float)val; + result[i] = val; } return result; } - public static Components.Block8x8F operator -(Components.Block8x8F block, float value) + public static Block8x8F operator -(Block8x8F block, float value) { - Components.Block8x8F result = block; + Block8x8F result = block; for (int i = 0; i < Size; i++) { float val = result[i]; val -= value; - result[i] = (float)val; + result[i] = val; } return result; } - public static Components.Block8x8F Load(Span data) + public static Block8x8F Load(Span data) { - var result = default(Components.Block8x8F); + var result = default(Block8x8F); result.LoadFrom(data); return result; } - public static Components.Block8x8F Load(Span data) + public static Block8x8F Load(Span data) { - var result = default(Components.Block8x8F); + var result = default(Block8x8F); result.LoadFrom(data); return result; } @@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components public void Clear() { // The cheapest way to do this in C#: - this = default(Components.Block8x8F); + this = default; } /// @@ -164,7 +164,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components public void LoadFrom(Span source) { ref byte s = ref Unsafe.As(ref MemoryMarshal.GetReference(source)); - ref byte d = ref Unsafe.As(ref this); + ref byte d = ref Unsafe.As(ref this); Unsafe.CopyBlock(ref d, ref s, Size * sizeof(float)); } @@ -175,7 +175,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components /// Block pointer /// Source [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void LoadFrom(Components.Block8x8F* blockPtr, Span source) + public static unsafe void LoadFrom(Block8x8F* blockPtr, Span source) { blockPtr->LoadFrom(source); } @@ -204,7 +204,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components public void CopyTo(Span dest) { ref byte d = ref Unsafe.As(ref MemoryMarshal.GetReference(dest)); - ref byte s = ref Unsafe.As(ref this); + ref byte s = ref Unsafe.As(ref this); Unsafe.CopyBlock(ref d, ref s, Size * sizeof(float)); } @@ -215,7 +215,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components /// Pointer to block /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void CopyTo(Components.Block8x8F* blockPtr, Span dest) + public static unsafe void CopyTo(Block8x8F* blockPtr, Span dest) { float* fPtr = (float*)blockPtr; for (int i = 0; i < Size; i++) @@ -231,7 +231,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components /// Block pointer /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void CopyTo(Components.Block8x8F* blockPtr, Span dest) + public static unsafe void CopyTo(Block8x8F* blockPtr, Span dest) { blockPtr->CopyTo(dest); } @@ -301,7 +301,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components /// Multiply all elements of the block by the corresponding elements of 'other' /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MultiplyInplace(ref Components.Block8x8F other) + public void MultiplyInplace(ref Block8x8F other) { this.V0L *= other.V0L; this.V0R *= other.V0R; @@ -353,7 +353,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components /// Qt pointer /// Unzig pointer // [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void DequantizeBlock(Components.Block8x8F* blockPtr, Components.Block8x8F* qtPtr, byte* unzigPtr) + public static unsafe void DequantizeBlock(Block8x8F* blockPtr, Block8x8F* qtPtr, byte* unzigPtr) { float* b = (float*)blockPtr; float* qtp = (float*)qtPtr; @@ -378,9 +378,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components /// The quantization table /// Pointer to elements of public static unsafe void Quantize( - Components.Block8x8F* block, - Components.Block8x8F* dest, - Components.Block8x8F* qt, + Block8x8F* block, + Block8x8F* dest, + Block8x8F* qt, byte* unzigPtr) { float* s = (float*)block; @@ -399,7 +399,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components /// /// The destination block. /// The source block. - public static unsafe void Scale16X16To8X8(Components.Block8x8F* destination, Components.Block8x8F* source) + public static unsafe void Scale16X16To8X8(Block8x8F* destination, Block8x8F* source) { float* d = (float*)destination; for (int i = 0; i < 4; i++) @@ -421,7 +421,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void DivideRoundAll(ref Components.Block8x8F a, ref Components.Block8x8F b) + private static void DivideRoundAll(ref Block8x8F a, ref Block8x8F b) { a.V0L = DivideRound(a.V0L, b.V0L); a.V0R = DivideRound(a.V0R, b.V0R);