| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2005.08.03 14:32 "Re: Padding", by Andrey Kiselev> My understanding based on a quick review of my own code, and a vague
> recollection is that each scanline of data is passed out to the
> nearest byte but that there is never a whole byte of passing space.
> The intent I gather is to ensure that each scanline starts on a byte
> boundary. Of course, for 8bit imagery this is already the case so
> there is no padding.
In addition there is a quote from the specification (see the Compression
tag definition):
1 = No compression, but pack data into bytes as tightly as possible leaving
no unused bits except at the end of a row.
If Then the sample values are stored
as an array of type:
BitsPerSample = 16 for all samples SHORT
BitsPerSample = 32 for all samples LONG
Otherwise BYTE
Each row is padded to the next BYTE/SHORT/LONG boundary, consistent with
the preceding BitsPerSample rule.
If the image data is stored as an array of SHORTs or LONGs, the byte
ordering must be consistent with that specified in bytes 0 and 1 of
the TIFF file header. Therefore, little-endian format files will have
the least significant bytes preceding the most significant bytes, while
big-endian format files will have the opposite order.
If the number of bits per component is not a power of 2, and you are
willing to give up some space for better performance, use the next higher
power of 2. For example, if your data can be represented in 6 bits, set
BitsPerSample to 8 instead of 6, and then convert the range of the values
from [0,63] to [0,255].
Rows must begin on byte boundaries. (SHORT boundaries if the data is
stored as SHORTs, LONG boundaries if the data is stored as LONGs).
Some graphics systems require image data rows to be word-aligned or
double-word-aligned, and padded to word-boundaries or double-word
boundaries. Uncompressed TIFF rows will need to be copied into
word-aligned or double-word-aligned row buffers before being passed to
the graphics routines in these environments.
Things become a bit more complicated in case of tiled image.
Regards,
Andrey
--
Andrey V. Kiselev
Home phone: +7 812 5970603 ICQ# 26871517
|
|||||||