File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed
src/ImageSharp/Processing/Processors/Transforms/Resize Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public Vector4 Convolve(Span<Vector4> rowSpan)
7272 public Vector4 ConvolveCore ( ref Vector4 rowStartRef )
7373 {
7474#if SUPPORTS_RUNTIME_INTRINSICS
75- if ( Fma . IsSupported )
75+ if ( Avx2 . IsSupported && Fma . IsSupported )
7676 {
7777 float * bufferStart = this . bufferPtr ;
7878 float * bufferEnd = bufferStart + ( this . Length & ~ 3 ) ;
Original file line number Diff line number Diff line change 11// Copyright (c) Six Labors.
22// Licensed under the Apache License, Version 2.0.
33
4+ using SixLabors . ImageSharp . PixelFormats ;
45using SixLabors . ImageSharp . Processing ;
56using SixLabors . ImageSharp . Processing . Processors . Transforms ;
7+ using SixLabors . ImageSharp . Tests . TestUtilities ;
68using Xunit ;
79
810namespace SixLabors . ImageSharp . Tests . Processing . Transforms
@@ -85,5 +87,24 @@ public void ResizeWithOptions()
8587 Assert . Equal ( compand , resizeOptions . Compand ) ;
8688 Assert . Equal ( mode , resizeOptions . Mode ) ;
8789 }
90+
91+ #if SUPPORTS_RUNTIME_INTRINSICS
92+ [ Fact ]
93+ public void HwIntrinsics_Resize ( )
94+ {
95+ static void RunTest ( )
96+ {
97+ using var image = new Image < Rgba32 > ( 50 , 50 ) ;
98+ image . Mutate ( img => img . Resize ( 25 , 25 ) ) ;
99+
100+ Assert . Equal ( 25 , image . Width ) ;
101+ Assert . Equal ( 25 , image . Height ) ;
102+ }
103+
104+ FeatureTestRunner . RunWithHwIntrinsicsFeature (
105+ RunTest ,
106+ HwIntrinsics . AllowAll | HwIntrinsics . DisableAVX2 | HwIntrinsics . DisableFMA ) ;
107+ }
108+ #endif
88109 }
89110}
Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ public class FeatureTestRunnerTests
2525
2626 [ Theory ]
2727 [ MemberData ( nameof ( Intrinsics ) ) ]
28- public void ToFeatureCollectionReturnsExpectedResult ( HwIntrinsics expectedItrinsics , string [ ] expectedValues )
28+ public void ToFeatureCollectionReturnsExpectedResult ( HwIntrinsics expectedIntrinsics , string [ ] expectedValues )
2929 {
30- Dictionary < HwIntrinsics , string > features = expectedItrinsics . ToFeatureKeyValueCollection ( ) ;
30+ Dictionary < HwIntrinsics , string > features = expectedIntrinsics . ToFeatureKeyValueCollection ( ) ;
3131 HwIntrinsics [ ] keys = features . Keys . ToArray ( ) ;
3232
3333 HwIntrinsics actualIntrinsics = keys [ 0 ] ;
@@ -36,7 +36,7 @@ public void ToFeatureCollectionReturnsExpectedResult(HwIntrinsics expectedItrins
3636 actualIntrinsics |= keys [ i ] ;
3737 }
3838
39- Assert . Equal ( expectedItrinsics , actualIntrinsics ) ;
39+ Assert . Equal ( expectedIntrinsics , actualIntrinsics ) ;
4040
4141 IEnumerable < string > actualValues = features . Select ( x => x . Value ) ;
4242 Assert . Equal ( expectedValues , actualValues ) ;
You can’t perform that action at this time.
0 commit comments