fixed output strip size to account for vertical roundup to sample factor

This commit is contained in:
Frank Warmerdam 2000-10-19 13:23:49 +00:00
parent 91b8b7c26c
commit e1f05487e9

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/tools/rgb2ycbcr.c,v 1.3 1999-12-27 17:35:01 mwelles Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/tools/rgb2ycbcr.c,v 1.4 2000-10-19 13:23:49 warmerda Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@ -241,9 +241,10 @@ cvtRaster(TIFF* tif, uint32* raster, uint32 width, uint32 height)
uint32 rwidth = roundup(width, horizSubSampling);
uint32 rheight = roundup(height, vertSubSampling);
uint32 nrows = (rowsperstrip > rheight ? rheight : rowsperstrip);
uint32 rnrows = roundup(nrows,vertSubSampling);
cc = nrows*rwidth +
2*((nrows*rwidth) / (horizSubSampling*vertSubSampling));
cc = rnrows*rwidth +
2*((rnrows*rwidth) / (horizSubSampling*vertSubSampling));
buf = (unsigned char*)_TIFFmalloc(cc);
for (y = height; (int32) y > 0; y -= nrows) {
uint32 nr = (y > nrows ? nrows : y);