internal static void BulkConvertNormalizedFloatToByteClampOverflowsReduce( ref ReadOnlySpan <float> source, ref Span <byte> dest) { DebugGuard.IsTrue(source.Length == dest.Length, nameof(source), "Input spans must be of same length!"); int remainder = ImageMaths.Modulo4(source.Length); int adjustedCount = source.Length - remainder; if (adjustedCount > 0) { BulkConvertNormalizedFloatToByteClampOverflows( source.Slice(0, adjustedCount), dest.Slice(0, adjustedCount)); source = source.Slice(adjustedCount); dest = dest.Slice(adjustedCount); } }
internal static void NormalizedFloatToByteSaturateReduce( ref ReadOnlySpan <float> source, ref Span <byte> dest) { DebugGuard.IsTrue(source.Length == dest.Length, nameof(source), "Input spans must be of same length!"); if (!IsAvailable) { return; } int remainder = ImageMaths.Modulo8(source.Length); int adjustedCount = source.Length - remainder; if (adjustedCount > 0) { NormalizedFloatToByteSaturate(source.Slice(0, adjustedCount), dest.Slice(0, adjustedCount)); source = source.Slice(adjustedCount); dest = dest.Slice(adjustedCount); } }
internal static void BulkConvertByteToNormalizedFloatReduce( ref ReadOnlySpan <byte> source, ref Span <float> dest) { DebugGuard.IsTrue(source.Length == dest.Length, nameof(source), "Input spans must be of same length!"); if (!IsAvailable) { return; } int remainder = ImageMaths.ModuloP2(source.Length, Vector <byte> .Count); int adjustedCount = source.Length - remainder; if (adjustedCount > 0) { BulkConvertByteToNormalizedFloat(source.Slice(0, adjustedCount), dest.Slice(0, adjustedCount)); source = source.Slice(adjustedCount); dest = dest.Slice(adjustedCount); } }