@@ -11,6 +11,35 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP
1111 [ Trait ( "Format" , "Webp" ) ]
1212 public class LossyUtilsTests
1313 {
14+ private static void RunVp8Sse4X4Test ( )
15+ {
16+ byte [ ] a =
17+ {
18+ 27 , 27 , 28 , 29 , 29 , 28 , 27 , 27 , 27 , 28 , 28 , 29 , 29 , 28 , 28 , 27 , 129 , 129 , 129 , 129 , 129 , 129 , 129 ,
19+ 129 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 27 , 27 , 27 , 27 , 27 , 27 , 27 , 27 , 27 , 28 , 28 , 29 , 29 , 28 ,
20+ 28 , 27 , 129 , 129 , 129 , 129 , 129 , 129 , 129 , 129 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 27 , 27 , 26 ,
21+ 26 , 26 , 26 , 27 , 27 , 27 , 28 , 28 , 29 , 29 , 28 , 28 , 27 , 129 , 129 , 129 , 129 , 129 , 129 , 129 , 129 , 128 ,
22+ 128 , 128 , 128 , 128 , 128 , 128 , 128 , 28 , 27 , 27 , 26 , 26 , 27 , 27 , 28 , 27 , 28 , 28 , 29 , 29 , 28 , 28 , 27 ,
23+ 129 , 129 , 129 , 129 , 129 , 129 , 129 , 129 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 128
24+ } ;
25+
26+ byte [ ] b =
27+ {
28+ 26 , 26 , 26 , 26 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 204 , 204 , 204 , 204 , 204 , 204 , 204 ,
29+ 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 26 , 26 , 26 , 26 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 ,
30+ 28 , 28 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 26 , 26 , 26 ,
31+ 26 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 ,
32+ 204 , 204 , 204 , 204 , 204 , 204 , 204 , 26 , 26 , 26 , 26 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 ,
33+ 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204 , 204
34+ } ;
35+
36+ int expected = 27 ;
37+
38+ int actual = LossyUtils . Vp8_Sse4X4 ( a , b ) ;
39+
40+ Assert . Equal ( expected , actual ) ;
41+ }
42+
1443 private static void RunMean16x4Test ( )
1544 {
1645 // arrange
@@ -61,13 +90,22 @@ private static void RunHadamardTransformTest()
6190 Assert . Equal ( expected , actual ) ;
6291 }
6392
93+ [ Fact ]
94+ public void Vp8Sse4X4_Works ( ) => RunVp8Sse4X4Test ( ) ;
95+
6496 [ Fact ]
6597 public void Mean16x4_Works ( ) => RunMean16x4Test ( ) ;
6698
6799 [ Fact ]
68100 public void HadamardTransform_Works ( ) => RunHadamardTransformTest ( ) ;
69101
70102#if SUPPORTS_RUNTIME_INTRINSICS
103+ [ Fact ]
104+ public void Vp8Sse4X4_WithHardwareIntrinsics_Works ( ) => FeatureTestRunner . RunWithHwIntrinsicsFeature ( RunVp8Sse4X4Test , HwIntrinsics . AllowAll ) ;
105+
106+ [ Fact ]
107+ public void Vp8Sse4X4_WithoutHardwareIntrinsics_Works ( ) => FeatureTestRunner . RunWithHwIntrinsicsFeature ( RunVp8Sse4X4Test , HwIntrinsics . DisableHWIntrinsic ) ;
108+
71109 [ Fact ]
72110 public void Mean16x4_WithHardwareIntrinsics_Works ( ) => FeatureTestRunner . RunWithHwIntrinsicsFeature ( RunMean16x4Test , HwIntrinsics . AllowAll ) ;
73111
0 commit comments