AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2017.05.11 17:35 "[Tiff] JPEG compressed RGB tiled TIFF with chroma subsampling", by Yakov Galka
[...]
2017.05.22 19:18 "Re: [Tiff] JPEG compressed RGB tiled TIFF with chroma subsampling", by Roger Leigh
2017.05.22 19:42 "Re: [Tiff] JPEG compressed RGB tiled TIFF with chroma subsampling", by Yakov Galka
[...]

2017.05.22 19:42 "Re: [Tiff] JPEG compressed RGB tiled TIFF with chroma subsampling", by Yakov Galka

On Mon, May 22, 2017 at 10:18 PM, Roger Leigh <rleigh@codelibre.net> wrote:

IIRC the main problem is the buffer packing arrangement for strips vs tiles when using an image size which isn't a multiple of 16. Tiles would overlap the image bounds on the x axis by sizex%16 unused pixels per row, but strips are contiguous runs. And then there's the special casing for bitspersample when it's not a multiple of 8. I recall this being incompletely specified in the 6.0 spec; I ended up packing the buffer according to what libtiff handled, and what other software seemed to expect as well.

I'm not aware of the bitspersample issue you mention, but as for images of size not divisible by 16 there's no problem:

The restriction of TileWidth % 16 == 0 is still on the responsibility of the party creating the TIFF. When you create it you obviously have to specify whether you want a tiled one or a striped one, and if it's the former then you have to choose a tile size that satisfies the constraints. As for the readers, they don't care for when that "TileWidth" happens to be not a multiple of 16.

I used to implement wrappers TIFFRead/WriteBlock(...), TIFFComputeBlock(...) etc which call into the *Strip() or *Tlie() interface as appropriate. It worked well, and the only catch was that the last strip in a striped TIFF can be smaller than the declared size, whereas tiles are always encoded in their entirety. But this case can also easily be handled.

--
Yakov Galka
http://stannum.co.il/