[babl] tests: Avoid rounding error and correct source pixels



commit db935097ce132d3fed3e8bf9e6e6ef69b9976986
Author: Martin Nordholts <martinn src gnome org>
Date:   Fri May 18 13:31:38 2012 +0200

    tests: Avoid rounding error and correct source pixels
    
    In float-to-8bit.c and "float -> u8 6", change 0.3 to 0.301 since 0.3
    / 0.6 * 255 = 127.5, so the slightest platform specific rounding error
    will give different results for u8 (127 or 128).
    
    Also correct G'a and B'a values in the third pixel to match expected
    values, the source values seems to have forgotten about
    premultiplication.

 tests/float-to-8bit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/tests/float-to-8bit.c b/tests/float-to-8bit.c
index 3ba6cb9..3634506 100644
--- a/tests/float-to-8bit.c
+++ b/tests/float-to-8bit.c
@@ -87,7 +87,7 @@ main (int    argc,
   }
 
   {
-    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.2, 0.3, 0.5, 0.6}, {0.0, 1.0, 2.0, 3.0}};
+    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.2, 0.3.01, 0.5, 0.6}, {0.0, 3.0, 6.0, 3.0}};
     unsigned char out[][4]  = {{55, 0, 0, 255 }, {85,128,212,153}, {0,255,255,255}};
 
     CHECK_CONV("float -> u8 6", unsigned char,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]