@@ -219,9 +219,14 @@ private static int Vp8_Sse16xN_Avx2(Span<byte> a, Span<byte> b, int numPairs)
219
219
private static int Vp8_Sse16x16_Neon ( Span < byte > a , Span < byte > b )
220
220
{
221
221
Vector128 < uint > sum = Vector128 < uint > . Zero ;
222
+ ref byte aRef = ref MemoryMarshal . GetReference ( a ) ;
223
+ ref byte bRef = ref MemoryMarshal . GetReference ( b ) ;
222
224
for ( int y = 0 ; y < 16 ; y ++ )
223
225
{
224
- sum = AccumulateSSE16Neon ( a . Slice ( y * WebpConstants . Bps ) , b . Slice ( y * WebpConstants . Bps ) , sum ) ;
226
+ sum = AccumulateSSE16Neon (
227
+ ref Unsafe . Add ( ref aRef , y * WebpConstants . Bps ) ,
228
+ ref Unsafe . Add ( ref bRef , y * WebpConstants . Bps ) ,
229
+ sum ) ;
225
230
}
226
231
227
232
return Numerics . ReduceSumArm ( sum ) ;
@@ -231,9 +236,14 @@ private static int Vp8_Sse16x16_Neon(Span<byte> a, Span<byte> b)
231
236
private static int Vp8_Sse16x8_Neon ( Span < byte > a , Span < byte > b )
232
237
{
233
238
Vector128 < uint > sum = Vector128 < uint > . Zero ;
239
+ ref byte aRef = ref MemoryMarshal . GetReference ( a ) ;
240
+ ref byte bRef = ref MemoryMarshal . GetReference ( b ) ;
234
241
for ( int y = 0 ; y < 8 ; y ++ )
235
242
{
236
- sum = AccumulateSSE16Neon ( a . Slice ( y * WebpConstants . Bps ) , b . Slice ( y * WebpConstants . Bps ) , sum ) ;
243
+ sum = AccumulateSSE16Neon (
244
+ ref Unsafe . Add ( ref aRef , y * WebpConstants . Bps ) ,
245
+ ref Unsafe . Add ( ref bRef , y * WebpConstants . Bps ) ,
246
+ sum ) ;
237
247
}
238
248
239
249
return Numerics . ReduceSumArm ( sum ) ;
@@ -273,11 +283,8 @@ private static unsafe Vector128<uint> Load4x4Neon(Span<byte> src)
273
283
}
274
284
275
285
[ MethodImpl ( InliningOptions . ShortMethod ) ]
276
- private static Vector128 < uint > AccumulateSSE16Neon ( Span < byte > a , Span < byte > b , Vector128 < uint > sum )
286
+ private static Vector128 < uint > AccumulateSSE16Neon ( ref byte aRef , ref byte bRef , Vector128 < uint > sum )
277
287
{
278
- ref byte aRef = ref MemoryMarshal . GetReference ( a ) ;
279
- ref byte bRef = ref MemoryMarshal . GetReference ( b ) ;
280
-
281
288
Vector128 < byte > a0 = Unsafe . As < byte , Vector128 < byte > > ( ref aRef ) ;
282
289
Vector128 < byte > b0 = Unsafe . As < byte , Vector128 < byte > > ( ref bRef ) ;
283
290
0 commit comments