12
12
13
13
namespace SixLabors . ImageSharp . Tests . Formats . Tiff ;
14
14
15
+ // Several of the tests in this class comparing images with associated alpha encoding use a high tolerance for comparison.
16
+ // This is due to an issue in the reference decoder where it is not correctly checking for a zero alpha component value
17
+ // before unpremultying the encoded values. This can lead to incorrect values when the rgb channels contain non-zero values.
18
+ // The tests should be manually verified following any changes to the decoder.
15
19
[ Trait ( "Format" , "Tiff" ) ]
16
20
[ ValidateDisposedMemoryAllocations ]
17
21
public class TiffDecoderTests : TiffDecoderBaseTester
@@ -205,8 +209,7 @@ public void TiffDecoder_CanDecode_12Bit_WithAssociatedAlpha<TPixel>(TestImagePro
205
209
return ;
206
210
}
207
211
208
- // Note: Using tolerant comparer here, because there is a small difference to the reference decoder probably due to floating point rounding issues.
209
- TestTiffDecoder ( provider , useExactComparer : false ) ;
212
+ TestTiffDecoder ( provider , useExactComparer : false , compareTolerance : 0.264F ) ;
210
213
}
211
214
212
215
[ Theory ]
@@ -262,8 +265,7 @@ public void TiffDecoder_CanDecode_20Bit_WithAssociatedAlpha<TPixel>(TestImagePro
262
265
return ;
263
266
}
264
267
265
- // Note: Using tolerant comparer here, because there is a small difference to the reference decoder probably due to floating point rounding issues.
266
- TestTiffDecoder ( provider , useExactComparer : false ) ;
268
+ TestTiffDecoder ( provider , useExactComparer : false , compareTolerance : 0.376F ) ;
267
269
}
268
270
269
271
[ Theory ]
@@ -289,8 +291,7 @@ public void TiffDecoder_CanDecode_24Bit_WithAssociatedAlpha<TPixel>(TestImagePro
289
291
return ;
290
292
}
291
293
292
- // Note: Using tolerant comparer here, because there is a small difference to the reference decoder probably due to floating point rounding issues.
293
- TestTiffDecoder ( provider , useExactComparer : false ) ;
294
+ TestTiffDecoder ( provider , useExactComparer : false , compareTolerance : 0.405F ) ;
294
295
}
295
296
296
297
[ Theory ]
@@ -431,8 +432,7 @@ public void TiffDecoder_CanDecode_40Bit_WithAssociatedAlpha<TPixel>(TestImagePro
431
432
return ;
432
433
}
433
434
434
- // Note: Using tolerant comparer here, because there is a small difference to the reference decoder probably due to floating point rounding issues.
435
- TestTiffDecoder ( provider , useExactComparer : false ) ;
435
+ TestTiffDecoder ( provider , useExactComparer : false , compareTolerance : 0.247F ) ;
436
436
}
437
437
438
438
[ Theory ]
@@ -470,8 +470,7 @@ public void TiffDecoder_CanDecode_48Bit_WithAssociatedAlpha<TPixel>(TestImagePro
470
470
return ;
471
471
}
472
472
473
- // Note: Using tolerant comparer here, because there is a small difference to the reference decoder probably due to floating point rounding issues.
474
- TestTiffDecoder ( provider , useExactComparer : false , compareTolerance : 0.0002f ) ;
473
+ TestTiffDecoder ( provider , useExactComparer : false , compareTolerance : 0.118F ) ;
475
474
}
476
475
477
476
[ Theory ]
@@ -500,8 +499,7 @@ public void TiffDecoder_CanDecode_56Bit_WithAssociatedAlpha<TPixel>(TestImagePro
500
499
return ;
501
500
}
502
501
503
- // Note: Using tolerant comparer here, because there is a small difference to the reference decoder probably due to floating point rounding issues.
504
- TestTiffDecoder ( provider , useExactComparer : false , compareTolerance : 0.0002f ) ;
502
+ TestTiffDecoder ( provider , useExactComparer : false , compareTolerance : 0.075F ) ;
505
503
}
506
504
507
505
[ Theory ]
0 commit comments