Skip to content

Commit 25e6f6e

Browse files
authored
Merge branch 'main' into bp/fixCalcResidualCosts
2 parents ed71d7e + 661f281 commit 25e6f6e

File tree

6 files changed

+40
-63
lines changed

6 files changed

+40
-63
lines changed

.github/CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@
2929
#### **Running tests and Debugging**
3030

3131
* Expected test output is pulled in as a submodule from the [ImageSharp.Tests.Images repository](https://github.com/SixLabors/Imagesharp.Tests.Images/tree/main/ReferenceOutput). To succesfully run tests, make sure that you have updated the submodules!
32-
* Debugging (running tests in Debug mode) is only supported on .NET Core 2.1+, because of JIT Code Generation bugs like [dotnet/coreclr#16443](https://github.com/dotnet/coreclr/issues/16443) or [dotnet/coreclr#20657](https://github.com/dotnet/coreclr/issues/20657)
3332

3433
#### **Do you have questions about consuming the library or the source code?**
3534

3635
* Ask any question about how to use SixLabors.ImageSharp in the [Help Discussions Channel](https://github.com/SixLabors/ImageSharp/discussions?discussions_q=category%3AHelp).
3736

3837
#### Code of Conduct
3938
This project has adopted the code of conduct defined by the [Contributor Covenant](https://contributor-covenant.org/) to clarify expected behavior in our community.
40-
For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
4139

4240
And please remember. SixLabors.ImageSharp is the work of a very, very, small number of developers who struggle balancing time to contribute to the project with family time and work commitments. We encourage you to pitch in and help make our vision of simple accessible image processing available to all. Open Source can only exist with your help.
4341

.github/ISSUE_TEMPLATE/commercial-bug-report.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/oss-bug-report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: "OSS : Bug Report"
2-
description: Create a report to help us improve the project. OSS Issues are not guaranteed to be triaged.
1+
name: "Bug Report"
2+
description: Create a report to help us improve the project. Issues are not guaranteed to be triaged.
33
labels: ["needs triage"]
44
body:
55
- type: checkboxes

ImageSharp.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1799
2828
EndProject
2929
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{FBE8C1AD-5AEC-4514-9B64-091D8E145865}"
3030
ProjectSection(SolutionItems) = preProject
31-
.github\ISSUE_TEMPLATE\commercial-bug-report.yml = .github\ISSUE_TEMPLATE\commercial-bug-report.yml
3231
.github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
3332
.github\ISSUE_TEMPLATE\oss-bug-report.yml = .github\ISSUE_TEMPLATE\oss-bug-report.yml
3433
EndProjectSection

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ git submodule update --init --recursive
101101

102102
Please... Spread the word, contribute algorithms, submit performance improvements, unit tests, no input is too little. Make sure to read our [Contribution Guide](https://github.com/SixLabors/ImageSharp/blob/main/.github/CONTRIBUTING.md) before opening a PR.
103103

104+
Useful tools for development and links to specifications can be found in our wikipage: [Useful-tools-and-links](https://github.com/SixLabors/ImageSharp/wiki/Useful-tools-and-links).
105+
104106
## The ImageSharp Team
105107

106108
- [James Jackson-South](https://github.com/jimbobsquarepants)
@@ -109,6 +111,11 @@ Please... Spread the word, contribute algorithms, submit performance improvement
109111
- [Scott Williams](https://github.com/tocsoft)
110112
- [Brian Popow](https://github.com/brianpopow)
111113

114+
---
112115

116+
<div>
117+
<a href="https://www.jetbrains.com/?from=ImageSharp" align="right"><img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" alt="JetBrains" class="logo-footer" width="72" align="left"></a>
118+
<br/>
113119

114-
120+
Special thanks to [JetBrains](https://www.jetbrains.com/?from=ImageSharp) for supporting us with open-source licenses for their IDEs.
121+
</div>

src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Runtime.CompilerServices;
66
using System.Runtime.InteropServices;
77
using System.Runtime.Intrinsics;
8+
using System.Runtime.Intrinsics.Arm;
89
using System.Runtime.Intrinsics.X86;
910
using SixLabors.ImageSharp.Memory;
1011

@@ -122,12 +123,26 @@ static void SumVertical(Span<float> target, Span<float> source)
122123
ref Vector256<float> sourceVectorRef = ref Unsafe.As<float, Vector256<float>>(ref MemoryMarshal.GetReference(source));
123124

124125
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
126+
DebugGuard.IsTrue(source.Length % 8 == 0, "source must be multiple of 8");
125127
nuint count = source.Vector256Count<float>();
126128
for (nuint i = 0; i < count; i++)
127129
{
128130
Unsafe.Add(ref targetVectorRef, i) = Avx.Add(Unsafe.Add(ref targetVectorRef, i), Unsafe.Add(ref sourceVectorRef, i));
129131
}
130132
}
133+
else if (AdvSimd.IsSupported)
134+
{
135+
ref Vector128<float> targetVectorRef = ref Unsafe.As<float, Vector128<float>>(ref MemoryMarshal.GetReference(target));
136+
ref Vector128<float> sourceVectorRef = ref Unsafe.As<float, Vector128<float>>(ref MemoryMarshal.GetReference(source));
137+
138+
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
139+
DebugGuard.IsTrue(source.Length % 8 == 0, "source must be multiple of 8");
140+
nuint count = source.Vector128Count<float>();
141+
for (nuint i = 0; i < count; i++)
142+
{
143+
Unsafe.Add(ref targetVectorRef, i) = AdvSimd.Add(Unsafe.Add(ref targetVectorRef, i), Unsafe.Add(ref sourceVectorRef, i));
144+
}
145+
}
131146
else
132147
{
133148
ref Vector<float> targetVectorRef = ref Unsafe.As<float, Vector<float>>(ref MemoryMarshal.GetReference(target));
@@ -200,13 +215,27 @@ static void MultiplyToAverage(Span<float> target, float multiplier)
200215
ref Vector256<float> targetVectorRef = ref Unsafe.As<float, Vector256<float>>(ref MemoryMarshal.GetReference(target));
201216

202217
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
218+
DebugGuard.IsTrue(target.Length % 8 == 0, "target must be multiple of 8");
203219
nuint count = target.Vector256Count<float>();
204-
var multiplierVector = Vector256.Create(multiplier);
220+
Vector256<float> multiplierVector = Vector256.Create(multiplier);
205221
for (nuint i = 0; i < count; i++)
206222
{
207223
Unsafe.Add(ref targetVectorRef, i) = Avx.Multiply(Unsafe.Add(ref targetVectorRef, i), multiplierVector);
208224
}
209225
}
226+
else if (AdvSimd.IsSupported)
227+
{
228+
ref Vector128<float> targetVectorRef = ref Unsafe.As<float, Vector128<float>>(ref MemoryMarshal.GetReference(target));
229+
230+
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
231+
DebugGuard.IsTrue(target.Length % 8 == 0, "target must be multiple of 8");
232+
nuint count = target.Vector128Count<float>();
233+
Vector128<float> multiplierVector = Vector128.Create(multiplier);
234+
for (nuint i = 0; i < count; i++)
235+
{
236+
Unsafe.Add(ref targetVectorRef, i) = AdvSimd.Multiply(Unsafe.Add(ref targetVectorRef, i), multiplierVector);
237+
}
238+
}
210239
else
211240
{
212241
ref Vector<float> targetVectorRef = ref Unsafe.As<float, Vector<float>>(ref MemoryMarshal.GetReference(target));

0 commit comments

Comments
 (0)