Sinchronized with GDAL.
This commit is contained in:
parent
dd8c4bf8a0
commit
023cdf2a94
@ -1,5 +1,5 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* $Id: tif_overview.c,v 1.6 2004-08-08 15:32:29 dron Exp $
|
* tif_overview.c,v 1.9 2005/05/25 09:03:16 dron Exp
|
||||||
*
|
*
|
||||||
* Project: TIFF Overview Builder
|
* Project: TIFF Overview Builder
|
||||||
* Purpose: Library function for building overviews in a TIFF file.
|
* Purpose: Library function for building overviews in a TIFF file.
|
||||||
@ -53,6 +53,10 @@
|
|||||||
#include "tiffio.h"
|
#include "tiffio.h"
|
||||||
#include "tif_ovrcache.h"
|
#include "tif_ovrcache.h"
|
||||||
|
|
||||||
|
#include "cpl_port.h"
|
||||||
|
|
||||||
|
CPL_CVSID("tif_overview.c,v 1.2 2001/07/18 04:51:56 warmerda Exp");
|
||||||
|
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
# define FALSE 0
|
# define FALSE 0
|
||||||
# define TRUE 1
|
# define TRUE 1
|
||||||
@ -76,7 +80,7 @@ void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
uint32 TIFF_WriteOverview( TIFF *hTIFF, int nXSize, int nYSize,
|
uint32 TIFF_WriteOverview( TIFF *hTIFF, int nXSize, int nYSize,
|
||||||
int nBitsPerPixel, int nSamples,
|
int nBitsPerPixel, int nPlanarConfig, int nSamples,
|
||||||
int nBlockXSize, int nBlockYSize,
|
int nBlockXSize, int nBlockYSize,
|
||||||
int bTiled, int nCompressFlag, int nPhotometric,
|
int bTiled, int nCompressFlag, int nPhotometric,
|
||||||
int nSampleFormat,
|
int nSampleFormat,
|
||||||
@ -101,7 +105,7 @@ uint32 TIFF_WriteOverview( TIFF *hTIFF, int nXSize, int nYSize,
|
|||||||
if( nSamples == 1 )
|
if( nSamples == 1 )
|
||||||
TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG );
|
TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG );
|
||||||
else
|
else
|
||||||
TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_SEPARATE );
|
TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, nPlanarConfig );
|
||||||
|
|
||||||
TIFFSetField( hTIFF, TIFFTAG_BITSPERSAMPLE, nBitsPerPixel );
|
TIFFSetField( hTIFF, TIFFTAG_BITSPERSAMPLE, nBitsPerPixel );
|
||||||
TIFFSetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, nSamples );
|
TIFFSetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, nSamples );
|
||||||
@ -531,14 +535,15 @@ void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
|
|||||||
&panRedMap, &panGreenMap, &panBlueMap ) )
|
&panRedMap, &panGreenMap, &panBlueMap ) )
|
||||||
{
|
{
|
||||||
uint16 *panRed2, *panGreen2, *panBlue2;
|
uint16 *panRed2, *panGreen2, *panBlue2;
|
||||||
|
int nColorCount = 1 << nBitsPerPixel;
|
||||||
|
|
||||||
panRed2 = (uint16 *) _TIFFmalloc(2*256);
|
panRed2 = (uint16 *) _TIFFmalloc(2*nColorCount);
|
||||||
panGreen2 = (uint16 *) _TIFFmalloc(2*256);
|
panGreen2 = (uint16 *) _TIFFmalloc(2*nColorCount);
|
||||||
panBlue2 = (uint16 *) _TIFFmalloc(2*256);
|
panBlue2 = (uint16 *) _TIFFmalloc(2*nColorCount);
|
||||||
|
|
||||||
memcpy( panRed2, panRedMap, 512 );
|
memcpy( panRed2, panRedMap, 2 * nColorCount );
|
||||||
memcpy( panGreen2, panGreenMap, 512 );
|
memcpy( panGreen2, panGreenMap, 2 * nColorCount );
|
||||||
memcpy( panBlue2, panBlueMap, 512 );
|
memcpy( panBlue2, panBlueMap, 2 * nColorCount );
|
||||||
|
|
||||||
panRedMap = panRed2;
|
panRedMap = panRed2;
|
||||||
panGreenMap = panGreen2;
|
panGreenMap = panGreen2;
|
||||||
@ -575,8 +580,8 @@ void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize,
|
nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize,
|
||||||
nBitsPerPixel, nSamples,
|
nBitsPerPixel, nPlanarConfig,
|
||||||
nOBlockXSize, nOBlockYSize,
|
nSamples, nOBlockXSize, nOBlockYSize,
|
||||||
bTiled, nCompressFlag, nPhotometric,
|
bTiled, nCompressFlag, nPhotometric,
|
||||||
nSampleFormat,
|
nSampleFormat,
|
||||||
panRedMap, panGreenMap, panBlueMap,
|
panRedMap, panGreenMap, panBlueMap,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* $Id: tif_ovrcache.h,v 1.1 2000-01-28 15:03:32 warmerda Exp $
|
* tif_ovrcache.h,v 1.3 2005/05/25 09:03:16 dron Exp
|
||||||
*
|
*
|
||||||
* Project: TIFF Overview Builder
|
* Project: TIFF Overview Builder
|
||||||
* Purpose: Library functions to maintain two rows of tiles or two strips
|
* Purpose: Library functions to maintain two rows of tiles or two strips
|
||||||
@ -30,16 +30,17 @@
|
|||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
|
||||||
* $Log: tif_ovrcache.h,v $
|
|
||||||
* Revision 1.1 2000-01-28 15:03:32 warmerda
|
|
||||||
* New
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TIF_OVRCACHE_H_INCLUDED
|
#ifndef TIF_OVRCACHE_H_INCLUDED
|
||||||
#define TIF_OVRCACHE_H_INCLUDED
|
#define TIF_OVRCACHE_H_INCLUDED
|
||||||
|
|
||||||
|
#include "tiffio.h"
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32 nXSize;
|
uint32 nXSize;
|
||||||
@ -68,5 +69,25 @@ TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, int nDirOffset );
|
|||||||
unsigned char *TIFFGetOvrBlock( TIFFOvrCache *, int, int, int );
|
unsigned char *TIFFGetOvrBlock( TIFFOvrCache *, int, int, int );
|
||||||
void TIFFDestroyOvrCache( TIFFOvrCache * );
|
void TIFFDestroyOvrCache( TIFFOvrCache * );
|
||||||
|
|
||||||
|
void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
|
||||||
|
int (*)(double,void*), void * );
|
||||||
|
|
||||||
|
void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
|
||||||
|
int nOverviews, int * panOvList,
|
||||||
|
int nBitsPerPixel,
|
||||||
|
int nSamples, TIFFOvrCache ** papoRawBIs,
|
||||||
|
int nSXOff, int nSYOff,
|
||||||
|
unsigned char *pabySrcTile,
|
||||||
|
int nBlockXSize, int nBlockYSize,
|
||||||
|
int nSampleFormat, const char * pszResampling );
|
||||||
|
|
||||||
|
uint32 TIFF_WriteOverview( TIFF *, int, int, int, int, int, int, int,
|
||||||
|
int, int, int, int, unsigned short *,
|
||||||
|
unsigned short *, unsigned short *, int );
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ndef TIF_OVRCACHE_H_INCLUDED */
|
#endif /* ndef TIF_OVRCACHE_H_INCLUDED */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user