summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libtiff/libtiff/tif_luv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_luv.c')
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_luv.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_luv.c b/src/3rdparty/libtiff/libtiff/tif_luv.c
index 6fe4858..3bd02e8 100644
--- a/src/3rdparty/libtiff/libtiff/tif_luv.c
+++ b/src/3rdparty/libtiff/libtiff/tif_luv.c
@@ -193,6 +193,7 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
tmsize_t cc;
int rc;
+ (void)s;
assert(s == 0);
assert(sp != NULL);
@@ -266,6 +267,7 @@ LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
unsigned char* bp;
uint32* tp;
+ (void)s;
assert(s == 0);
assert(sp != NULL);
@@ -326,6 +328,7 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
tmsize_t cc;
int rc;
+ (void)s;
assert(s == 0);
sp = DecoderState(tif);
assert(sp != NULL);
@@ -447,6 +450,7 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
int rc=0, mask;
tmsize_t beg;
+ (void)s;
assert(s == 0);
assert(sp != NULL);
npixels = cc / sp->pixel_size;
@@ -541,6 +545,7 @@ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
uint8* op;
uint32* tp;
+ (void)s;
assert(s == 0);
assert(sp != NULL);
npixels = cc / sp->pixel_size;
@@ -598,6 +603,7 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
int rc=0, mask;
tmsize_t beg;
+ (void)s;
assert(s == 0);
assert(sp != NULL);
@@ -742,7 +748,7 @@ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
#undef exp2 /* Conflict with C'99 function */
#define exp2(x) exp(M_LN2*(x))
-static int itrunc(double x, int m)
+static int tiff_itrunc(double x, int m)
{
if( m == SGILOGENCODE_NODITHER )
return (int)x;
@@ -777,9 +783,9 @@ LogL16fromY(double Y, int em) /* get 16-bit LogL from Y */
if (Y <= -1.8371976e19)
return (0xffff);
if (Y > 5.4136769e-20)
- return itrunc(256.*(log2(Y) + 64.), em);
+ return tiff_itrunc(256.*(log2(Y) + 64.), em);
if (Y < -5.4136769e-20)
- return (~0x7fff | itrunc(256.*(log2(-Y) + 64.), em));
+ return (~0x7fff | tiff_itrunc(256.*(log2(-Y) + 64.), em));
return (0);
}
@@ -855,7 +861,7 @@ LogL10fromY(double Y, int em) /* get 10-bit LogL from Y */
else if (Y <= .00024283)
return (0);
else
- return itrunc(64.*(log2(Y) + 12.), em);
+ return tiff_itrunc(64.*(log2(Y) + 12.), em);
}
#define NANGLES 100
@@ -925,12 +931,12 @@ uv_encode(double u, double v, int em) /* encode (u',v') coordinates */
if (v < UV_VSTART)
return oog_encode(u, v);
- vi = itrunc((v - UV_VSTART)*(1./UV_SQSIZ), em);
+ vi = tiff_itrunc((v - UV_VSTART)*(1./UV_SQSIZ), em);
if (vi >= UV_NVS)
return oog_encode(u, v);
if (u < uv_row[vi].ustart)
return oog_encode(u, v);
- ui = itrunc((u - uv_row[vi].ustart)*(1./UV_SQSIZ), em);
+ ui = tiff_itrunc((u - uv_row[vi].ustart)*(1./UV_SQSIZ), em);
if (ui >= uv_row[vi].nus)
return oog_encode(u, v);
@@ -1099,7 +1105,7 @@ Luv24fromLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
else if (sp->encode_meth == SGILOGENCODE_NODITHER)
Le = (luv3[0]-3314) >> 2;
else
- Le = itrunc(.25*(luv3[0]-3314.), sp->encode_meth);
+ Le = tiff_itrunc(.25*(luv3[0]-3314.), sp->encode_meth);
Ce = uv_encode((luv3[1]+.5)/(1<<15), (luv3[2]+.5)/(1<<15),
sp->encode_meth);
@@ -1155,10 +1161,10 @@ LogLuv32fromXYZ(float XYZ[3], int em)
v = 9.*XYZ[1] / s;
}
if (u <= 0.) ue = 0;
- else ue = itrunc(UVSCALE*u, em);
+ else ue = tiff_itrunc(UVSCALE*u, em);
if (ue > 255) ue = 255;
if (v <= 0.) ve = 0;
- else ve = itrunc(UVSCALE*v, em);
+ else ve = tiff_itrunc(UVSCALE*v, em);
if (ve > 255) ve = 255;
/* combine encodings */
return (Le << 16 | ue << 8 | ve);
@@ -1238,8 +1244,8 @@ Luv32fromLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
}
while (n-- > 0) {
*luv++ = (uint32)luv3[0] << 16 |
- (itrunc(luv3[1]*(UVSCALE/(1<<15)), sp->encode_meth) << 8 & 0xff00) |
- (itrunc(luv3[2]*(UVSCALE/(1<<15)), sp->encode_meth) & 0xff);
+ (tiff_itrunc(luv3[1]*(UVSCALE/(1<<15)), sp->encode_meth) << 8 & 0xff00) |
+ (tiff_itrunc(luv3[2]*(UVSCALE/(1<<15)), sp->encode_meth) & 0xff);
luv3 += 3;
}
}