diff options
author | scuri <scuri> | 2008-11-18 20:38:20 +0000 |
---|---|---|
committer | scuri <scuri> | 2008-11-18 20:38:20 +0000 |
commit | fe2133a967f4fd3ddf007c4b2f6cdf457d556b08 (patch) | |
tree | 57db7ee1c088eb9a861bc249b2d80b04771f552e /src | |
parent | 950d6181e32222c659df5720752dc43f0e92b8b6 (diff) |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/im_converttype.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/im_converttype.cpp b/src/im_converttype.cpp index c8816ef..0c3d801 100644 --- a/src/im_converttype.cpp +++ b/src/im_converttype.cpp @@ -2,7 +2,7 @@ * \brief Image Data Type Conversion * * See Copyright Notice in im_lib.h - * $Id: im_converttype.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_converttype.cpp,v 1.2 2008/11/18 20:38:21 scuri Exp $ */ #include "im.h" @@ -314,6 +314,9 @@ int iDemoteReal2Int(int count, const float *src_map, DSTT *dst_map, float gamma, else value = (*src_map++ - min)/range; + if (i==3603) + i=i; + // Now 0 <= value <= 1 (if min-max are correct) if (value >= 1) @@ -323,9 +326,10 @@ int iDemoteReal2Int(int count, const float *src_map, DSTT *dst_map, float gamma, else { value = iGammaFunc(factor, (float)dst_min, gamma, value); - if (value >= dst_max) + int ivalue = imRound(value); + if (ivalue >= dst_max) *dst_map++ = dst_max; - else if (value <= dst_min) + else if (ivalue <= dst_min) *dst_map++ = dst_min; else *dst_map++ = (DSTT)imRound(value - 0.5f); |