call TIFFGetField() on YCBCRSUBSAMPLING for tif_jpeg hack
This commit is contained in:
parent
a0605bac6b
commit
a6873099d0
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_print.c,v 1.7 2002-03-27 06:31:29 warmerda Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_print.c,v 1.8 2002-07-31 21:05:57 warmerda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -319,8 +319,19 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
||||
}
|
||||
#ifdef YCBCR_SUPPORT
|
||||
if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING))
|
||||
{
|
||||
/*
|
||||
* For hacky reasons (see tif_jpeg.c - JPEGFixupTestSubsampling),
|
||||
* we need to fetch this rather than trust what is in our
|
||||
* structures.
|
||||
*/
|
||||
uint16 subsampling[2];
|
||||
|
||||
TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING,
|
||||
subsampling + 0, subsampling + 1 );
|
||||
fprintf(fd, " YCbCr Subsampling: %u, %u\n",
|
||||
td->td_ycbcrsubsampling[0], td->td_ycbcrsubsampling[1]);
|
||||
subsampling[0], subsampling[1] );
|
||||
}
|
||||
if (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) {
|
||||
fprintf(fd, " YCbCr Positioning: ");
|
||||
switch (td->td_ycbcrpositioning) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_strip.c,v 1.1 1999-07-27 21:50:27 mike Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_strip.c,v 1.2 2002-07-31 21:05:57 warmerda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991-1997 Sam Leffler
|
||||
@ -92,12 +92,17 @@ TIFFVStripSize(TIFF* tif, uint32 nrows)
|
||||
* horizontal/vertical subsampling area include
|
||||
* YCbCr data for the extended image.
|
||||
*/
|
||||
tsize_t w =
|
||||
TIFFroundup(td->td_imagewidth, td->td_ycbcrsubsampling[0]);
|
||||
tsize_t scanline = TIFFhowmany(w*td->td_bitspersample, 8);
|
||||
tsize_t samplingarea =
|
||||
td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1];
|
||||
nrows = TIFFroundup(nrows, td->td_ycbcrsubsampling[1]);
|
||||
uint16 ycbcrsubsampling[2];
|
||||
tsize_t w, scanline, samplingarea;
|
||||
|
||||
TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING,
|
||||
ycbcrsubsampling + 0,
|
||||
ycbcrsubsampling + 1 );
|
||||
|
||||
w = TIFFroundup(td->td_imagewidth, ycbcrsubsampling[0]);
|
||||
scanline = TIFFhowmany(w*td->td_bitspersample, 8);
|
||||
samplingarea = ycbcrsubsampling[0]*ycbcrsubsampling[1];
|
||||
nrows = TIFFroundup(nrows, ycbcrsubsampling[1]);
|
||||
/* NB: don't need TIFFhowmany here 'cuz everything is rounded */
|
||||
return ((tsize_t)
|
||||
(nrows*scanline + 2*(nrows*scanline / samplingarea)));
|
||||
|
Loading…
Reference in New Issue
Block a user