[IPOL discuss] libpng
Miguel Colom
Miguel.Colom at cmla.ens-cachan.fr
Mon Jul 25 21:35:55 CEST 2011
> I think there may have a bug in the 'io_png.c' file provided on IPOL.
> while (ptr_gray < ptr_end)
>> *ptr_gray++ = (unsigned char) ((6969.f * *ptr_r++
>> + 23434.f * *ptr_g++
>> + 2365.f * *ptr_b++) /
>> 32768.f);
Indeed, I think that to be 100% correct we should apply a round() function
before the (unsigned char) cast to avoid just truncating the value instead
of rounding it to the nearest integer.
Best,
Miguel
More information about the discuss
mailing list