From 160db7518867b15be982cd2ac54bb827f76bcc86 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 13 Dec 2020 22:57:43 +0000 Subject: Fix comments git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4005 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/pam.h | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/lib/pam.h b/lib/pam.h index 5edc8a01..aebf529a 100644 --- a/lib/pam.h +++ b/lib/pam.h @@ -220,33 +220,6 @@ struct pamtuples { }; -typedef float * pnm_transformMap; - /* This is an array of transform maps. transform[N] is the - array that is the map for Plane N. - - Transform maps define a transformation between PAM sample value - to normalized libnetpbm "samplen" value, i.e. what you get back - from pnm_readpamrown() or pass to pnm_writepamrown(). - Typically, it's a gamma transfer function generated by - pnm_creategammatransform() or pnm_createungammatransform(). - - NULL for any transform means just plain normalization -- divide - the PAM sample value by the maxval to get the samplen, multiply - samplen by the maxval and round to get PAM sample value. - - NULL for map table, or 'transform' member not present (pam - structure is too small to contain it) means ALL transforms - are plain normalization. - - Each transform map is an array indexed by a PAM sample - value, containing 'float' values. So it must have 'maxval' - entries. The sample -> samplen transformation is just the - obvious table lookup. The samplen -> sample transformation is - more complicated -- if the samplen value is between map[N] - and map[N+1], then the sample value is N. And only transforms - where map[N+1] > map[N] are allowed. - */ - /* Declarations of library functions. */ /* We don't have a specific PAM function for init and nextimage, because @@ -438,6 +411,21 @@ void pnm_writepamn(struct pam * const pamP, tuplen ** const tuplenarray); +typedef samplen * pnm_transformMap; + /* This defines a transformation between PAM sample value + to normalized libnetpbm "samplen" value, i.e. what you get back + from pnm_readpamrown() or pass to pnm_writepamrown(). + Typically, it's a gamma transfer function generated by + pnm_creategammatransform() or pnm_createungammatransform(). + + It is an array indexed by a PAM sample value, containing 'float' + values. So it must have 'maxval' entries. The sample -> samplen + transformation is just the obvious table lookup. The samplen -> sample + transformation is more complicated -- if the samplen value is between + map[N] and map[N+1], then the sample value is N. And only transforms + where map[N+1] > map[N] are allowed. + */ + samplen pnm_normalized_sample(struct pam * const pamP, sample const sample); -- cgit 1.4.1