DEBUG and RELEASE modeWhen attempting to call the IImageProcessingContext#Resize() extension method, the following exception is thrown:
SixLabors.ImageSharp.ImageProcessingException: An error occurred when processing the image using ResizeProcessor`1. See the inner exception for more detail.
---> System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Runtime.Intrinsics.X86.Avx2.PermuteVar8x32(Vector256`1 left, Vector256`1 control)
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeWorker`1.CalculateFirstPassValues(RowInterval calculationInterval)
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeWorker`1.Initialize()
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor`1.ApplyResizeFrameTransform(Configuration configuration, ImageFrame`1 source, ImageFrame`1 destination, ResizeKernelMap horizontalKernelMap, ResizeKernelMap verticalKernelMap, Rectangle sourceRectangle, Rectangle destinationRectangle, Rectangle interest, Boolean compand, Boolean premultiplyAlpha)
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor`1.ApplyTransform[TResampler](TResampler& sampler)
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor`1.SixLabors.ImageSharp.Processing.Processors.Transforms.IResamplingTransformImageProcessor<TPixel>.ApplyTransform[TResampler](TResampler& sampler)
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor`1.BeforeImageApply(Image`1 destination)
at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.SixLabors.ImageSharp.Processing.Processors.ICloningImageProcessor<TPixel>.CloneAndExecute()
--- End of inner exception stack trace ---
at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.SixLabors.ImageSharp.Processing.Processors.ICloningImageProcessor<TPixel>.CloneAndExecute()
at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.SixLabors.ImageSharp.Processing.Processors.IImageProcessor<TPixel>.Execute()
at SixLabors.ImageSharp.Processing.DefaultImageProcessorContext`1.ApplyProcessor(IImageProcessor processor, Rectangle rectangle)
at SixLabors.ImageSharp.Processing.DefaultImageProcessorContext`1.ApplyProcessor(IImageProcessor processor)
at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, ResizeOptions options)
at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, Int32 width, Int32 height, IResampler sampler, Rectangle targetRectangle, Boolean compand)
at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, Int32 width, Int32 height, IResampler sampler, Boolean compand)
at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, Int32 width, Int32 height)
at Administrator.Services.LevelService.<>c__DisplayClass6_1.<CreateXpImageAsync>b__5(IImageProcessingContext x) in C:\Users\Daniel Jarski\source\repos\Administrator\Administrator\Services\LevelService.cs:line 102
at SixLabors.ImageSharp.Processing.ProcessingExtensions.Mutate[TPixel](Image`1 source, Configuration configuration, Action`1 operation)
at SixLabors.ImageSharp.Processing.ProcessingExtensions.Mutate[TPixel](Image`1 source, Action`1 operation)
This exception is not thrown on Windows in Debug mode, but is thrown on Linux in Release mode. I have not checked Windows/Release and Linux/Debug. See the System Configuration section for details regarding my system information.
The code which throws this error can be found starting here. Lines 82, 132, 189, 244, and 252 contain a .Resize() call. Please do note that I have not pushed my current working code to github in a long time, so line numbers in the exception may not match the line numbers on github, and neither will the versions installed in the .csproj; but I can assure you the method itself has not changed.
1.0.3-alpha.0.35ImageSharp.Drawing 1.0.0-beta11.4It seems the AMD FX-4350 has only support for FMA, but not for AVX2. We only check for FMA in the resize kernel. We should also check for AVX2 there.
@QuantumToasted fancy raising a PR?
@QuantumToasted fancy raising a PR?
Im already on it. Seems the ResizeKernel it is the only place where FMA and AVX are needed together.
I had a strange feeling it had something to do with my CPU, iI'm glad I included it. When googling related exceptions and the method which is throwing the exception, I came across stuff mentioning that the method was somehow related to CPU vender-specific optimizations...whether or not that is actually the case, it made me think it had more to do with my CPU than the fact I was on Linux.
@QuantumToasted I'm very happy you found this in the alpha, and the bug did not go out to NuGet!
Most helpful comment
I had a strange feeling it had something to do with my CPU, iI'm glad I included it. When googling related exceptions and the method which is throwing the exception, I came across stuff mentioning that the method was somehow related to CPU vender-specific optimizations...whether or not that is actually the case, it made me think it had more to do with my CPU than the fact I was on Linux.