@@ -15,9 +15,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
15
15
{
16
16
public class RgbToYCbCrConverterTests
17
17
{
18
- private const float Epsilon = .5F ;
19
- private static readonly ApproximateColorSpaceComparer Comparer = new ApproximateColorSpaceComparer ( Epsilon ) ;
20
-
21
18
public RgbToYCbCrConverterTests ( ITestOutputHelper output )
22
19
{
23
20
this . Output = output ;
@@ -37,7 +34,7 @@ public void TestLutConverter()
37
34
38
35
target . Convert ( data . AsSpan ( ) , ref y , ref cb , ref cr ) ;
39
36
40
- Verify ( data , ref y , ref cb , ref cr ) ;
37
+ Verify ( data , ref y , ref cb , ref cr , new ApproximateColorSpaceComparer ( 1F ) ) ;
41
38
}
42
39
43
40
[ Fact ]
@@ -61,10 +58,10 @@ public void TestVectorizedConverter()
61
58
62
59
RgbToYCbCrConverterVectorized . Convert ( data . AsSpan ( ) , ref y , ref cb , ref cr ) ;
63
60
64
- Verify ( dataCopy , ref y , ref cb , ref cr ) ;
61
+ Verify ( dataCopy , ref y , ref cb , ref cr , new ApproximateColorSpaceComparer ( 0.0001F ) ) ;
65
62
}
66
63
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 )
68
65
{
69
66
for ( int i = 0 ; i < data . Length ; i ++ )
70
67
{
@@ -76,7 +73,7 @@ private static void Verify(ReadOnlySpan<Rgb24> data, ref Block8x8F yResult, ref
76
73
float cb = 128F + ( ( - 0.168736F * r ) - ( 0.331264F * g ) + ( 0.5F * b ) ) ;
77
74
float cr = 128F + ( ( 0.5F * r ) - ( 0.418688F * g ) - ( 0.081312F * b ) ) ;
78
75
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 ) ;
80
77
}
81
78
}
82
79
0 commit comments