summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libtiff/libtiff/tif_strip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_strip.c')
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_strip.c115
1 files changed, 54 insertions, 61 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_strip.c b/src/3rdparty/libtiff/libtiff/tif_strip.c
index c08c60a..d7b2752 100644
--- a/src/3rdparty/libtiff/libtiff/tif_strip.c
+++ b/src/3rdparty/libtiff/libtiff/tif_strip.c
@@ -32,12 +32,12 @@
/*
* Compute which strip a (row,sample) value is in.
*/
-uint32
-TIFFComputeStrip(TIFF* tif, uint32 row, uint16 sample)
+uint32_t
+TIFFComputeStrip(TIFF* tif, uint32_t row, uint16_t sample)
{
static const char module[] = "TIFFComputeStrip";
TIFFDirectory *td = &tif->tif_dir;
- uint32 strip;
+ uint32_t strip;
strip = row / td->td_rowsperstrip;
if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
@@ -47,7 +47,7 @@ TIFFComputeStrip(TIFF* tif, uint32 row, uint16 sample)
(unsigned long) sample, (unsigned long) td->td_samplesperpixel);
return (0);
}
- strip += (uint32)sample*td->td_stripsperimage;
+ strip += (uint32_t)sample * td->td_stripsperimage;
}
return (strip);
}
@@ -55,16 +55,16 @@ TIFFComputeStrip(TIFF* tif, uint32 row, uint16 sample)
/*
* Compute how many strips are in an image.
*/
-uint32
+uint32_t
TIFFNumberOfStrips(TIFF* tif)
{
TIFFDirectory *td = &tif->tif_dir;
- uint32 nstrips;
+ uint32_t nstrips;
- nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
- TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
+ nstrips = (td->td_rowsperstrip == (uint32_t) -1 ? 1 :
+ TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
- nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel,
+ nstrips = _TIFFMultiply32(tif, nstrips, (uint32_t)td->td_samplesperpixel,
"TIFFNumberOfStrips");
return (nstrips);
}
@@ -72,12 +72,12 @@ TIFFNumberOfStrips(TIFF* tif)
/*
* Compute the # bytes in a variable height, row-aligned strip.
*/
-uint64
-TIFFVStripSize64(TIFF* tif, uint32 nrows)
+uint64_t
+TIFFVStripSize64(TIFF* tif, uint32_t nrows)
{
static const char module[] = "TIFFVStripSize64";
TIFFDirectory *td = &tif->tif_dir;
- if (nrows==(uint32)(-1))
+ if (nrows==(uint32_t)(-1))
nrows=td->td_imagelength;
if ((td->td_planarconfig==PLANARCONFIG_CONTIG)&&
(td->td_photometric == PHOTOMETRIC_YCBCR)&&
@@ -91,12 +91,12 @@ TIFFVStripSize64(TIFF* tif, uint32 nrows)
* horizontal/vertical subsampling area include
* YCbCr data for the extended image.
*/
- uint16 ycbcrsubsampling[2];
- uint16 samplingblock_samples;
- uint32 samplingblocks_hor;
- uint32 samplingblocks_ver;
- uint64 samplingrow_samples;
- uint64 samplingrow_size;
+ uint16_t ycbcrsubsampling[2];
+ uint16_t samplingblock_samples;
+ uint32_t samplingblocks_hor;
+ uint32_t samplingblocks_ver;
+ uint64_t samplingrow_samples;
+ uint64_t samplingrow_size;
if(td->td_samplesperpixel!=3)
{
TIFFErrorExt(tif->tif_clientdata,module,
@@ -125,10 +125,10 @@ TIFFVStripSize64(TIFF* tif, uint32 nrows)
return(_TIFFMultiply64(tif,nrows,TIFFScanlineSize64(tif),module));
}
tmsize_t
-TIFFVStripSize(TIFF* tif, uint32 nrows)
+TIFFVStripSize(TIFF* tif, uint32_t nrows)
{
static const char module[] = "TIFFVStripSize";
- uint64 m;
+ uint64_t m;
m=TIFFVStripSize64(tif,nrows);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -136,43 +136,36 @@ TIFFVStripSize(TIFF* tif, uint32 nrows)
/*
* Compute the # bytes in a raw strip.
*/
-uint64
-TIFFRawStripSize64(TIFF* tif, uint32 strip)
+uint64_t
+TIFFRawStripSize64(TIFF* tif, uint32_t strip)
{
static const char module[] = "TIFFRawStripSize64";
- uint64 bytecount = TIFFGetStrileByteCount(tif, strip);
+ uint64_t bytecount = TIFFGetStrileByteCount(tif, strip);
if (bytecount == 0)
{
-#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
TIFFErrorExt(tif->tif_clientdata, module,
- "%I64u: Invalid strip byte count, strip %lu",
- (unsigned __int64) bytecount,
+ "%"PRIu64": Invalid strip byte count, strip %lu",
+ (uint64_t) bytecount,
(unsigned long) strip);
-#else
- TIFFErrorExt(tif->tif_clientdata, module,
- "%llu: Invalid strip byte count, strip %lu",
- (unsigned long long) bytecount,
- (unsigned long) strip);
-#endif
- bytecount = (uint64) -1;
+ bytecount = (uint64_t) -1;
}
return bytecount;
}
tmsize_t
-TIFFRawStripSize(TIFF* tif, uint32 strip)
+TIFFRawStripSize(TIFF* tif, uint32_t strip)
{
static const char module[] = "TIFFRawStripSize";
- uint64 m;
+ uint64_t m;
tmsize_t n;
m=TIFFRawStripSize64(tif,strip);
- if (m==(uint64)(-1))
+ if (m==(uint64_t)(-1))
n=(tmsize_t)(-1);
else
{
n=(tmsize_t)m;
- if ((uint64)n!=m)
+ if ((uint64_t)n != m)
{
TIFFErrorExt(tif->tif_clientdata,module,"Integer overflow");
n=0;
@@ -189,11 +182,11 @@ TIFFRawStripSize(TIFF* tif, uint32 strip)
* truncated to reflect the actual space required
* to hold the strip.
*/
-uint64
+uint64_t
TIFFStripSize64(TIFF* tif)
{
TIFFDirectory* td = &tif->tif_dir;
- uint32 rps = td->td_rowsperstrip;
+ uint32_t rps = td->td_rowsperstrip;
if (rps > td->td_imagelength)
rps = td->td_imagelength;
return (TIFFVStripSize64(tif, rps));
@@ -202,7 +195,7 @@ tmsize_t
TIFFStripSize(TIFF* tif)
{
static const char module[] = "TIFFStripSize";
- uint64 m;
+ uint64_t m;
m=TIFFStripSize64(tif);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -213,32 +206,32 @@ TIFFStripSize(TIFF* tif)
* request is <1 then we choose a strip size according
* to certain heuristics.
*/
-uint32
-TIFFDefaultStripSize(TIFF* tif, uint32 request)
+uint32_t
+TIFFDefaultStripSize(TIFF* tif, uint32_t request)
{
return (*tif->tif_defstripsize)(tif, request);
}
-uint32
-_TIFFDefaultStripSize(TIFF* tif, uint32 s)
+uint32_t
+_TIFFDefaultStripSize(TIFF* tif, uint32_t s)
{
- if ((int32) s < 1) {
+ if ((int32_t) s < 1) {
/*
* If RowsPerStrip is unspecified, try to break the
* image up into strips that are approximately
* STRIP_SIZE_DEFAULT bytes long.
*/
- uint64 scanlinesize;
- uint64 rows;
+ uint64_t scanlinesize;
+ uint64_t rows;
scanlinesize=TIFFScanlineSize64(tif);
if (scanlinesize==0)
scanlinesize=1;
- rows=(uint64)STRIP_SIZE_DEFAULT/scanlinesize;
+ rows= (uint64_t)STRIP_SIZE_DEFAULT / scanlinesize;
if (rows==0)
rows=1;
else if (rows>0xFFFFFFFF)
rows=0xFFFFFFFF;
- s=(uint32)rows;
+ s=(uint32_t)rows;
}
return (s);
}
@@ -253,23 +246,23 @@ _TIFFDefaultStripSize(TIFF* tif, uint32 s)
* subsampling lines divided by vertical subsampling. It should thus make
* sense when multiplied by a multiple of vertical subsampling.
*/
-uint64
+uint64_t
TIFFScanlineSize64(TIFF* tif)
{
static const char module[] = "TIFFScanlineSize64";
TIFFDirectory *td = &tif->tif_dir;
- uint64 scanline_size;
+ uint64_t scanline_size;
if (td->td_planarconfig==PLANARCONFIG_CONTIG)
{
if ((td->td_photometric==PHOTOMETRIC_YCBCR)&&
(td->td_samplesperpixel==3)&&
(!isUpSampled(tif)))
{
- uint16 ycbcrsubsampling[2];
- uint16 samplingblock_samples;
- uint32 samplingblocks_hor;
- uint64 samplingrow_samples;
- uint64 samplingrow_size;
+ uint16_t ycbcrsubsampling[2];
+ uint16_t samplingblock_samples;
+ uint32_t samplingblocks_hor;
+ uint64_t samplingrow_samples;
+ uint64_t samplingrow_size;
if(td->td_samplesperpixel!=3)
{
TIFFErrorExt(tif->tif_clientdata,module,
@@ -294,7 +287,7 @@ TIFFScanlineSize64(TIFF* tif)
}
else
{
- uint64 scanline_samples;
+ uint64_t scanline_samples;
scanline_samples=_TIFFMultiply64(tif,td->td_imagewidth,td->td_samplesperpixel,module);
scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,scanline_samples,td->td_bitspersample,module),8);
}
@@ -314,7 +307,7 @@ tmsize_t
TIFFScanlineSize(TIFF* tif)
{
static const char module[] = "TIFFScanlineSize";
- uint64 m;
+ uint64_t m;
m=TIFFScanlineSize64(tif);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -325,12 +318,12 @@ TIFFScanlineSize(TIFF* tif)
* I/O size returned by TIFFScanlineSize which may be less
* if data is store as separate planes).
*/
-uint64
+uint64_t
TIFFRasterScanlineSize64(TIFF* tif)
{
static const char module[] = "TIFFRasterScanlineSize64";
TIFFDirectory *td = &tif->tif_dir;
- uint64 scanline;
+ uint64_t scanline;
scanline = _TIFFMultiply64(tif, td->td_bitspersample, td->td_imagewidth, module);
if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
@@ -344,7 +337,7 @@ tmsize_t
TIFFRasterScanlineSize(TIFF* tif)
{
static const char module[] = "TIFFRasterScanlineSize";
- uint64 m;
+ uint64_t m;
m=TIFFRasterScanlineSize64(tif);
return _TIFFCastUInt64ToSSize(tif, m, module);
}