Aha, good catch! I will merge and backport this.
-- lg
On Jul 12, 2012, at 6:56 AM, Ramon Montoya Vozmediano wrote:
> Hi,
>
> Some Arnold users have been running into problems when resizing 8b or 16b
> images using maketx.
>
> This change in ./src/libOpenImageIO/imageio.cpp fixes the issue:
>
> quantize (float value, int quant_black, int quant_white,
> int quant_min, int quant_max)
> {
> - value = Imath::lerp (quant_black, quant_white, value);
> + value = Imath::lerp ((float)quant_black, (float)quant_white, value);
> return Imath::clamp ((int)(value + 0.5f), quant_min, quant_max);
> }
>
> Imath::lerp lerps a float value between the int values 0 and 255, but returns
> a truncated int result. It's this step causes the problem, since rather than
> choosing the closest quantization step the code was always choosing the
> smaller one.
>
> This was causing white fields to become just almost white after the resize
> step in maketx.
>
> The pull request is here:
>
> https://github.com/OpenImageIO/oiio/pull/400
>
> Best,
>
> r
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org