Skip to content

Commit 71ca954

Browse files
Revert naming
1 parent 57614df commit 71ca954

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

src/ImageSharp/Common/Helpers/SimdUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal static Vector4 PseudoRound(this Vector4 v)
3838
/// </summary>
3939
/// <param name="v">The vector</param>
4040
[MethodImpl(MethodImplOptions.AggressiveInlining)]
41-
internal static Vector<float> RoundToNearestInteger(this Vector<float> v)
41+
internal static Vector<float> FastRound(this Vector<float> v)
4242
{
4343
if (Avx2.IsSupported && Vector<float>.Count == Vector256<float>.Count)
4444
{

src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,6 @@ private static Vector<float> NormalizeAndRound(Vector<float> row, Vector<float>
588588
row += off;
589589
row = Vector.Max(row, Vector<float>.Zero);
590590
row = Vector.Min(row, max);
591-
return row.RoundToNearestInteger();
591+
return row.FastRound();
592592
}
593593
}

tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_Round.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ public void SimdUtils_FastRound_Vector8()
6767
ref Block8x8F b = ref this.block;
6868

6969
ref Vector<float> row0 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V0L);
70-
row0 = row0.RoundToNearestInteger();
70+
row0 = row0.FastRound();
7171
ref Vector<float> row1 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V1L);
72-
row1 = row1.RoundToNearestInteger();
72+
row1 = row1.FastRound();
7373
ref Vector<float> row2 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V2L);
74-
row2 = row2.RoundToNearestInteger();
74+
row2 = row2.FastRound();
7575
ref Vector<float> row3 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V3L);
76-
row3 = row3.RoundToNearestInteger();
76+
row3 = row3.FastRound();
7777
ref Vector<float> row4 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V4L);
78-
row4 = row4.RoundToNearestInteger();
78+
row4 = row4.FastRound();
7979
ref Vector<float> row5 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V5L);
80-
row5 = row5.RoundToNearestInteger();
80+
row5 = row5.FastRound();
8181
ref Vector<float> row6 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V6L);
82-
row6 = row6.RoundToNearestInteger();
82+
row6 = row6.FastRound();
8383
ref Vector<float> row7 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V7L);
84-
row7 = row7.RoundToNearestInteger();
84+
row7 = row7.FastRound();
8585
}
8686

8787
[Benchmark]
@@ -90,21 +90,21 @@ public void SimdUtils_FastRound_Vector8_ForceAligned()
9090
ref Block8x8F b = ref Unsafe.AsRef<Block8x8F>(this.alignedPtr);
9191

9292
ref Vector<float> row0 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V0L);
93-
row0 = row0.RoundToNearestInteger();
93+
row0 = row0.FastRound();
9494
ref Vector<float> row1 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V1L);
95-
row1 = row1.RoundToNearestInteger();
95+
row1 = row1.FastRound();
9696
ref Vector<float> row2 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V2L);
97-
row2 = row2.RoundToNearestInteger();
97+
row2 = row2.FastRound();
9898
ref Vector<float> row3 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V3L);
99-
row3 = row3.RoundToNearestInteger();
99+
row3 = row3.FastRound();
100100
ref Vector<float> row4 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V4L);
101-
row4 = row4.RoundToNearestInteger();
101+
row4 = row4.FastRound();
102102
ref Vector<float> row5 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V5L);
103-
row5 = row5.RoundToNearestInteger();
103+
row5 = row5.FastRound();
104104
ref Vector<float> row6 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V6L);
105-
row6 = row6.RoundToNearestInteger();
105+
row6 = row6.FastRound();
106106
ref Vector<float> row7 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V7L);
107-
row7 = row7.RoundToNearestInteger();
107+
row7 = row7.FastRound();
108108
}
109109

110110
[Benchmark]
@@ -117,20 +117,20 @@ public void SimdUtils_FastRound_Vector8_Grouped()
117117
ref Vector<float> row2 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V2L);
118118
ref Vector<float> row3 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V3L);
119119

120-
row0 = row0.RoundToNearestInteger();
121-
row1 = row1.RoundToNearestInteger();
122-
row2 = row2.RoundToNearestInteger();
123-
row3 = row3.RoundToNearestInteger();
120+
row0 = row0.FastRound();
121+
row1 = row1.FastRound();
122+
row2 = row2.FastRound();
123+
row3 = row3.FastRound();
124124

125125
row0 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V4L);
126126
row1 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V5L);
127127
row2 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V6L);
128128
row3 = ref Unsafe.As<Vector4, Vector<float>>(ref b.V7L);
129129

130-
row0 = row0.RoundToNearestInteger();
131-
row1 = row1.RoundToNearestInteger();
132-
row2 = row2.RoundToNearestInteger();
133-
row3 = row3.RoundToNearestInteger();
130+
row0 = row0.FastRound();
131+
row1 = row1.FastRound();
132+
row2 = row2.FastRound();
133+
row3 = row3.FastRound();
134134
}
135135

136136
[Benchmark]

tests/ImageSharp.Tests/Common/SimdUtilsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private static Vector<float> CreateRandomTestVector(int seed, float min, float m
7373
public void FastRound()
7474
{
7575
Vector<float> v = CreateExactTestVector1();
76-
Vector<float> r = v.RoundToNearestInteger();
76+
Vector<float> r = v.FastRound();
7777

7878
this.Output.WriteLine(r.ToString());
7979

@@ -90,7 +90,7 @@ public void FastRound()
9090
public void FastRound_RandomValues(int seed, float scale)
9191
{
9292
Vector<float> v = CreateRandomTestVector(seed, -scale * 0.5f, scale * 0.5f);
93-
Vector<float> r = v.RoundToNearestInteger();
93+
Vector<float> r = v.FastRound();
9494

9595
this.Output.WriteLine(v.ToString());
9696
this.Output.WriteLine(r.ToString());

0 commit comments

Comments
 (0)