tiff output: several fixes

- add TIFFTAG_SAMPLESPERPIXEL tag to avoid possible confusion in readers
- cast all values to their correct type as documented in
  http://www.awaresystems.be/imaging/tiff/tifftags/search.html
  this should fix BE archs as writing a uint16_t written as 32 or 64bit
  value would have always resulted in a 0 value being interpreted if
  varargs use the stack
- fix a bug where last strip was never written for 32bit
  (spotted w/ enfuse)
- factored the stripe allocation logic
- make 8/16/32 bit codepath similar enough to just differ by the used
  pointer type
- add proper error path for OOM conditions and tif opening failure

NB: enfuse still creates pure white images from dt float tiff :-(