-/* $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
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);
}
/*
-/* $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
* 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;
-/* $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
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*);
const TIFFFieldInfo* fip;
size_t fix;
uint16 dircount;
+ uint16 previous_tag = 0;
int diroutoforderwarning = 0, compressionknown = 0;
int haveunknowntags = 0;
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
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++;
}
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;
}
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",
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;
}
*/
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:
"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);
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]);
}
}
/*
- * 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;
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);
}
-/* $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
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*);
_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;
}
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;
}
#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.
*/
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);
-/* $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
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; \
-/* $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
DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
{
uint32* cp2;
+ int32 incr = 2*toskew+w;
(void) y;
fromskew = (fromskew / 2) * 6;
cp2 = cp+w+toskew;
cp2 ++ ;
pp += 6;
}
- cp += toskew*2+w;
- cp2 += toskew*2+w;
+ cp += incr;
+ cp2 += incr;
pp += fromskew;
h-=2;
}
DECLAREContigPutFunc(putcontig8bitYCbCr12tile)
{
uint32* cp2;
+ int32 incr = 2*toskew+w;
(void) y;
fromskew = (fromskew / 2) * 4;
cp2 = cp+w+toskew;
cp2 ++;
pp += 4;
} while (--x);
- cp += toskew*2+w;
- cp2 += toskew*2+w;
+ cp += incr;
+ cp2 += incr;
pp += fromskew;
h-=2;
}
}
break;
case PHOTOMETRIC_YCBCR:
- if (img->bitspersample == 8)
+ if ((img->bitspersample==8) && (img->samplesperpixel==3))
{
if (initYCbCrConversion(img)!=0)
{
-/* $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
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;
}
}
else
- { // 12-bit
+ { /* 12-bit */
int value_pairs = (sp->cinfo.d.output_width
* sp->cinfo.d.num_components) / 2;
int iPair;
* 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);
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 */
}
sp->scancount = 0;
}
tif->tif_row += sp->v_sampling;
- buf += sp->bytesperline;
+ buf += bytesperclumpline;
nrows -= sp->v_sampling;
}
return (1);
-/* $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
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);
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 */
{
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;
-/* $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
/*
* 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,
-/* $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
_TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
uint32 value_count, void *raw_data)
{
- //TIFFDirectory *td = &tif->tif_dir;
-
switch (tag)
{
case TIFFTAG_INKSET:
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;
-/* $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
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) {
&& !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,
&& !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,
-/* $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
*/
#include "tiffiop.h"
+#include <assert.h>
#ifdef THUNDER_SUPPORT
/*
* TIFF Library.
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
occ -= tif->tif_scanlinesize;
row += tif->tif_scanlinesize;
}
- return (1);
+
+ return (1);
}
int
(void) scheme;
tif->tif_decoderow = ThunderDecodeRow;
tif->tif_decodestrip = ThunderDecodeRow;
+ tif->tif_setupdecode = ThunderSetupDecode;
return (1);
}
#endif /* THUNDER_SUPPORT */
* fill-column: 78
* End:
*/
+
-/* $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
/*
Libtiff itself does not require a 64-bit type, but bundled TIFF
- utilities may use it.
+ 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"
-#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
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
-#define TIFFLIB_VERSION 20100615
+#define TIFFLIB_VERSION 20110409
\r
HAVE_JPEG preprocessor flag must be set to make highgui use libjpeg.\r
On UNIX systems configure script takes care of it.\r
-\r
------------------------------------------------------------------------------------\r
libpng 1.4.3 - Portable Network Graphics library.\r
Copyright (C) 1998-2010, Glenn Randers-Pehrson.\r
\r
HAVE_PNG preprocessor flag must be set to make highgui use libpng.\r
On UNIX systems configure script takes care of it.\r
-\r
------------------------------------------------------------------------------------\r
-libtiff 3.9.4 - Tag Image File Format (TIFF) Software\r
+libtiff 3.9.5 - Tag Image File Format (TIFF) Software\r
Copyright (c) 1988-1997 Sam Leffler\r
Copyright (c) 1991-1997 Silicon Graphics, Inc.\r
See libtiff home page http://www.libtiff.org\r
for details and links to the source code\r
\r
-\r
HAVE_TIFF preprocessor flag must be set to make highgui use libtiff.\r
On UNIX systems configure script takes care of it.\r
\r
\r
No preprocessor definition is needed to make highgui use this library -\r
it is included automatically if either libpng or libtiff are used.\r
-\r
------------------------------------------------------------------------------------\r
-\r
jasper-1.900.1 - JasPer is a collection of software\r
(i.e., a library and application programs) for the coding\r
and manipulation of images. This software can handle image data in a\r
(lib/libjasper*). To get the latest source code,\r
please, visit the project homepage:\r
http://www.ece.uvic.ca/~mdadams/jasper/\r
-\r
------------------------------------------------------------------------------------\r
-\r
openexr-1.4.0 - OpenEXR is a high dynamic-range (HDR) image file format developed\r
by Industrial Light & Magic for use in computer imaging applications.\r
\r
\r
The project homepage: http://www.openexr.com/\r
\r
- OpenCV on Windows does not include openexr codec by default.\r
- To add it, you will need to recompile highgui with OpenEXR support\r
- using VS.NET2003 or VS.NET2005 (MSVC6 can not compile it):\r
- 1) download binaries (e.g. openexr-1.4.0-vs2005.zip)\r
- from the official site.\r
- 2) copy\r
- half.lib, iex.lib, ilmimf.lib ilmthread.lib imath.lib to\r
- _graphics/lib\r
- 3) copy include/openexr/*.h to _graphics/include/openexr\r
- 4) open _make/opencv.sln\r
- 5) in highgui/_highgui.h uncomment\r
- #define HAVE_ILMIMF 1\r
- 6) build debug/release configurations of highgui.\r
-\r
+ OpenCV does not include openexr codec.\r
+ To add it, you will need install OpenEXR, reconfigure OpenCV\r
+ using CMake (make sure OpenEXR library is found) and the rebuild OpenCV.\r
------------------------------------------------------------------------------------\r
-\r
-ffmpeg-0.6.0 - FFmpeg is a complete, cross-platform solution to record,\r
+ffmpeg-0.8.0 - FFmpeg is a complete, cross-platform solution to record,\r
convert and stream audio and video. It includes libavcodec -\r
the leading audio/video codec library, and also libavformat, libavutils and\r
other helper libraries that are used by OpenCV (in highgui module) to\r
read and write video files.\r
\r
The project homepage: http://ffmpeg.org/\r
-\r
-------------------------------------------------------------------------------------\r
-\r
-videoInput-0.1995 - Video capturing library for Windows using DirectShow as backend\r
- Written by Theodore Watson\r
- http://muonics.net/school/spring05/videoInput/\r
-\r
------------------------------------------------------------------------------------\r