@@ -97,14 +97,14 @@ public static void AddGreenToBlueAndRed(Span<uint> pixelData)
97
97
{
98
98
if ( Vector256 . IsHardwareAccelerated && pixelData . Length >= 8 )
99
99
{
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 ) ;
101
101
nuint numPixels = ( uint ) pixelData . Length ;
102
102
nuint i = 0 ;
103
103
do
104
104
{
105
105
ref uint pos = ref Unsafe . Add ( ref MemoryMarshal . GetReference ( pixelData ) , i ) ;
106
106
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 ) ;
108
108
Vector256 < byte > output = input + in0g0g ;
109
109
Unsafe . As < uint , Vector256 < uint > > ( ref pos ) = output. AsUInt32 ( ) ;
110
110
i += 8 ;
@@ -161,14 +161,14 @@ public static void SubtractGreenFromBlueAndRed(Span<uint> pixelData)
161
161
{
162
162
if ( Vector256 . IsHardwareAccelerated && pixelData . Length >= 8 )
163
163
{
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 ) ;
165
165
nuint numPixels = ( uint ) pixelData . Length ;
166
166
nuint i = 0 ;
167
167
do
168
168
{
169
169
ref uint pos = ref Unsafe . Add ( ref MemoryMarshal . GetReference ( pixelData ) , i ) ;
170
170
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 ) ;
172
172
Vector256 < byte > output = input - in0g0g ;
173
173
Unsafe . As < uint , Vector256 < uint > > ( ref pos ) = output. AsUInt32 ( ) ;
174
174
i += 8 ;
0 commit comments