/* * Encode a rectangular chunk of pixels. We break it up * into row-sized pieces to insure that encoded runs do * not span rows. Otherwise, there can be problems with * the decoder if data is read, for example, by scanlines * when it was encoded by strips. */ static int PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { tsize_t rowsize = (tsize_t) tif->tif_data; assert(rowsize > 0); #ifdef YCBCR_SUPPORT /* * YCBCR data isn't really separable into rows, so we * might as well encode the whole tile/strip as one chunk. */ if( tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR ) rowsize = (tsize_t) tif->tif_data; #endif while ((long)cc > 0) { int chunk = rowsize; if( cc < chunk ) chunk = cc; if (PackBitsEncode(tif, bp, chunk, s) < 0) return (-1); bp += chunk; cc -= chunk; } return (1); }
/* * Encode a rectangular chunk of pixels. We break it up * into row-sized pieces to insure that encoded runs do * not span rows. Otherwise, there can be problems with * the decoder if data is read, for example, by scanlines * when it was encoded by strips. */ static int PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { tsize_t rowsize = (tsize_t) tif->tif_data; assert(rowsize > 0); while ((long)cc > 0) { if (PackBitsEncode(tif, bp, rowsize, s) < 0) return (-1); bp += rowsize; cc -= rowsize; } return (1); }
/* * Encode a rectangular chunk of pixels. We break it up * into row-sized pieces to insure that encoded runs do * not span rows. Otherwise, there can be problems with * the decoder if data is read, for example, by scanlines * when it was encoded by strips. */ static int PackBitsEncodeChunk(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) { tmsize_t rowsize = *(tmsize_t*)tif->tif_data; while (cc > 0) { tmsize_t chunk = rowsize; if( cc < chunk ) chunk = cc; if (PackBitsEncode(tif, bp, chunk, s) < 0) return (-1); bp += chunk; cc -= chunk; } return (1); }
/* * Encode a rectangular chunk of pixels. We break it up * into row-sized pieces to insure that encoded runs do * not span rows. Otherwise, there can be problems with * the decoder if data is read, for example, by scanlines * when it was encoded by strips. */ static int PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { tsize_t rowsize = *(tsize_t*)tif->tif_data; while ((long)cc > 0) { int chunk = rowsize; if( cc < chunk ) chunk = cc; if (PackBitsEncode(tif, bp, chunk, s) < 0) return (-1); bp += chunk; cc -= chunk; } return (1); }