|
|
|
@ -5,7 +5,6 @@ using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
using System.Runtime.Intrinsics; |
|
|
|
|
|
|
|
// <auto-generated />
|
|
|
|
namespace SixLabors.ImageSharp.Formats.Jpeg.Components; |
|
|
|
|
|
|
|
internal partial struct Block8x8F |
|
|
|
@ -13,28 +12,29 @@ internal partial struct Block8x8F |
|
|
|
/// <summary>
|
|
|
|
/// Level shift by +maximum/2, clip to [0, maximum]
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="maximum">The maximum value to normalize to.</param>
|
|
|
|
public void NormalizeColorsInPlace(float maximum) |
|
|
|
{ |
|
|
|
var CMin4 = new Vector4(0F); |
|
|
|
var CMax4 = new Vector4(maximum); |
|
|
|
var COff4 = new Vector4(MathF.Ceiling(maximum * 0.5F)); |
|
|
|
|
|
|
|
this.V0L = Numerics.Clamp(this.V0L + COff4, CMin4, CMax4); |
|
|
|
this.V0R = Numerics.Clamp(this.V0R + COff4, CMin4, CMax4); |
|
|
|
this.V1L = Numerics.Clamp(this.V1L + COff4, CMin4, CMax4); |
|
|
|
this.V1R = Numerics.Clamp(this.V1R + COff4, CMin4, CMax4); |
|
|
|
this.V2L = Numerics.Clamp(this.V2L + COff4, CMin4, CMax4); |
|
|
|
this.V2R = Numerics.Clamp(this.V2R + COff4, CMin4, CMax4); |
|
|
|
this.V3L = Numerics.Clamp(this.V3L + COff4, CMin4, CMax4); |
|
|
|
this.V3R = Numerics.Clamp(this.V3R + COff4, CMin4, CMax4); |
|
|
|
this.V4L = Numerics.Clamp(this.V4L + COff4, CMin4, CMax4); |
|
|
|
this.V4R = Numerics.Clamp(this.V4R + COff4, CMin4, CMax4); |
|
|
|
this.V5L = Numerics.Clamp(this.V5L + COff4, CMin4, CMax4); |
|
|
|
this.V5R = Numerics.Clamp(this.V5R + COff4, CMin4, CMax4); |
|
|
|
this.V6L = Numerics.Clamp(this.V6L + COff4, CMin4, CMax4); |
|
|
|
this.V6R = Numerics.Clamp(this.V6R + COff4, CMin4, CMax4); |
|
|
|
this.V7L = Numerics.Clamp(this.V7L + COff4, CMin4, CMax4); |
|
|
|
this.V7R = Numerics.Clamp(this.V7R + COff4, CMin4, CMax4); |
|
|
|
Vector4 min = Vector4.Zero; |
|
|
|
Vector4 max = new(maximum); |
|
|
|
Vector4 off = new(MathF.Ceiling(maximum * 0.5F)); |
|
|
|
|
|
|
|
this.V0L = Vector4.Clamp(this.V0L + off, min, max); |
|
|
|
this.V0R = Vector4.Clamp(this.V0R + off, min, max); |
|
|
|
this.V1L = Vector4.Clamp(this.V1L + off, min, max); |
|
|
|
this.V1R = Vector4.Clamp(this.V1R + off, min, max); |
|
|
|
this.V2L = Vector4.Clamp(this.V2L + off, min, max); |
|
|
|
this.V2R = Vector4.Clamp(this.V2R + off, min, max); |
|
|
|
this.V3L = Vector4.Clamp(this.V3L + off, min, max); |
|
|
|
this.V3R = Vector4.Clamp(this.V3R + off, min, max); |
|
|
|
this.V4L = Vector4.Clamp(this.V4L + off, min, max); |
|
|
|
this.V4R = Vector4.Clamp(this.V4R + off, min, max); |
|
|
|
this.V5L = Vector4.Clamp(this.V5L + off, min, max); |
|
|
|
this.V5R = Vector4.Clamp(this.V5R + off, min, max); |
|
|
|
this.V6L = Vector4.Clamp(this.V6L + off, min, max); |
|
|
|
this.V6R = Vector4.Clamp(this.V6R + off, min, max); |
|
|
|
this.V7L = Vector4.Clamp(this.V7L + off, min, max); |
|
|
|
this.V7R = Vector4.Clamp(this.V7R + off, min, max); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -44,7 +44,7 @@ internal partial struct Block8x8F |
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
public void NormalizeColorsAndRoundInPlaceVector256(float maximum) |
|
|
|
{ |
|
|
|
Vector256<float> off = Vector256.Create(MathF.Ceiling(maximum * 0.5F)); |
|
|
|
Vector256<float> off = Vector256.Create(MathF.Ceiling(maximum * 0.5F)); |
|
|
|
Vector256<float> max = Vector256.Create(maximum); |
|
|
|
|
|
|
|
ref Vector256<float> row0 = ref Unsafe.As<Vector4, Vector256<float>>(ref this.V0L); |
|
|
|
@ -103,6 +103,7 @@ internal partial struct Block8x8F |
|
|
|
/// <summary>
|
|
|
|
/// Fill the block from 'source' doing short -> float conversion.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="source">The source block</param>
|
|
|
|
public void LoadFromInt16Scalar(ref Block8x8 source) |
|
|
|
{ |
|
|
|
ref short selfRef = ref Unsafe.As<Block8x8, short>(ref source); |