Well i have this function to compare Red, Blue, Green, and Alpha Pixels in an image comparison for loop comparing two images
Code:
var o = 255 - c1.A;
var t = tolerance < o ? o : tolerance;
var b = AreSimiliar(ref c1.B, ref c2.B, ref t);
var g = AreSimiliar(ref c1.G, ref c2.G, ref t);
var r = AreSimiliar(ref c1.R, ref c2.R, ref t);
if (b && g && r) continue;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool AreSimiliar(ref byte v1, ref byte v2, ref double tolerance)
{
var z = v1 - v2;
var t = z > 0 ? z : -z;
return t <= tolerance;
}
The problem is it uses so much CPU although no external code is being used, and testing narrowed it down to that code that causes the load.