|
|
|
@ -11,6 +11,35 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP |
|
|
|
[Trait("Format", "Webp")] |
|
|
|
public class LossyUtilsTests |
|
|
|
{ |
|
|
|
private static void RunVp8Sse4X4Test() |
|
|
|
{ |
|
|
|
byte[] a = |
|
|
|
{ |
|
|
|
27, 27, 28, 29, 29, 28, 27, 27, 27, 28, 28, 29, 29, 28, 28, 27, 129, 129, 129, 129, 129, 129, 129, |
|
|
|
129, 128, 128, 128, 128, 128, 128, 128, 128, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 29, 29, 28, |
|
|
|
28, 27, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 27, 27, 26, |
|
|
|
26, 26, 26, 27, 27, 27, 28, 28, 29, 29, 28, 28, 27, 129, 129, 129, 129, 129, 129, 129, 129, 128, |
|
|
|
128, 128, 128, 128, 128, 128, 128, 28, 27, 27, 26, 26, 27, 27, 28, 27, 28, 28, 29, 29, 28, 28, 27, |
|
|
|
129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128 |
|
|
|
}; |
|
|
|
|
|
|
|
byte[] b = |
|
|
|
{ |
|
|
|
26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 204, 204, 204, 204, 204, 204, 204, |
|
|
|
204, 204, 204, 204, 204, 204, 204, 204, 204, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
|
|
|
28, 28, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 26, 26, 26, |
|
|
|
26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 204, 204, 204, 204, 204, 204, 204, 204, 204, |
|
|
|
204, 204, 204, 204, 204, 204, 204, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |
|
|
|
204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204 |
|
|
|
}; |
|
|
|
|
|
|
|
int expected = 27; |
|
|
|
|
|
|
|
int actual = LossyUtils.Vp8_Sse4X4(a, b); |
|
|
|
|
|
|
|
Assert.Equal(expected, actual); |
|
|
|
} |
|
|
|
|
|
|
|
private static void RunMean16x4Test() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
@ -61,6 +90,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP |
|
|
|
Assert.Equal(expected, actual); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Vp8Sse4X4_Works() => RunVp8Sse4X4Test(); |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Mean16x4_Works() => RunMean16x4Test(); |
|
|
|
|
|
|
|
@ -68,6 +100,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP |
|
|
|
public void HadamardTransform_Works() => RunHadamardTransformTest(); |
|
|
|
|
|
|
|
#if SUPPORTS_RUNTIME_INTRINSICS
|
|
|
|
[Fact] |
|
|
|
public void Vp8Sse4X4_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunVp8Sse4X4Test, HwIntrinsics.AllowAll); |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Vp8Sse4X4_WithoutHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunVp8Sse4X4Test, HwIntrinsics.DisableHWIntrinsic); |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Mean16x4_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunMean16x4Test, HwIntrinsics.AllowAll); |
|
|
|
|
|
|
|
|