1 typedef unsigned long sample
;
9 FN_MULTIPLY
, FN_DIVIDE
, FN_ADD
, FN_SUBTRACT
, FN_MIN
, FN_MAX
, FN_AND
, FN_OR
,
10 FN_XOR
, FN_NOT
, FN_SHIFTLEFT
, FN_SHIFTRIGHT
14 enum function function
;
18 unsigned int shiftCount
;
22 applyFunction (struct cmdlineInfo
const cmdline
, struct pam
const inpam
,
23 struct pam
const outpam
, tuple
* const inputRow
,
24 tuple
* const outputRow
)
26 float const oneOverDivisor
= 1 / cmdline
.u
.divisor
;
31 sample
const inSample
= inputRow
[col
][plane
];
33 switch (cmdline
.function
)
36 outSample
= ((unsigned int) ((inSample
* oneOverDivisor
) + 0.5));
39 outSample
= (inSample
<< cmdline
.u
.shiftCount
) & outpam
.maxval
;
41 outputRow
[col
][plane
] =
42 ((outpam
.maxval
) < (outSample
) ? (outpam
.maxval
) : (outSample
));