@@ -15,9 +15,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
1515{
1616 public class RgbToYCbCrConverterTests
1717 {
18- private const float Epsilon = .5F ;
19- private static readonly ApproximateColorSpaceComparer Comparer = new ApproximateColorSpaceComparer ( Epsilon ) ;
20-
2118 public RgbToYCbCrConverterTests ( ITestOutputHelper output )
2219 {
2320 this . Output = output ;
@@ -37,7 +34,7 @@ public void TestLutConverter()
3734
3835 target . Convert ( data . AsSpan ( ) , ref y , ref cb , ref cr ) ;
3936
40- Verify ( data , ref y , ref cb , ref cr ) ;
37+ Verify ( data , ref y , ref cb , ref cr , new ApproximateColorSpaceComparer ( 1F ) ) ;
4138 }
4239
4340 [ Fact ]
@@ -61,10 +58,10 @@ public void TestVectorizedConverter()
6158
6259 RgbToYCbCrConverterVectorized . Convert ( data . AsSpan ( ) , ref y , ref cb , ref cr ) ;
6360
64- Verify ( dataCopy , ref y , ref cb , ref cr ) ;
61+ Verify ( dataCopy , ref y , ref cb , ref cr , new ApproximateColorSpaceComparer ( 0.0001F ) ) ;
6562 }
6663
67- private static void Verify ( ReadOnlySpan < Rgb24 > data , ref Block8x8F yResult , ref Block8x8F cbResult , ref Block8x8F crResult )
64+ private static void Verify ( ReadOnlySpan < Rgb24 > data , ref Block8x8F yResult , ref Block8x8F cbResult , ref Block8x8F crResult , ApproximateColorSpaceComparer comparer )
6865 {
6966 for ( int i = 0 ; i < data . Length ; i ++ )
7067 {
@@ -76,7 +73,7 @@ private static void Verify(ReadOnlySpan<Rgb24> data, ref Block8x8F yResult, ref
7673 float cb = 128F + ( ( - 0.168736F * r ) - ( 0.331264F * g ) + ( 0.5F * b ) ) ;
7774 float cr = 128F + ( ( 0.5F * r ) - ( 0.418688F * g ) - ( 0.081312F * b ) ) ;
7875
79- Assert . Equal ( new YCbCr ( y , cb , cr ) , new YCbCr ( yResult [ i ] , cbResult [ i ] , crResult [ i ] ) , Comparer ) ;
76+ Assert . Equal ( new YCbCr ( y , cb , cr ) , new YCbCr ( yResult [ i ] , cbResult [ i ] , crResult [ i ] ) , comparer ) ;
8077 }
8178 }
8279
0 commit comments