From 4a51777ce6ccb1f77e593c0509d576d23cc3bfcf Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 16 Feb 2020 01:33:18 +1100 Subject: [PATCH] Update WuFrameQuantizer{TPixel}.cs --- .../Quantization/WuFrameQuantizer{TPixel}.cs | 89 ------------------- 1 file changed, 89 deletions(-) diff --git a/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs index 7c4d6420b..75b922e34 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs @@ -5,7 +5,6 @@ using System; using System.Buffers; using System.Numerics; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; @@ -784,94 +783,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization => new Vector4(this.R, this.G, this.B, this.A) / this.Weight / 255F; } - private struct Moment - { - /// - /// Moment of r*P(c). - /// - public long R; - - /// - /// Moment of g*P(c). - /// - public long G; - - /// - /// Moment of b*P(c). - /// - public long B; - - /// - /// Moment of a*P(c). - /// - public long A; - - /// - /// Moment of P(c). - /// - public long Weight; - - /// - /// Moment of c^2*P(c). - /// - public double Moment2; - - [MethodImpl(InliningOptions.ShortMethod)] - public static Moment operator +(Moment x, Moment y) - { - x.R += y.R; - x.G += y.G; - x.B += y.B; - x.A += y.A; - x.Weight += y.Weight; - x.Moment2 += y.Moment2; - return x; - } - - [MethodImpl(InliningOptions.ShortMethod)] - public static Moment operator -(Moment x, Moment y) - { - x.R -= y.R; - x.G -= y.G; - x.B -= y.B; - x.A -= y.A; - x.Weight -= y.Weight; - x.Moment2 -= y.Moment2; - return x; - } - - [MethodImpl(InliningOptions.ShortMethod)] - public static Moment operator -(Moment x) - { - x.R = -x.R; - x.G = -x.G; - x.B = -x.B; - x.A = -x.A; - x.Weight = -x.Weight; - x.Moment2 = -x.Moment2; - return x; - } - - [MethodImpl(InliningOptions.ShortMethod)] - public static Moment operator +(Moment x, Rgba32 y) - { - x.R += y.R; - x.G += y.G; - x.B += y.B; - x.A += y.A; - x.Weight++; - - var vector = new Vector4(y.R, y.G, y.B, y.A); - x.Moment2 += Vector4.Dot(vector, vector); - - return x; - } - - [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 Normalize() - => new Vector4(this.R, this.G, this.B, this.A) / this.Weight / 255F; - } - /// /// Represents a box color cube. ///