From ffcb1453bce751e315fb422f667e2e61a1137d40 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Mon, 5 Mar 2018 01:09:39 +0000 Subject: clarify applicable standard, add more precision git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3164 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/pm_gamma.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/pm_gamma.h') diff --git a/lib/pm_gamma.h b/lib/pm_gamma.h index 3c48e52e..00d551fc 100644 --- a/lib/pm_gamma.h +++ b/lib/pm_gamma.h @@ -15,13 +15,23 @@ extern "C" { static __inline__ float pm_gamma709(float const intensity) { - /* Here are parameters of the gamma transfer function - for the Netpbm formats. This is CIE Rec 709. + /* Here are parameters of the gamma transfer function for the Netpbm + formats. This is ITU-R Recommendation BT.709, FKA CIE Rec 709. It is + also ITU-R Recommendation BT.601, FKA CCIR 601. This transfer function is linear for sample values 0 .. .018 and an exponential for larger sample values. The exponential is slightly stretched and translated, though, unlike the popular pure exponential gamma transfer function. + + The standard actually defines the linear expansion as 4.500, which + means there is a discontinuity at linear intensity .018. We instead + use ~4.514 to make a continuous function. This may have been simply + a mistake when this code was written or based on an actual benefit + to having a continuous function -- The history is not clear. + + Note that the discrepancy is below the precision of a maxval 255 + image. */ float const gamma = 2.2; float const oneOverGamma = 1.0 / gamma; -- cgit 1.4.1