updated libtiff to 3.9.5 (ticket #1271)

This commit is contained in:
Vadim Pisarevsky 2011-08-03 07:51:40 +00:00
parent c8378fa4c4
commit 217f345e66
15 changed files with 227 additions and 140 deletions

View File

@ -1,4 +1,4 @@
/* $Id: tif_color.c,v 1.12.2.1 2010-06-08 18:50:41 bfriesen Exp $ */
/* $Id: tif_color.c,v 1.12.2.2 2010-12-14 02:23:09 faxguy Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -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);
}
/*

View File

@ -1,4 +1,4 @@
/* $Id: tif_dir.c,v 1.75.2.5 2010-06-09 21:15:27 bfriesen Exp $ */
/* $Id: tif_dir.c,v 1.75.2.6 2010-07-02 09:49:23 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -163,7 +163,9 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
* work in with its normal work.
*/
if (tif->tif_flags & TIFF_SWAB) {
if (td->td_bitspersample == 16)
if (td->td_bitspersample == 8)
tif->tif_postdecode = _TIFFNoPostDecode;
else if (td->td_bitspersample == 16)
tif->tif_postdecode = _TIFFSwab16BitData;
else if (td->td_bitspersample == 24)
tif->tif_postdecode = _TIFFSwab24BitData;

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirread.c,v 1.92.2.9 2010-06-14 00:21:46 fwarmerdam Exp $ */
/* $Id: tif_dirread.c,v 1.92.2.15 2010-12-31 16:12:40 olivier Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -54,7 +54,7 @@ static float TIFFFetchRational(TIFF*, TIFFDirEntry*);
static int TIFFFetchNormalTag(TIFF*, TIFFDirEntry*);
static int TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, uint16*);
static int TIFFFetchPerSampleLongs(TIFF*, TIFFDirEntry*, uint32*);
static int TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*);
static int TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*, double*);
static int TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*);
static int TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**);
static int TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*);
@ -83,6 +83,7 @@ TIFFReadDirectory(TIFF* tif)
const TIFFFieldInfo* fip;
size_t fix;
uint16 dircount;
uint16 previous_tag = 0;
int diroutoforderwarning = 0, compressionknown = 0;
int haveunknowntags = 0;
@ -105,7 +106,20 @@ TIFFReadDirectory(TIFF* tif)
tif->tif_name, tif->tif_nextdiroff);
return 0;
}
{
TIFFDirEntry* ma;
uint16 mb;
for (ma=dir, mb=0; mb<dircount; ma++, mb++)
{
TIFFDirEntry* na;
uint16 nb;
for (na=ma+1, nb=mb+1; nb<dircount; na++, nb++)
{
if (ma->tdir_tag==na->tdir_tag)
na->tdir_tag=IGNORE;
}
}
}
tif->tif_flags &= ~TIFF_BEENWRITING; /* reset before new dir */
/*
* Setup default value and then make a pass over
@ -163,23 +177,24 @@ TIFFReadDirectory(TIFF* tif)
if (dp->tdir_tag == IGNORE)
continue;
if (fix >= tif->tif_nfields)
fix = 0;
/*
* Silicon Beach (at least) writes unordered
* directory tags (violating the spec). Handle
* it here, but be obnoxious (maybe they'll fix it?).
*/
if (dp->tdir_tag < tif->tif_fieldinfo[fix]->field_tag) {
if (dp->tdir_tag < previous_tag) {
if (!diroutoforderwarning) {
TIFFWarningExt(tif->tif_clientdata, module,
"%s: invalid TIFF directory; tags are not sorted in ascending order",
tif->tif_name);
diroutoforderwarning = 1;
}
fix = 0; /* O(n^2) */
}
previous_tag = dp->tdir_tag;
if (fix >= tif->tif_nfields ||
dp->tdir_tag < tif->tif_fieldinfo[fix]->field_tag)
fix = 0; /* O(n^2) */
while (fix < tif->tif_nfields &&
tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
fix++;
@ -465,11 +480,18 @@ TIFFReadDirectory(TIFF* tif)
}
break;
case TIFFTAG_SMINSAMPLEVALUE:
{
double minv = 0.0, maxv = 0.0;
if (!TIFFFetchPerSampleAnys(tif, dp, &minv, &maxv) ||
!TIFFSetField(tif, dp->tdir_tag, minv))
goto bad;
}
break;
case TIFFTAG_SMAXSAMPLEVALUE:
{
double dv = 0.0;
if (!TIFFFetchPerSampleAnys(tif, dp, &dv) ||
!TIFFSetField(tif, dp->tdir_tag, dv))
double minv = 0.0, maxv = 0.0;
if (!TIFFFetchPerSampleAnys(tif, dp, &minv, &maxv) ||
!TIFFSetField(tif, dp->tdir_tag, maxv))
goto bad;
}
break;
@ -593,8 +615,7 @@ TIFFReadDirectory(TIFF* tif)
}
if (!TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))
{
if ((td->td_photometric==PHOTOMETRIC_RGB)
|| (td->td_photometric==PHOTOMETRIC_YCBCR))
if (td->td_photometric==PHOTOMETRIC_RGB)
{
TIFFWarningExt(tif->tif_clientdata,
"TIFFReadDirectory",
@ -603,13 +624,22 @@ TIFFReadDirectory(TIFF* tif)
if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,3))
goto bad;
}
else if ((td->td_photometric==PHOTOMETRIC_MINISWHITE)
|| (td->td_photometric==PHOTOMETRIC_MINISBLACK))
if (td->td_photometric==PHOTOMETRIC_YCBCR)
{
TIFFWarningExt(tif->tif_clientdata,
"TIFFReadDirectory",
"SamplesPerPixel tag is missing, "
"assuming correct SamplesPerPixel value is 1");
"applying correct SamplesPerPixel value of 3");
if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,3))
goto bad;
}
else if ((td->td_photometric==PHOTOMETRIC_MINISWHITE)
|| (td->td_photometric==PHOTOMETRIC_MINISBLACK))
{
/*
* SamplesPerPixel tag is missing, but is not required
* by spec. Assume correct SamplesPerPixel value of 1.
*/
if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,1))
goto bad;
}
@ -620,8 +650,14 @@ TIFFReadDirectory(TIFF* tif)
*/
if (td->td_photometric == PHOTOMETRIC_PALETTE &&
!TIFFFieldSet(tif, FIELD_COLORMAP)) {
MissingRequired(tif, "Colormap");
goto bad;
if ( tif->tif_dir.td_bitspersample>=8 && tif->tif_dir.td_samplesperpixel==3)
tif->tif_dir.td_photometric = PHOTOMETRIC_RGB;
else if (tif->tif_dir.td_bitspersample>=8)
tif->tif_dir.td_photometric = PHOTOMETRIC_MINISBLACK;
else {
MissingRequired(tif, "Colormap");
goto bad;
}
}
/*
* OJPEG hack:
@ -1086,6 +1122,7 @@ CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
"incorrect count for field \"%s\" (%u, expecting %u); tag trimmed",
_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
dir->tdir_count, count);
dir->tdir_count = count;
return (1);
}
return (1);
@ -1420,7 +1457,7 @@ TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)
case TIFF_SHORT:
case TIFF_SSHORT:
{
uint16 v[2]={0,0};
uint16 v[2];
return TIFFFetchShortArray(tif, dir, v)
&& TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);
}
@ -1822,11 +1859,11 @@ TIFFFetchPerSampleLongs(TIFF* tif, TIFFDirEntry* dir, uint32* pl)
}
/*
* Fetch samples/pixel ANY values for the specified tag and verify that all
* values are the same.
* Fetch samples/pixel ANY values for the specified tag and returns their min
* and max.
*/
static int
TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)
TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* minv, double* maxv)
{
uint16 samples = tif->tif_dir.td_samplesperpixel;
int status = 0;
@ -1844,17 +1881,16 @@ TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)
if( samples < check_count )
check_count = samples;
*minv = *maxv = v[0];
for (i = 1; i < check_count; i++)
if (v[i] != v[0]) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Cannot handle different per-sample values for field \"%s\"",
_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
goto bad;
}
*pl = v[0];
{
if (v[i] < *minv)
*minv = v[i];
if (v[i] > *maxv)
*maxv = v[i];
}
status = 1;
}
bad:
if (v && v != buf)
_TIFFfree(v);
}

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirwrite.c,v 1.37.2.7 2010-06-08 18:50:42 bfriesen Exp $ */
/* $Id: tif_dirwrite.c,v 1.37.2.9 2011-02-25 15:28:30 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -42,6 +42,7 @@ extern void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);
static int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);
static void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);
static void TIFFSetupShort(TIFF*, ttag_t, TIFFDirEntry*, uint16);
static int TIFFSetupBytePair(TIFF*, ttag_t, TIFFDirEntry*);
static int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);
static int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);
static int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);
@ -291,12 +292,6 @@ _TIFFWriteDirectory(TIFF* tif, int done)
_TIFFSampleToTagType(tif), fip->field_tag, dir))
goto bad;
break;
case FIELD_PAGENUMBER:
case FIELD_HALFTONEHINTS:
case FIELD_YCBCRSUBSAMPLING:
if (!TIFFSetupShortPair(tif, fip->field_tag, dir))
goto bad;
break;
case FIELD_INKNAMES:
if (!TIFFWriteInkNames(tif, dir))
goto bad;
@ -336,12 +331,22 @@ _TIFFWriteDirectory(TIFF* tif, int done)
}
break;
default:
/* XXX: Should be fixed and removed. */
if (fip->field_tag == TIFFTAG_DOTRANGE) {
if (!TIFFSetupShortPair(tif, fip->field_tag, dir))
goto bad;
}
else if (!TIFFWriteNormalTag(tif, dir, fip))
/*
* XXX: Should be fixed and removed. See comments
* related to these tags in tif_dir.c.
*/
if (fip->field_tag == TIFFTAG_PAGENUMBER
|| fip->field_tag == TIFFTAG_HALFTONEHINTS
|| fip->field_tag == TIFFTAG_YCBCRSUBSAMPLING
|| fip->field_tag == TIFFTAG_DOTRANGE) {
if (fip->field_type == TIFF_BYTE) {
if (!TIFFSetupBytePair(tif, fip->field_tag, dir))
goto bad;
} else if (fip->field_type == TIFF_SHORT) {
if (!TIFFSetupShortPair(tif, fip->field_tag, dir))
goto bad;
}
} else if (!TIFFWriteNormalTag(tif, dir, fip))
goto bad;
break;
}
@ -875,6 +880,23 @@ TIFFWritePerSampleAnys(TIFF* tif,
}
#undef NITEMS
/*
* Setup a pair of bytes that are returned by
* value, rather than as a reference to an array.
*/
static int
TIFFSetupBytePair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
{
char v[2];
TIFFGetField(tif, tag, &v[0], &v[1]);
dir->tdir_tag = (uint16) tag;
dir->tdir_type = (uint16) TIFF_BYTE;
dir->tdir_count = 2;
return (TIFFWriteByteArray(tif, dir, v));
}
/*
* Setup a pair of shorts that are returned by
* value, rather than as a reference to an array.
@ -1019,7 +1041,7 @@ TIFFWriteRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)
while (fv < 1L<<(31-3) && den < 1L<<(31-3))
fv *= 1<<3, den *= 1L<<3;
}
t[2*i+0] = (uint32) (sign * (fv + 0.5));
t[2*i+0] = (uint32) (sign * (int32)(fv + 0.5));
t[2*i+1] = den;
}
status = TIFFWriteData(tif, dir, (char *)t);

View File

@ -1,4 +1,4 @@
/* $Id: tif_fax3.h,v 1.5.2.1 2010-06-08 18:50:42 bfriesen Exp $ */
/* $Id: tif_fax3.h,v 1.5.2.3 2011-03-10 20:22:33 fwarmerdam Exp $ */
/*
* Copyright (c) 1990-1997 Sam Leffler
@ -478,6 +478,12 @@ done1d: \
break; \
case S_VL: \
CHECK_b1; \
if (b1 <= (int) (a0 + TabEnt->Param)) { \
if (b1 < (int) (a0 + TabEnt->Param) || pa != thisrun) { \
unexpected("VL", a0); \
goto eol2d; \
} \
} \
SETVALUE(b1 - a0 - TabEnt->Param); \
b1 -= *--pb; \
break; \

View File

@ -1,4 +1,4 @@
/* $Id: tif_getimage.c,v 1.63.2.4 2010-06-08 18:50:42 bfriesen Exp $ */
/* $Id: tif_getimage.c,v 1.63.2.6 2010-07-02 13:38:27 dron Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@ -1846,6 +1846,7 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
{
uint32* cp2;
int32 incr = 2*toskew+w;
(void) y;
fromskew = (fromskew / 2) * 6;
cp2 = cp+w+toskew;
@ -1872,8 +1873,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
cp2 ++ ;
pp += 6;
}
cp += toskew*2+w;
cp2 += toskew*2+w;
cp += incr;
cp2 += incr;
pp += fromskew;
h-=2;
}
@ -1939,6 +1940,7 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
DECLAREContigPutFunc(putcontig8bitYCbCr12tile)
{
uint32* cp2;
int32 incr = 2*toskew+w;
(void) y;
fromskew = (fromskew / 2) * 4;
cp2 = cp+w+toskew;
@ -1953,8 +1955,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr12tile)
cp2 ++;
pp += 4;
} while (--x);
cp += toskew*2+w;
cp2 += toskew*2+w;
cp += incr;
cp2 += incr;
pp += fromskew;
h-=2;
}
@ -2397,7 +2399,7 @@ PickContigCase(TIFFRGBAImage* img)
}
break;
case PHOTOMETRIC_YCBCR:
if (img->bitspersample == 8)
if ((img->bitspersample==8) && (img->samplesperpixel==3))
{
if (initYCbCrConversion(img)!=0)
{

View File

@ -1,4 +1,4 @@
/* $Id: tif_jpeg.c,v 1.50.2.9 2010-06-14 02:47:16 fwarmerdam Exp $ */
/* $Id: tif_jpeg.c,v 1.50.2.17 2011-01-04 02:51:17 faxguy Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@ -988,8 +988,15 @@ JPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
tsize_t nrows;
(void) s;
/* data is expected to be read in multiples of a scanline */
if ( (nrows = sp->cinfo.d.image_height) ) {
nrows = cc / sp->bytesperline;
if (cc % sp->bytesperline)
TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read");
if( nrows > (int) sp->cinfo.d.image_height )
nrows = sp->cinfo.d.image_height;
/* data is expected to be read in multiples of a scanline */
if (nrows) {
/* Cb,Cr both have sampling factors 1, so this is correct */
JDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width;
int samples_per_clump = sp->samplesperclump;
@ -1064,7 +1071,7 @@ JPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
}
}
else
{ // 12-bit
{ /* 12-bit */
int value_pairs = (sp->cinfo.d.output_width
* sp->cinfo.d.num_components) / 2;
int iPair;
@ -1087,8 +1094,7 @@ JPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
* TODO: resolve this */
buf += sp->bytesperline;
cc -= sp->bytesperline;
nrows -= sp->v_sampling;
} while (nrows > 0);
} while (--nrows > 0);
#ifdef JPEG_LIB_MK1
_TIFFfree(tmpbuf);
@ -1352,8 +1358,15 @@ JPEGPreEncode(TIFF* tif, tsample_t s)
sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling;
sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling;
} else {
sp->cinfo.c.in_color_space = JCS_UNKNOWN;
if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN))
if ((td->td_photometric == PHOTOMETRIC_MINISWHITE || td->td_photometric == PHOTOMETRIC_MINISBLACK) && td->td_samplesperpixel == 1)
sp->cinfo.c.in_color_space = JCS_GRAYSCALE;
else if (td->td_photometric == PHOTOMETRIC_RGB)
sp->cinfo.c.in_color_space = JCS_RGB;
else if (td->td_photometric == PHOTOMETRIC_SEPARATED && td->td_samplesperpixel == 4)
sp->cinfo.c.in_color_space = JCS_CMYK;
else
sp->cinfo.c.in_color_space = JCS_UNKNOWN;
if (!TIFFjpeg_set_colorspace(sp, sp->cinfo.c.in_color_space))
return (0);
/* jpeg_set_colorspace set all sampling factors to 1 */
}
@ -1523,7 +1536,7 @@ JPEGEncodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
sp->scancount = 0;
}
tif->tif_row += sp->v_sampling;
buf += sp->bytesperline;
buf += bytesperclumpline;
nrows -= sp->v_sampling;
}
return (1);

View File

@ -1,4 +1,4 @@
/* $Id: tif_ojpeg.c,v 1.24.2.6 2010-06-08 23:29:51 bfriesen Exp $ */
/* $Id: tif_ojpeg.c,v 1.24.2.8 2010-12-11 21:25:04 faxguy Exp $ */
/* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0
specification is now totally obsolete and deprecated for new applications and
@ -1537,7 +1537,6 @@ OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8 marker_id)
OJPEGReadSkip(sp,4);
else
{
/* TODO: probably best to also add check on allowed upper bound, especially x, may cause buffer overflow otherwise i think */
/* Y: Number of lines */
if (OJPEGReadWord(sp,&p)==0)
return(0);
@ -1555,6 +1554,11 @@ OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8 marker_id)
TIFFErrorExt(tif->tif_clientdata,module,"JPEG compressed data indicates unexpected width");
return(0);
}
if ((uint32)p>sp->strile_width)
{
TIFFErrorExt(tif->tif_clientdata,module,"JPEG compressed data image width exceeds expected image width");
return(0);
}
sp->sof_x=p;
}
/* Nf: Number of image components in frame */
@ -1918,8 +1922,14 @@ OJPEGReadBufferFill(OJPEGState* sp)
{
if (sp->in_buffer_file_pos>=sp->file_size)
sp->in_buffer_file_pos=0;
else if (sp->tif->tif_dir.td_stripbytecount==NULL)
sp->in_buffer_file_togo=sp->file_size-sp->in_buffer_file_pos;
else
{
if (sp->tif->tif_dir.td_stripbytecount == 0) {
TIFFErrorExt(sp->tif->tif_clientdata,sp->tif->tif_name,"Strip byte counts are missing");
return(0);
}
sp->in_buffer_file_togo=sp->tif->tif_dir.td_stripbytecount[sp->in_buffer_next_strile];
if (sp->in_buffer_file_togo==0)
sp->in_buffer_file_pos=0;

View File

@ -1,4 +1,4 @@
/* $Id: tif_open.c,v 1.33.2.1 2010-06-08 18:50:42 bfriesen Exp $ */
/* $Id: tif_open.c,v 1.33.2.2 2010-12-06 16:54:22 faxguy Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -304,7 +304,7 @@ TIFFClientOpen(
/*
* Read in TIFF header.
*/
if (tif->tif_mode & O_TRUNC ||
if ((m & O_TRUNC) ||
!ReadOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {
if (tif->tif_mode == O_RDONLY) {
TIFFErrorExt(tif->tif_clientdata, name,

View File

@ -1,4 +1,4 @@
/* $Id: tif_print.c,v 1.36.2.4 2010-06-08 18:50:42 bfriesen Exp $ */
/* $Id: tif_print.c,v 1.36.2.5 2010-07-06 14:05:30 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -115,8 +115,6 @@ static int
_TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
uint32 value_count, void *raw_data)
{
//TIFFDirectory *td = &tif->tif_dir;
switch (tag)
{
case TIFFTAG_INKSET:
@ -132,10 +130,6 @@ _TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
break;
}
return 1;
case TIFFTAG_DOTRANGE:
fprintf(fd, " Dot Range: %u-%u\n",
((uint16*)raw_data)[0], ((uint16*)raw_data)[1]);
return 1;
case TIFFTAG_WHITEPOINT:
fprintf(fd, " White Point: %g-%g\n",
((float *)raw_data)[0], ((float *)raw_data)[1]); return 1;

View File

@ -1,4 +1,4 @@
/* $Id: tif_strip.c,v 1.19.2.1 2010-06-08 18:50:43 bfriesen Exp $ */
/* $Id: tif_strip.c,v 1.19.2.3 2010-12-15 00:50:30 faxguy Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@ -124,9 +124,9 @@ TIFFVStripSize(TIFF* tif, uint32 nrows)
uint16 ycbcrsubsampling[2];
tsize_t w, scanline, samplingarea;
TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING,
ycbcrsubsampling + 0,
ycbcrsubsampling + 1 );
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
ycbcrsubsampling + 0,
ycbcrsubsampling + 1);
samplingarea = ycbcrsubsampling[0]*ycbcrsubsampling[1];
if (samplingarea == 0) {
@ -234,27 +234,23 @@ TIFFScanlineSize(TIFF* tif)
&& !isUpSampled(tif)) {
uint16 ycbcrsubsampling[2];
TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING,
ycbcrsubsampling + 0,
ycbcrsubsampling + 1);
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
ycbcrsubsampling + 0,
ycbcrsubsampling + 1);
if (ycbcrsubsampling[0] == 0) {
if (ycbcrsubsampling[0]*ycbcrsubsampling[1] == 0) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Invalid YCbCr subsampling");
return 0;
}
scanline = TIFFroundup(td->td_imagewidth,
/* number of sample clumps per line */
scanline = TIFFhowmany(td->td_imagewidth,
ycbcrsubsampling[0]);
scanline = TIFFhowmany8(multiply(tif, scanline,
td->td_bitspersample,
"TIFFScanlineSize"));
return ((tsize_t)
summarize(tif, scanline,
multiply(tif, 2,
scanline / ycbcrsubsampling[0],
"TIFFVStripSize"),
"TIFFVStripSize"));
/* number of samples per line */
scanline = multiply(tif, scanline,
ycbcrsubsampling[0]*ycbcrsubsampling[1] + 2,
"TIFFScanlineSize");
} else {
scanline = multiply(tif, td->td_imagewidth,
td->td_samplesperpixel,
@ -308,9 +304,9 @@ TIFFNewScanlineSize(TIFF* tif)
&& !isUpSampled(tif)) {
uint16 ycbcrsubsampling[2];
TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING,
ycbcrsubsampling + 0,
ycbcrsubsampling + 1);
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
ycbcrsubsampling + 0,
ycbcrsubsampling + 1);
if (ycbcrsubsampling[0]*ycbcrsubsampling[1] == 0) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,

View File

@ -1,4 +1,4 @@
/* $Id: tif_thunder.c,v 1.5.2.1 2010-06-08 18:50:43 bfriesen Exp $ */
/* $Id: tif_thunder.c,v 1.5.2.2 2011-03-21 16:01:28 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -25,6 +25,7 @@
*/
#include "tiffiop.h"
#include <assert.h>
#ifdef THUNDER_SUPPORT
/*
* TIFF Library.
@ -55,12 +56,32 @@
static const int twobitdeltas[4] = { 0, 1, 0, -1 };
static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 };
#define SETPIXEL(op, v) { \
lastpixel = (v) & 0xf; \
if (npixels++ & 1) \
*op++ |= lastpixel; \
else \
#define SETPIXEL(op, v) { \
lastpixel = (v) & 0xf; \
if ( npixels < maxpixels ) \
{ \
if (npixels++ & 1) \
*op++ |= lastpixel; \
else \
op[0] = (tidataval_t) (lastpixel << 4); \
} \
}
static int
ThunderSetupDecode(TIFF* tif)
{
static const char module[] = "ThunderSetupDecode";
if( tif->tif_dir.td_bitspersample != 4 )
{
TIFFErrorExt(tif->tif_clientdata, module,
"Wrong bitspersample value (%d), Thunder decoder only supports 4bits per sample.",
(int) tif->tif_dir.td_bitspersample );
return 0;
}
return (1);
}
static int
@ -142,7 +163,8 @@ ThunderDecodeRow(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
occ -= tif->tif_scanlinesize;
row += tif->tif_scanlinesize;
}
return (1);
return (1);
}
int
@ -151,6 +173,7 @@ TIFFInitThunderScan(TIFF* tif, int scheme)
(void) scheme;
tif->tif_decoderow = ThunderDecodeRow;
tif->tif_decodestrip = ThunderDecodeRow;
tif->tif_setupdecode = ThunderSetupDecode;
return (1);
}
#endif /* THUNDER_SUPPORT */
@ -163,3 +186,4 @@ TIFFInitThunderScan(TIFF* tif, int scheme)
* fill-column: 78
* End:
*/

View File

@ -1,4 +1,4 @@
/* $Id: tiffiop.h,v 1.51.2.6 2010-06-12 02:55:16 bfriesen Exp $ */
/* $Id: tiffiop.h,v 1.51.2.7 2011-03-21 21:09:19 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -61,8 +61,11 @@ extern void *lfind(const void *, const void *, size_t *, size_t,
Libtiff itself does not require a 64-bit type, but bundled TIFF
utilities may use it.
*/
#if !defined(__xlC__) && !defined(__xlc__) // Already defined there (#2301)
typedef TIFF_INT64_T int64;
typedef TIFF_UINT64_T uint64;
#endif
#include "tiffio.h"
#include "tif_dir.h"

View File

@ -1,4 +1,4 @@
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.9.4\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.9.5\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
@ -6,4 +6,4 @@
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
#define TIFFLIB_VERSION 20100615
#define TIFFLIB_VERSION 20110409

36
3rdparty/readme.txt vendored
View File

@ -11,7 +11,6 @@ libjpeg 6b (6.2) - The Independent JPEG Group's JPEG software.
HAVE_JPEG preprocessor flag must be set to make highgui use libjpeg.
On UNIX systems configure script takes care of it.
------------------------------------------------------------------------------------
libpng 1.4.3 - Portable Network Graphics library.
Copyright (C) 1998-2010, Glenn Randers-Pehrson.
@ -20,15 +19,13 @@ libpng 1.4.3 - Portable Network Graphics library.
HAVE_PNG preprocessor flag must be set to make highgui use libpng.
On UNIX systems configure script takes care of it.
------------------------------------------------------------------------------------
libtiff 3.9.4 - Tag Image File Format (TIFF) Software
libtiff 3.9.5 - Tag Image File Format (TIFF) Software
Copyright (c) 1988-1997 Sam Leffler
Copyright (c) 1991-1997 Silicon Graphics, Inc.
See libtiff home page http://www.libtiff.org
for details and links to the source code
HAVE_TIFF preprocessor flag must be set to make highgui use libtiff.
On UNIX systems configure script takes care of it.
@ -42,9 +39,7 @@ zlib 1.2.5 - General purpose LZ77 compression library
No preprocessor definition is needed to make highgui use this library -
it is included automatically if either libpng or libtiff are used.
------------------------------------------------------------------------------------
jasper-1.900.1 - JasPer is a collection of software
(i.e., a library and application programs) for the coding
and manipulation of images. This software can handle image data in a
@ -61,9 +56,7 @@ jasper-1.900.1 - JasPer is a collection of software
(lib/libjasper*). To get the latest source code,
please, visit the project homepage:
http://www.ece.uvic.ca/~mdadams/jasper/
------------------------------------------------------------------------------------
openexr-1.4.0 - OpenEXR is a high dynamic-range (HDR) image file format developed
by Industrial Light & Magic for use in computer imaging applications.
@ -73,34 +66,15 @@ openexr-1.4.0 - OpenEXR is a high dynamic-range (HDR) image file format develope
The project homepage: http://www.openexr.com/
OpenCV on Windows does not include openexr codec by default.
To add it, you will need to recompile highgui with OpenEXR support
using VS.NET2003 or VS.NET2005 (MSVC6 can not compile it):
1) download binaries (e.g. openexr-1.4.0-vs2005.zip)
from the official site.
2) copy
half.lib, iex.lib, ilmimf.lib ilmthread.lib imath.lib to
_graphics/lib
3) copy include/openexr/*.h to _graphics/include/openexr
4) open _make/opencv.sln
5) in highgui/_highgui.h uncomment
#define HAVE_ILMIMF 1
6) build debug/release configurations of highgui.
OpenCV does not include openexr codec.
To add it, you will need install OpenEXR, reconfigure OpenCV
using CMake (make sure OpenEXR library is found) and the rebuild OpenCV.
------------------------------------------------------------------------------------
ffmpeg-0.6.0 - FFmpeg is a complete, cross-platform solution to record,
ffmpeg-0.8.0 - FFmpeg is a complete, cross-platform solution to record,
convert and stream audio and video. It includes libavcodec -
the leading audio/video codec library, and also libavformat, libavutils and
other helper libraries that are used by OpenCV (in highgui module) to
read and write video files.
The project homepage: http://ffmpeg.org/
------------------------------------------------------------------------------------
videoInput-0.1995 - Video capturing library for Windows using DirectShow as backend
Written by Theodore Watson
http://muonics.net/school/spring05/videoInput/
------------------------------------------------------------------------------------