private static void ProcessMiddleOddRows(RawPixel <ushort> raw, int Width, VectorPixel pix) { float maxValue = raw.MaxValue; // First left pixel pix.SetAndMoveNext( (raw.GetRel(1, 0) / maxValue), (raw.Value / maxValue), ((raw.GetRel(0, -1) + raw.GetRel(0, +1)) / maxValue / 2)); raw.MoveNext(); var lastX = Width - 1; for (var x = 1; x < lastX; x += 2) { var xy = raw.Value; var x1y = raw.GetRel(+1, 0); var x11y12 = raw.GetRel(+1, -1) + raw.GetRel(+1, +1); pix.SetAndMoveNext( (xy / maxValue), ((raw.GetRel(-1, 0) + x1y + raw.GetRel(0, -1) + raw.GetRel(0, +1)) / maxValue / 4), ((raw.GetRel(-1, -1) + x11y12 + raw.GetRel(-1, +1)) / maxValue / 4)); pix.SetAndMoveNext( ((xy + raw.GetRel(+2, 0)) / maxValue / 2), (x1y / maxValue), (x11y12) / maxValue / 2); raw.MoveNext(); raw.MoveNext(); } // First right pixel pix.SetAndMoveNext( (raw.Value / maxValue), ((raw.GetRel(0, -1) + raw.GetRel(0, +1) + (raw.GetRel(-1, 0) << 1)) / maxValue / 4), ((raw.GetRel(-1, -1) + raw.GetRel(-1, +1)) / maxValue / 2)); raw.MoveNext(); }
private static void ProcessMiddleEvenRows(RawPixel <ushort> raw, int Width, VectorPixel pix) { float maxValue = raw.MaxValue; // Second left pixel pix.SetAndMoveNext( ((raw.GetRel(1, -1) + raw.GetRel(1, +1)) / maxValue / 2.0f), ((raw.GetRel(0, -1) + raw.GetRel(0, +1) + (raw.GetRel(1, 0) << 1)) / maxValue / 4.0f), raw.Value / maxValue); raw.MoveNext(); var lastX = Width - 1; for (var x = 1; x < lastX; x += 2) { var xy = raw.Value; var x1y = raw.GetRel(+1, 0); var xy12 = raw.GetRel(0, -1) + raw.GetRel(0, +1); pix.SetAndMoveNext( (xy12) / maxValue / 2.0f, (xy) / maxValue, ((raw.GetRel(-1, 0) + x1y)) / maxValue / 2.0f); pix.SetAndMoveNext( ((xy12 + raw.GetRel(+2, -1) + raw.GetRel(+2, +1)) / maxValue / 4), ((xy + raw.GetRel(+2, 0) + raw.GetRel(+1, -1) + raw.GetRel(+1, +1)) / maxValue / 4), (x1y) / maxValue); raw.MoveNext(); raw.MoveNext(); } // Second right pixel pix.SetAndMoveNext( ((raw.GetRel(0, -1) + raw.GetRel(0, +1)) / maxValue / 2), (raw.Value) / maxValue, (raw.GetRel(-1, 0) / maxValue)); raw.MoveNext(); }
private static void ProcessMiddleEvenRows(RawPixel <ushort> raw, int Width, Color <ushort> pix) { // Second left pixel pix.SetAndMoveNext( (ushort)((raw.GetRel(1, -1) + raw.GetRel(1, +1))), (ushort)((raw.GetRel(0, -1) + raw.GetRel(0, +1) + (raw.GetRel(1, 0) << 1)) >> 1), (ushort)(raw.Value << 1)); raw.MoveNext(); var lastX = Width - 1; for (var x = 1; x < lastX; x += 2) { var xy = raw.Value; var x1y = raw.GetRel(+1, 0); var xy12 = raw.GetRel(0, -1) + raw.GetRel(0, +1); pix.SetAndMoveNext( (ushort)(xy12), (ushort)(xy << 1), (ushort)((raw.GetRel(-1, 0) + x1y))); pix.SetAndMoveNext( (ushort)((xy12 + raw.GetRel(+2, -1) + raw.GetRel(+2, +1)) >> 1), (ushort) ((xy + raw.GetRel(+2, 0) + raw.GetRel(+1, -1) + raw.GetRel(+1, +1)) >> 1), (ushort)(x1y << 1)); raw.MoveNext(); raw.MoveNext(); } // Second right pixel pix.SetAndMoveNext( (ushort)((raw.GetRel(0, -1) + raw.GetRel(0, +1))), (ushort)(raw.Value << 1), (ushort)(raw.GetRel(-1, 0) << 1)); raw.MoveNext(); }