@@ -97,14 +97,14 @@ public static void AddGreenToBlueAndRed(Span<uint> pixelData)
9797 {
9898 if ( Vector256 . IsHardwareAccelerated && pixelData . Length >= 8 )
9999 {
100- Vector256 < byte > addGreenToBlueAndRedMaskAvx2 = Vector256 . Create ( 1 , 255 , 1 , 255 , 5 , 255 , 5 , 255 , 9 , 255 , 9 , 255 , 13 , 255 , 13 , 255 , 17 , 255 , 17 , 255 , 21 , 255 , 21 , 255 , 25 , 255 , 25 , 255 , 29 , 255 , 29 , 255 ) ;
100+ Vector256 < byte > addGreenToBlueAndRedMask = Vector256 . Create ( 1 , 255 , 1 , 255 , 5 , 255 , 5 , 255 , 9 , 255 , 9 , 255 , 13 , 255 , 13 , 255 , 17 , 255 , 17 , 255 , 21 , 255 , 21 , 255 , 25 , 255 , 25 , 255 , 29 , 255 , 29 , 255 ) ;
101101 nuint numPixels = ( uint ) pixelData . Length ;
102102 nuint i = 0 ;
103103 do
104104 {
105105 ref uint pos = ref Unsafe . Add ( ref MemoryMarshal . GetReference ( pixelData ) , i ) ;
106106 Vector256 < byte > input = Unsafe . As < uint , Vector256 < uint > > ( ref pos ) . AsByte ( ) ;
107- Vector256 < byte > in0g0g = Vector256_ . ShuffleNative ( input , addGreenToBlueAndRedMaskAvx2 ) ;
107+ Vector256 < byte > in0g0g = Vector256_ . ShuffleNative ( input , addGreenToBlueAndRedMask ) ;
108108 Vector256 < byte > output = input + in0g0g ;
109109 Unsafe . As < uint , Vector256 < uint > > ( ref pos ) = output. AsUInt32 ( ) ;
110110 i += 8 ;
@@ -161,14 +161,14 @@ public static void SubtractGreenFromBlueAndRed(Span<uint> pixelData)
161161 {
162162 if ( Vector256 . IsHardwareAccelerated && pixelData . Length >= 8 )
163163 {
164- Vector256 < byte > subtractGreenFromBlueAndRedMaskAvx2 = Vector256 . Create ( 1 , 255 , 1 , 255 , 5 , 255 , 5 , 255 , 9 , 255 , 9 , 255 , 13 , 255 , 13 , 255 , 17 , 255 , 17 , 255 , 21 , 255 , 21 , 255 , 25 , 255 , 25 , 255 , 29 , 255 , 29 , 255 ) ;
164+ Vector256 < byte > subtractGreenFromBlueAndRedMask = Vector256 . Create ( 1 , 255 , 1 , 255 , 5 , 255 , 5 , 255 , 9 , 255 , 9 , 255 , 13 , 255 , 13 , 255 , 17 , 255 , 17 , 255 , 21 , 255 , 21 , 255 , 25 , 255 , 25 , 255 , 29 , 255 , 29 , 255 ) ;
165165 nuint numPixels = ( uint ) pixelData . Length ;
166166 nuint i = 0 ;
167167 do
168168 {
169169 ref uint pos = ref Unsafe . Add ( ref MemoryMarshal . GetReference ( pixelData ) , i ) ;
170170 Vector256 < byte > input = Unsafe . As < uint , Vector256 < uint > > ( ref pos ) . AsByte ( ) ;
171- Vector256 < byte > in0g0g = Vector256_ . ShuffleNative ( input , subtractGreenFromBlueAndRedMaskAvx2 ) ;
171+ Vector256 < byte > in0g0g = Vector256_ . ShuffleNative ( input , subtractGreenFromBlueAndRedMask ) ;
172172 Vector256 < byte > output = input - in0g0g ;
173173 Unsafe . As < uint , Vector256 < uint > > ( ref pos ) = output. AsUInt32 ( ) ;
174174 i += 8 ;
0 commit comments