@@ -933,11 +933,11 @@ private static void DoFilter2(Span<byte> p, int offset, int step)
933933 int p0 = p [ offset - step ] ;
934934 int q0 = p [ offset ] ;
935935 int q1 = p [ offset + step ] ;
936- int a = ( 3 * ( q0 - p0 ) ) + WebpLookupTables . Sclip1 [ p1 - q1 + 1020 ] ;
937- int a1 = WebpLookupTables . Sclip2 [ ( ( a + 4 ) >> 3 ) + 112 ] ;
938- int a2 = WebpLookupTables . Sclip2 [ ( ( a + 3 ) >> 3 ) + 112 ] ;
939- p [ offset - step ] = WebpLookupTables . Clip1 [ p0 + a2 + 255 ] ;
940- p [ offset ] = WebpLookupTables . Clip1 [ q0 - a1 + 255 ] ;
936+ int a = ( 3 * ( q0 - p0 ) ) + WebpLookupTables . Sclip1 ( p1 - q1 ) ;
937+ int a1 = WebpLookupTables . Sclip2 ( ( a + 4 ) >> 3 ) ;
938+ int a2 = WebpLookupTables . Sclip2 ( ( a + 3 ) >> 3 ) ;
939+ p [ offset - step ] = WebpLookupTables . Clip1 ( p0 + a2 ) ;
940+ p [ offset ] = WebpLookupTables . Clip1 ( q0 - a1 ) ;
941941 }
942942
943943 private static void DoFilter4 ( Span < byte > p , int offset , int step )
@@ -949,13 +949,13 @@ private static void DoFilter4(Span<byte> p, int offset, int step)
949949 int q0 = p [ offset ] ;
950950 int q1 = p [ offset + step ] ;
951951 int a = 3 * ( q0 - p0 ) ;
952- int a1 = WebpLookupTables . Sclip2 [ ( ( a + 4 ) >> 3 ) + 112 ] ;
953- int a2 = WebpLookupTables . Sclip2 [ ( ( a + 3 ) >> 3 ) + 112 ] ;
952+ int a1 = WebpLookupTables . Sclip2 ( ( a + 4 ) >> 3 ) ;
953+ int a2 = WebpLookupTables . Sclip2 ( ( a + 3 ) >> 3 ) ;
954954 int a3 = ( a1 + 1 ) >> 1 ;
955- p [ offsetMinus2Step ] = WebpLookupTables . Clip1 [ p1 + a3 + 255 ] ;
956- p [ offset - step ] = WebpLookupTables . Clip1 [ p0 + a2 + 255 ] ;
957- p [ offset ] = WebpLookupTables . Clip1 [ q0 - a1 + 255 ] ;
958- p [ offset + step ] = WebpLookupTables . Clip1 [ q1 - a3 + 255 ] ;
955+ p [ offsetMinus2Step ] = WebpLookupTables . Clip1 ( p1 + a3 ) ;
956+ p [ offset - step ] = WebpLookupTables . Clip1 ( p0 + a2 ) ;
957+ p [ offset ] = WebpLookupTables . Clip1 ( q0 - a1 ) ;
958+ p [ offset + step ] = WebpLookupTables . Clip1 ( q1 - a3 ) ;
959959 }
960960
961961 private static void DoFilter6 ( Span < byte > p , int offset , int step )
@@ -970,18 +970,18 @@ private static void DoFilter6(Span<byte> p, int offset, int step)
970970 int q0 = p [ offset ] ;
971971 int q1 = p [ offset + step ] ;
972972 int q2 = p [ offset + step2 ] ;
973- int a = WebpLookupTables . Sclip1 [ ( 3 * ( q0 - p0 ) ) + WebpLookupTables . Sclip1 [ p1 - q1 + 1020 ] + 1020 ] ;
973+ int a = WebpLookupTables . Sclip1 ( ( 3 * ( q0 - p0 ) ) + WebpLookupTables . Sclip1 ( p1 - q1 ) ) ;
974974
975975 // a is in [-128,127], a1 in [-27,27], a2 in [-18,18] and a3 in [-9,9]
976976 int a1 = ( ( 27 * a ) + 63 ) >> 7 ; // eq. to ((3 * a + 7) * 9) >> 7
977977 int a2 = ( ( 18 * a ) + 63 ) >> 7 ; // eq. to ((2 * a + 7) * 9) >> 7
978978 int a3 = ( ( 9 * a ) + 63 ) >> 7 ; // eq. to ((1 * a + 7) * 9) >> 7
979- p [ offset - step3 ] = WebpLookupTables . Clip1 [ p2 + a3 + 255 ] ;
980- p [ offset - step2 ] = WebpLookupTables . Clip1 [ p1 + a2 + 255 ] ;
981- p [ offsetMinusStep ] = WebpLookupTables . Clip1 [ p0 + a1 + 255 ] ;
982- p [ offset ] = WebpLookupTables . Clip1 [ q0 - a1 + 255 ] ;
983- p [ offset + step ] = WebpLookupTables . Clip1 [ q1 - a2 + 255 ] ;
984- p [ offset + step2 ] = WebpLookupTables . Clip1 [ q2 - a3 + 255 ] ;
979+ p [ offset - step3 ] = WebpLookupTables . Clip1 ( p2 + a3 ) ;
980+ p [ offset - step2 ] = WebpLookupTables . Clip1 ( p1 + a2 ) ;
981+ p [ offsetMinusStep ] = WebpLookupTables . Clip1 ( p0 + a1 ) ;
982+ p [ offset ] = WebpLookupTables . Clip1 ( q0 - a1 ) ;
983+ p [ offset + step ] = WebpLookupTables . Clip1 ( q1 - a2 ) ;
984+ p [ offset + step2 ] = WebpLookupTables . Clip1 ( q2 - a3 ) ;
985985 }
986986
987987 [ MethodImpl ( InliningOptions . ShortMethod ) ]
@@ -991,7 +991,7 @@ private static bool NeedsFilter(Span<byte> p, int offset, int step, int t)
991991 int p0 = p [ offset - step ] ;
992992 int q0 = p [ offset ] ;
993993 int q1 = p [ offset + step ] ;
994- return ( 4 * WebpLookupTables . Abs0 [ p0 - q0 + 255 ] ) + WebpLookupTables . Abs0 [ p1 - q1 + 255 ] <= t ;
994+ return ( 4 * WebpLookupTables . Abs0 ( p0 - q0 ) ) + WebpLookupTables . Abs0 ( p1 - q1 ) <= t ;
995995 }
996996
997997 private static bool NeedsFilter2 ( Span < byte > p , int offset , int step , int t , int it )
@@ -1006,14 +1006,14 @@ private static bool NeedsFilter2(Span<byte> p, int offset, int step, int t, int
10061006 int q1 = p [ offset + step ] ;
10071007 int q2 = p [ offset + step2 ] ;
10081008 int q3 = p [ offset + step3 ] ;
1009- if ( ( 4 * WebpLookupTables . Abs0 [ p0 - q0 + 255 ] ) + WebpLookupTables . Abs0 [ p1 - q1 + 255 ] > t )
1009+ if ( ( 4 * WebpLookupTables . Abs0 ( p0 - q0 ) ) + WebpLookupTables . Abs0 ( p1 - q1 ) > t )
10101010 {
10111011 return false ;
10121012 }
10131013
1014- return WebpLookupTables . Abs0 [ p3 - p2 + 255 ] <= it && WebpLookupTables . Abs0 [ p2 - p1 + 255 ] <= it &&
1015- WebpLookupTables . Abs0 [ p1 - p0 + 255 ] <= it && WebpLookupTables . Abs0 [ q3 - q2 + 255 ] <= it &&
1016- WebpLookupTables . Abs0 [ q2 - q1 + 255 ] <= it && WebpLookupTables . Abs0 [ q1 - q0 + 255 ] <= it ;
1014+ return WebpLookupTables . Abs0 ( p3 - p2 ) <= it && WebpLookupTables . Abs0 ( p2 - p1 ) <= it &&
1015+ WebpLookupTables . Abs0 ( p1 - p0 ) <= it && WebpLookupTables . Abs0 ( q3 - q2 ) <= it &&
1016+ WebpLookupTables . Abs0 ( q2 - q1 ) <= it && WebpLookupTables . Abs0 ( q1 - q0 ) <= it ;
10171017 }
10181018
10191019 [ MethodImpl ( InliningOptions . ShortMethod ) ]
@@ -1023,7 +1023,7 @@ private static bool Hev(Span<byte> p, int offset, int step, int thresh)
10231023 int p0 = p [ offset - step ] ;
10241024 int q0 = p [ offset ] ;
10251025 int q1 = p [ offset + step ] ;
1026- return WebpLookupTables . Abs0 [ p1 - p0 + 255 ] > thresh || WebpLookupTables . Abs0 [ q1 - q0 + 255 ] > thresh ;
1026+ return WebpLookupTables . Abs0 ( p1 - p0 ) > thresh || WebpLookupTables . Abs0 ( q1 - q0 ) > thresh ;
10271027 }
10281028
10291029 [ MethodImpl ( InliningOptions . ShortMethod ) ]
0 commit comments