// B G B G // G R G R // B G B G // G R G R private static void ProcessBottomLine(RawBGGRMap <ushort> map, VectorMap res) { var pix = res.GetPixel(); var raw = map.GetRow(res.Height - 1); // Bottom Left pixel var lastY = res.Height - 1; pix.SetAndMoveNext( raw.GetRel(1, 0) << 1, raw.Value << 1, raw.GetRel(0, -1) << 1); raw.MoveNext(); // Bottom row for (var x = 1; x < res.Width - 1; x += 2) { pix.SetAndMoveNext( raw.Value << 1, (raw.GetRel(-1, 0) + raw.GetRel(+1, 0) + raw.GetRel(0, -1) << 1) >> 1, (raw.GetRel(-1, 0) + raw.GetRel(+1, 0))); pix.SetAndMoveNext( (raw.Value + raw.GetRel(+2, 0)), raw.GetRel(+1, 0) << 1, raw.GetRel(+1, 0 - 1) << 1); raw.MoveNext(); raw.MoveNext(); } // Bottom right pixel pix.SetAndMoveNext( raw.GetRel(-1, 0) << 1, (raw.GetRel(-1, -1) + raw.GetRel(-2, 0)), raw.GetRel(-2, -1) << 1); raw.MoveNext(); }
private static void ProcessTopLine(RawBGGRMap <ushort> map, VectorMap res) { float maxValue = map.MaxValue; var pix = res.GetPixel(); var raw = map.GetRow(0); // Top Left pixel pix.SetAndMoveNext( (raw.GetRel(1, 1) / maxValue), (raw.GetRel(1, 0) + raw.GetRel(0, 1)), raw.Value << 1); raw.MoveNext(); // Top row for (var x = 1; x < res.Width - 1; x += 2) { pix.SetAndMoveNext( raw.GetRel(0, 1) << 1, raw.Value << 1, (raw.GetRel(-1, 0) + raw.GetRel(+1, 0))); pix.SetAndMoveNext( (raw.GetRel(0, 1) + raw.GetRel(+2, 1)), (raw.Value + raw.GetRel(+2, 0) + (raw.GetRel(+1, 1) << 1)) >> 1, raw.GetRel(+1, 0) << 1); raw.MoveNext(); raw.MoveNext(); } // Top right pixel pix.SetAndMoveNext( (ushort)(raw.GetRel(res.Width - 1, 1) << 1), (ushort)(raw.GetRel(res.Width - 1, 0) << 1), (ushort)(raw.GetRel(res.Width - 2, 0) << 1)); raw.MoveNext(); }