John Bowler 8c025bcf3f Simplified API sRGB gamma handling correction
If a gamma encoded file that has a gamma not matching that of sRGB is passed to
the simplified API the previous code simply interpreted it as a power law
encoding.  However old Mac files had a power law correction of 1.45 built in to
the encoding, even though the display devices were consistent with sRGB.
Assuming a power law encoding results in substantial differences in the
interpretation of low 8-bit values; below 10.  For example an Apple '5' which is
equivalent to an sRGB '17' ends up as the value '8'.

This patch provides some measure of correction for this by making the gamma
correction done within the simplified API assume that any encoded data is
encoded relative to an sRGB-like transfer function; the data is corrected back
to the PNG-nominal 2.2 value then decoded to linear (if required) using the sRGB
transfer function.

This reduces the errors reported by pngstest for such files (colormapped ones)
but still leaves the issue with files where the standard libpng code does the
gamma decoding.  To cope with the latter cases the patch also includes a new
pngstest-errors which allows the result, however this is still a
work-in-progress; a better solution is possible.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-20 20:40:52 -07:00
..
2015-09-14 17:57:40 -07:00
2015-09-14 17:31:51 -07:00
2015-09-14 17:57:40 -07:00
2015-09-14 17:31:51 -07:00
2015-09-14 17:31:51 -07:00
2011-11-16 13:35:16 -06:00

This "contrib" directory contains contributions which are not necessarily under
the libpng license, although all are open source.  They are not part of
libpng proper and are not used for building the library.