summaryrefslogtreecommitdiff
path: root/src/3rdparty/libtiff/libtiff/tif_color.c
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@theqtcompany.com>2015-04-09 16:06:37 +0200
committeraavit <eirik.aavitsland@theqtcompany.com>2015-04-12 21:07:07 +0000
commita16695f45f8de7608584937d5b4df34613eb0685 (patch)
treedcd8454ded44057f9e2fdcd7cde010231e1316a6 /src/3rdparty/libtiff/libtiff/tif_color.c
parent35c968f8582783884936d9e8e8421d75c369b172 (diff)
downloadqt4-tools-a16695f45f8de7608584937d5b4df34613eb0685.tar.gz
Update bundled libtiff to version 4.0.3
This updates libtiff.pri and 3rdparty/libtiff to the current state in the Qt 5 qtimageformats module, commit c3035a1655090b0f6b194fb8a7586c013ef24f6a. The patch history relative to upstream 4.0.3 is available in that module. Change-Id: I70d278081c62ba179c5f9658a0d59313c77ba415 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_color.c')
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_color.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_color.c b/src/3rdparty/libtiff/libtiff/tif_color.c
index 0f484aa7cc..be4850ce6b 100644
--- a/src/3rdparty/libtiff/libtiff/tif_color.c
+++ b/src/3rdparty/libtiff/libtiff/tif_color.c
@@ -1,4 +1,4 @@
-/* $Id: tif_color.c,v 1.12 2006/02/09 15:42:20 dron Exp $ */
+/* $Id: tif_color.c,v 1.19 2010-12-14 02:22:42 faxguy Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -123,7 +123,7 @@ TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
*/
int
TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
- TIFFDisplay *display, float *refWhite)
+ const TIFFDisplay *display, float *refWhite)
{
int i;
double gamma;
@@ -183,13 +183,18 @@ void
TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr,
uint32 *r, uint32 *g, uint32 *b)
{
+ int32 i;
+
/* XXX: Only 8-bit YCbCr input supported for now */
Y = HICLAMP(Y, 255), Cb = CLAMP(Cb, 0, 255), Cr = CLAMP(Cr, 0, 255);
- *r = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr]];
- *g = ycbcr->clamptab[ycbcr->Y_tab[Y]
- + (int)((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT)];
- *b = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb]];
+ i = ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr];
+ *r = CLAMP(i, 0, 255);
+ i = ycbcr->Y_tab[Y]
+ + (int)((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT);
+ *g = CLAMP(i, 0, 255);
+ i = ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb];
+ *b = CLAMP(i, 0, 255);
}
/*
@@ -219,7 +224,7 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
#define LumaBlue luma[2]
clamptab = (TIFFRGBValue*)(
- (tidata_t) ycbcr+TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long)));
+ (uint8*) ycbcr+TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long)));
_TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
ycbcr->clamptab = (clamptab += 256);
for (i = 0; i < 256; i++)
@@ -273,3 +278,10 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
#undef FIX
/* vim: set ts=8 sts=8 sw=8 noet: */
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */