From c19095153eb392c5dbfd7ccfb6d612d4dde097cd Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Sun, 2 Apr 2023 17:24:15 +0200 Subject: [PATCH 1/8] Add Arm for MultiplyToAverage --- .../Jpeg/Components/Encoder/ComponentProcessor.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs index be27385cd0..31c1e27cb3 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs @@ -5,6 +5,7 @@ using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.Arm; using System.Runtime.Intrinsics.X86; using SixLabors.ImageSharp.Memory; @@ -201,12 +202,24 @@ internal class ComponentProcessor : IDisposable // Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed nuint count = target.Vector256Count(); - var multiplierVector = Vector256.Create(multiplier); + Vector256 multiplierVector = Vector256.Create(multiplier); for (nuint i = 0; i < count; i++) { Unsafe.Add(ref targetVectorRef, i) = Avx.Multiply(Unsafe.Add(ref targetVectorRef, i), multiplierVector); } } + else if (AdvSimd.IsSupported) + { + ref Vector128 targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target)); + + // Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed + nuint count = target.Vector128Count(); + Vector128 multiplierVector = Vector128.Create(multiplier); + for (nuint i = 0; i < count; i++) + { + Unsafe.Add(ref targetVectorRef, i) = AdvSimd.Multiply(Unsafe.Add(ref targetVectorRef, i), multiplierVector); + } + } else { ref Vector targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target)); From 03a988be3d3d7f3e68349c69198393175b34766a Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Sun, 2 Apr 2023 22:48:40 +0200 Subject: [PATCH 2/8] Add Arm for SumVertical --- .../Jpeg/Components/Encoder/ComponentProcessor.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs index 31c1e27cb3..7d4f7ee842 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs @@ -129,6 +129,18 @@ internal class ComponentProcessor : IDisposable Unsafe.Add(ref targetVectorRef, i) = Avx.Add(Unsafe.Add(ref targetVectorRef, i), Unsafe.Add(ref sourceVectorRef, i)); } } + else if (AdvSimd.IsSupported) + { + ref Vector128 targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target)); + ref Vector128 sourceVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); + + // Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed + nuint count = source.Vector128Count(); + for (nuint i = 0; i < count; i++) + { + Unsafe.Add(ref targetVectorRef, i) = AdvSimd.Add(Unsafe.Add(ref targetVectorRef, i), Unsafe.Add(ref sourceVectorRef, i)); + } + } else { ref Vector targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target)); From 4571325fe2041d5b5c4489cfe01a0d99c32fbb26 Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Mon, 3 Apr 2023 18:11:34 +0200 Subject: [PATCH 3/8] add DebugGuard to check for multiple of 8 --- .../Formats/Jpeg/Components/Encoder/ComponentProcessor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs index 7d4f7ee842..c33a8a1968 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs @@ -123,6 +123,7 @@ internal class ComponentProcessor : IDisposable ref Vector256 sourceVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); // Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed + DebugGuard.IsTrue(source.Length % 8 == 0, "source must be multiple of 8"); nuint count = source.Vector256Count(); for (nuint i = 0; i < count; i++) { @@ -135,6 +136,7 @@ internal class ComponentProcessor : IDisposable ref Vector128 sourceVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); // Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed + DebugGuard.IsTrue(source.Length % 8 == 0, "source must be multiple of 8"); nuint count = source.Vector128Count(); for (nuint i = 0; i < count; i++) { @@ -213,6 +215,7 @@ internal class ComponentProcessor : IDisposable ref Vector256 targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target)); // Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed + DebugGuard.IsTrue(target.Length % 8 == 0, "target must be multiple of 8"); nuint count = target.Vector256Count(); Vector256 multiplierVector = Vector256.Create(multiplier); for (nuint i = 0; i < count; i++) @@ -225,6 +228,7 @@ internal class ComponentProcessor : IDisposable ref Vector128 targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target)); // Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed + DebugGuard.IsTrue(target.Length % 8 == 0, "target must be multiple of 8"); nuint count = target.Vector128Count(); Vector128 multiplierVector = Vector128.Create(multiplier); for (nuint i = 0; i < count; i++) From fd57eac1d41fc263808c39129cb0792664d22c73 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Fri, 7 Apr 2023 21:34:19 +0200 Subject: [PATCH 4/8] Add mention to tools wikipdage --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 09262eb572..6a0b6dee33 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,8 @@ git submodule update --init --recursive 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. +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). + ## The ImageSharp Team - [James Jackson-South](https://github.com/jimbobsquarepants) From c65955da844601530ba0781e49a42553deee71c9 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Fri, 7 Apr 2023 21:41:23 +0200 Subject: [PATCH 5/8] Add a little thanks to jetbrains in the readme for supporting ImageSharp --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a0b6dee33..9a52b91d80 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,5 @@ Useful tools for development and links to specifications can be found in our wik - [Scott Williams](https://github.com/tocsoft) - [Brian Popow](https://github.com/brianpopow) - - +Thanks to [jetbrains](https://www.jetbrains.com) for supporting the ImageSharp team via the [Open Source Development Program](www.jetbrains.com/community/opensource/), so we can use the jetbrains tools for developing ImageSharp! From 4a17bc53ef504d1c9b571cee0d39a8000c2d2de7 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Sat, 8 Apr 2023 21:17:35 +0200 Subject: [PATCH 6/8] Add jetbrains logo, change jetbrains mention text --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a52b91d80..fa51d57cdf 100644 --- a/README.md +++ b/README.md @@ -111,5 +111,11 @@ Useful tools for development and links to specifications can be found in our wik - [Scott Williams](https://github.com/tocsoft) - [Brian Popow](https://github.com/brianpopow) -Thanks to [jetbrains](https://www.jetbrains.com) for supporting the ImageSharp team via the [Open Source Development Program](www.jetbrains.com/community/opensource/), so we can use the jetbrains tools for developing ImageSharp! +--- +
+ JetBrains +
+ + Special thanks to [JetBrains](https://www.jetbrains.com/?from=ImageSharp) for supporting us with open-source licenses for their IDEs. +
From 46e1f3578aa84782ecbb1aa22f5cc2bc2aa4674b Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Wed, 12 Apr 2023 22:12:33 +1000 Subject: [PATCH 7/8] Remove commercial template for v3 --- .github/CONTRIBUTING.md | 2 - .../ISSUE_TEMPLATE/commercial-bug-report.yml | 56 ------------------- .github/ISSUE_TEMPLATE/oss-bug-report.yml | 2 +- ImageSharp.sln | 1 - 4 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/commercial-bug-report.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ffacf51e4a..543506197b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -29,7 +29,6 @@ #### **Running tests and Debugging** * 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! -* 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) #### **Do you have questions about consuming the library or the source code?** @@ -37,7 +36,6 @@ #### Code of Conduct This project has adopted the code of conduct defined by the [Contributor Covenant](https://contributor-covenant.org/) to clarify expected behavior in our community. -For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). 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. diff --git a/.github/ISSUE_TEMPLATE/commercial-bug-report.yml b/.github/ISSUE_TEMPLATE/commercial-bug-report.yml deleted file mode 100644 index 6b4d914d7e..0000000000 --- a/.github/ISSUE_TEMPLATE/commercial-bug-report.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: "Commercial License : Bug Report" -description: | - Create a report to help us improve the project. For Commercial License holders only. - Please contact help@sixlabors.com for issues requiring private support. -labels: ["commercial", "needs triage"] -body: -- type: checkboxes - attributes: - label: Prerequisites - options: - - label: I have bought a Commercial License - required: true - - label: I have written a descriptive issue title - required: true - - label: I have verified that I am running the latest version of ImageSharp - required: true - - label: I have verified if the problem exist in both `DEBUG` and `RELEASE` mode - required: true - - label: I have searched [open](https://github.com/SixLabors/ImageSharp/issues) and [closed](https://github.com/SixLabors/ImageSharp/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported - required: true -- type: input - attributes: - label: ImageSharp version - validations: - required: true -- type: input - attributes: - label: Other ImageSharp packages and versions - validations: - required: true -- type: input - attributes: - label: Environment (Operating system, version and so on) - validations: - required: true -- type: input - attributes: - label: .NET Framework version - validations: - required: true -- type: textarea - attributes: - label: Description - description: A description of the bug - validations: - required: true -- type: textarea - attributes: - label: Steps to Reproduce - description: List of steps, sample code, failing test or link to a project that reproduces the behavior. Make sure you place a stack trace inside a code (```) block to avoid linking unrelated issues. - validations: - required: true -- type: textarea - attributes: - label: Images - description: Please upload images that can be used to reproduce issues in the area below. If the file type is not supported the file can be zipped and then uploaded instead. diff --git a/.github/ISSUE_TEMPLATE/oss-bug-report.yml b/.github/ISSUE_TEMPLATE/oss-bug-report.yml index a4e5619d46..67fccbf3c6 100644 --- a/.github/ISSUE_TEMPLATE/oss-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/oss-bug-report.yml @@ -1,5 +1,5 @@ name: "OSS : Bug Report" -description: Create a report to help us improve the project. OSS Issues are not guaranteed to be triaged. +description: Create a report to help us improve the project. Issues are not guaranteed to be triaged. labels: ["needs triage"] body: - type: checkboxes diff --git a/ImageSharp.sln b/ImageSharp.sln index 3ea3160a79..6eab8da752 100644 --- a/ImageSharp.sln +++ b/ImageSharp.sln @@ -28,7 +28,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1799 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{FBE8C1AD-5AEC-4514-9B64-091D8E145865}" ProjectSection(SolutionItems) = preProject - .github\ISSUE_TEMPLATE\commercial-bug-report.yml = .github\ISSUE_TEMPLATE\commercial-bug-report.yml .github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml .github\ISSUE_TEMPLATE\oss-bug-report.yml = .github\ISSUE_TEMPLATE\oss-bug-report.yml EndProjectSection From 661f28158c7b396e42a69d8e74ef6caefadc8996 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Wed, 12 Apr 2023 22:13:34 +1000 Subject: [PATCH 8/8] Update oss-bug-report.yml --- .github/ISSUE_TEMPLATE/oss-bug-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/oss-bug-report.yml b/.github/ISSUE_TEMPLATE/oss-bug-report.yml index 67fccbf3c6..87cd1a7a17 100644 --- a/.github/ISSUE_TEMPLATE/oss-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/oss-bug-report.yml @@ -1,4 +1,4 @@ -name: "OSS : Bug Report" +name: "Bug Report" description: Create a report to help us improve the project. Issues are not guaranteed to be triaged. labels: ["needs triage"] body: