
Christian Henning wrote:
As far as I can tell tiff needs the row number to be read and also tiff rows cannot be read in random order. Jpeg also needs to be read in order which means there is no skipping.
Now, because of that and to ensure a common interface among all scanline_readers I need to pass the pos into the skip function.
Seems like all the more reason to manage the line counter internally to the TIFF reader. Nothing else afaik needs it as it's implicit in the other readers. And you need to have a detailed knowledge of the internal state of the tiff reader in order to pass in any correct value. Mateusz Loskot wrote:
It's not precise, because rows of some TIFFs can be accessed in random order. The spec confirms that too:
"random access to individual scanlines can only be provided when data is not stored in a compressed format, or when the number of rows in a strip of image data is set to one (RowsPerStrip is one)."
Even more of a reason if certain tiff formats get efficiency boosts by managing skips differently (noops for uncompressed, reads for compressed).