bugfix to correctly pass size of last truncated strip data to TIFFWriteEncodedStrip

This commit is contained in:
Joris Van Damme 2006-03-25 17:52:37 +00:00
parent 993becfa19
commit 64bd1138df
2 changed files with 69 additions and 63 deletions

View File

@ -1,3 +1,8 @@
2006-03-25 Joris Van Damme <joris.at.lebbeke@skynet.be>
* contrib/addtiffo/tif_ovrcache.c: bugfix to correctly pass size
of last truncated strip data to TIFFWriteEncodedStrip
2006-03-25 Joris Van Damme <joris.at.lebbeke@skynet.be>
* libtiff/{tif_jpeg.c, tif_strip.c}: bugfix of tif_jpeg decode raw

View File

@ -1,5 +1,5 @@
/******************************************************************************
* $Id: tif_ovrcache.c,v 1.6 2005-12-21 12:23:13 joris Exp $
* $Id: tif_ovrcache.c,v 1.7 2006-03-25 17:52:37 joris Exp $
*
* Project: TIFF Overview Builder
* Purpose: Library functions to maintain two rows of tiles or two strips
@ -137,7 +137,8 @@ static void TIFFWriteOvrRow( TIFFOvrCache * psCache )
int nRet, iTileX, iTileY = psCache->nBlockOffset;
unsigned char *pabyData;
uint32 nBaseDirOffset;
uint32 RowsInStrip;
/* -------------------------------------------------------------------- */
/* If the output cache is multi-byte per sample, and the file */
/* being written to is of a different byte order than the current */
@ -169,72 +170,72 @@ static void TIFFWriteOvrRow( TIFFOvrCache * psCache )
/* -------------------------------------------------------------------- */
/* Write blocks to TIFF file. */
/* -------------------------------------------------------------------- */
for( iTileX = 0; iTileX < psCache->nBlocksPerRow; iTileX++ )
{
int nTileID;
for( iTileX = 0; iTileX < psCache->nBlocksPerRow; iTileX++ )
{
int nTileID;
if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
{
int iSample;
if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
{
int iSample;
for( iSample = 0; iSample < psCache->nSamples; iSample++ )
{
pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, iSample );
for( iSample = 0; iSample < psCache->nSamples; iSample++ )
{
pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, iSample );
if( psCache->bTiled )
{
nTileID =
TIFFComputeTile( psCache->hTIFF,
iTileX * psCache->nBlockXSize,
iTileY * psCache->nBlockYSize,
0, (tsample_t) iSample );
TIFFWriteEncodedTile( psCache->hTIFF, nTileID,
pabyData,
TIFFTileSize(psCache->hTIFF) );
}
else
{
nTileID =
TIFFComputeStrip( psCache->hTIFF,
iTileY * psCache->nBlockYSize,
(tsample_t) iSample );
if( psCache->bTiled )
{
nTileID = TIFFComputeTile( psCache->hTIFF,
iTileX * psCache->nBlockXSize,
iTileY * psCache->nBlockYSize,
0, (tsample_t) iSample );
TIFFWriteEncodedTile( psCache->hTIFF, nTileID,
pabyData,
TIFFTileSize(psCache->hTIFF) );
}
else
{
nTileID = TIFFComputeStrip( psCache->hTIFF,
iTileY * psCache->nBlockYSize,
(tsample_t) iSample );
RowsInStrip=psCache->nBlockYSize;
if ((iTileY+1)*psCache->nBlockYSize>psCache->nYSize)
RowsInStrip=psCache->nYSize-iTileY*psCache->nBlockYSize;
TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
pabyData,
TIFFVStripSize(psCache->hTIFF,RowsInStrip) );
}
}
TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
pabyData,
TIFFStripSize(psCache->hTIFF) );
}
}
}
else
{
pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, 0 );
}
else
{
pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, 0 );
if( psCache->bTiled )
{
nTileID =
TIFFComputeTile( psCache->hTIFF,
iTileX * psCache->nBlockXSize,
iTileY * psCache->nBlockYSize,
0, 0 );
TIFFWriteEncodedTile( psCache->hTIFF, nTileID,
pabyData,
TIFFTileSize(psCache->hTIFF) );
}
else
{
nTileID =
TIFFComputeStrip( psCache->hTIFF,
iTileY * psCache->nBlockYSize,
0 );
TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
pabyData,
TIFFStripSize(psCache->hTIFF) );
}
}
}
/* TODO: add checks on error status return of TIFFWriteEncodedTile and TIFFWriteEncodedStrip */
if( psCache->bTiled )
{
nTileID = TIFFComputeTile( psCache->hTIFF,
iTileX * psCache->nBlockXSize,
iTileY * psCache->nBlockYSize,
0, 0 );
TIFFWriteEncodedTile( psCache->hTIFF, nTileID,
pabyData,
TIFFTileSize(psCache->hTIFF) );
}
else
{
nTileID = TIFFComputeStrip( psCache->hTIFF,
iTileY * psCache->nBlockYSize,
0 );
RowsInStrip=psCache->nBlockYSize;
if ((iTileY+1)*psCache->nBlockYSize>psCache->nYSize)
RowsInStrip=psCache->nYSize-iTileY*psCache->nBlockYSize;
TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
pabyData,
TIFFVStripSize(psCache->hTIFF,RowsInStrip) );
}
}
}
/* TODO: add checks on error status return of TIFFWriteEncodedTile and TIFFWriteEncodedStrip */
/* -------------------------------------------------------------------- */
/* Rotate buffers. */