Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix roundoff error that was causing test failures and other weird res…

…ults.
  • Loading branch information...
commit bcd319cc189ea0057e3fa3951b09d6295a6fbf3c 1 parent 1f9bdb7
@lgritz lgritz authored
View
9 src/libOpenImageIO/imageio.cpp
@@ -164,10 +164,9 @@ getattribute (const std::string &name, TypeDesc type, void *val)
}
-
-int
-quantize (float value, int quant_black, int quant_white,
- int quant_min, int quant_max)
+inline int
+quantize (float value, float quant_black, float quant_white,
+ int quant_min, int quant_max)
{
value = Imath::lerp (quant_black, quant_white, value);
return Imath::clamp ((int)(value + 0.5f), quant_min, quant_max);
@@ -302,7 +301,7 @@ pvt::convert_to_float (const void *src, float *dst, int nvals,
template<typename T>
const void *
_from_float (const float *src, T *dst, size_t nvals,
- int quant_black, int quant_white, int quant_min, int quant_max)
+ float quant_black, float quant_white, int quant_min, int quant_max)
{
if (! src) {
// If no source pixels, assume zeroes
View
BIN  testsuite/oiiotool/ref/resize.tif
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.