AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
October 2008

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2008.10.31 17:10 "Data ordering for planar config separate", by Richard Nolde
2008.10.31 17:49 "Re: Data ordering for planar config separate", by Bob Friesenhahn
2008.10.31 17:53 "Re: Data ordering for planar config separate", by Bob Friesenhahn
2008.10.31 18:51 "Re: Data ordering for planar config separate", by Richard Nolde

2008.10.31 17:10 "Data ordering for planar config separate", by Richard Nolde

  I'm updating tiffcrop (my extended version of tiffcp) to support 
images of arbitrary bit depth and I'm looking for documentation on the 
actual layout of bit planes in strips for files with multiple strips and 
multiple samples per pixel and how this affects the current routines to 
read and write images using the scanline oriented routines. I managed to 
get my code working for copying images of any bit depth from images with 
planar config == contig to planar config = contig and to planar config = 
separate and now I am trying to add support for reading images with 
planar config = separate and bit depth != a multiple of 8 bits.

  Tiffcp works for reading images with planar config == separate only if 
the bits per pixel are a multiple of 8 bits. The current code that 
merges data from separate planes into a single buffer assumes byte sized 
samples and it loops through each scanline of the image for each sample 
before moving to the next sample. I'm trying to determine if images that 
contain multiple strips for each sample can be read by interleaving the 
reads from each sample within a loop for each row of the image or 
whether that violates the random access prohibition for compressed data. 
I'd be reading sequentially within each plane, but jumping between 
planes for successive reads.  The only other alternative is to read each 
plane into a separate buffer and then combine the values into the 
combined buffer which will increase the memory requirement during the 
read phase.

eg
for (row = 0; row < length, row++)
  {
   read scanline 1 for sample 1 into buff1
   read scanline 1 for sample 2 into buff2
   read scanline 1 for sample 3 into buff3

   for (column = 0; column < width; column++)
      packdata from buff1[column], buff2[column], buff3[column] into 
combinedbuff[column]
  }


The tiffdump of my 32 bit per sample image below indicates that the 
strips are being written RRR, GGG, BBB
tiffdump /tmp/tiger-rgb-strip-planar-32.tiff
/tmp/tiger-rgb-strip-planar-32.tiff:
Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 66584 (0x10418) next 0 (0)
ImageWidth (256) SHORT (3) 1<73>
ImageLength (257) SHORT (3) 1<76>
BitsPerSample (258) SHORT (3) 3<32 32 32>
Compression (259) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<2>
DocumentName (269) ASCII (2) 30<tiger-rgb-strip-planar-3 ...>
ImageDescription (270) ASCII (2) 53< Image generated by GPL  ...>
StripOffsets (273) LONG (4) 9<8 8184 16360 22200 30376 38552 44392 52568 
60744>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<3>
RowsPerStrip (278) SHORT (3) 1<28>
StripByteCounts (279) LONG (4) 9<8176 8176 5840 8176 8176 5840 8176 8176 
5840>
XResolution (282) RATIONAL (5) 1<72>
YResolution (283) RATIONAL (5) 1<72>
PlanarConfig (284) SHORT (3) 1<2>
ResolutionUnit (296) SHORT (3) 1<1>
PageNumber (297) SHORT (3) 2<1 0>
Software (305) ASCII (2) 65<GraphicsMagick 1.3 unrel ...>
SampleFormat (339) SHORT (3) 3<1 1 1>