Revision: 56390
          http://sourceforge.net/p/brlcad/code/56390
Author:   mohitdaga
Date:     2013-07-31 18:47:39 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
Sanitize the conversion from double to unsigned char. Instead of floor which 
can introduce a error upto a difference of 2 intensities, adapt a more robust 
conversion where it rounds off to nearest integer.

Modified Paths:
--------------
    brlcad/trunk/src/libicv/fileformat.c

Modified: brlcad/trunk/src/libicv/fileformat.c
===================================================================
--- brlcad/trunk/src/libicv/fileformat.c        2013-07-31 18:43:54 UTC (rev 
56389)
+++ brlcad/trunk/src/libicv/fileformat.c        2013-07-31 18:47:39 UTC (rev 
56390)
@@ -164,7 +164,7 @@
 
     if (ZERO(bif->gamma_corr)) {
        for (i=0; i<size; i++) {
-           *char_p = (unsigned char)floor((*double_p)*255.0);
+           *char_p = (unsigned char)((*double_p)*255.0 +0.5) ;
            char_p++;
            double_p++;
        }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to