Updated libtiff to release version 3.6.1
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5882 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,6 +4,7 @@ Translator TIFFTranslator :
|
|||||||
tif_aux.c
|
tif_aux.c
|
||||||
tif_close.c
|
tif_close.c
|
||||||
tif_codec.c
|
tif_codec.c
|
||||||
|
tif_color.c
|
||||||
tif_compress.c
|
tif_compress.c
|
||||||
tif_dir.c
|
tif_dir.c
|
||||||
tif_dirinfo.c
|
tif_dirinfo.c
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_aux.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_aux.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1991-1997 Sam Leffler
|
* Copyright (c) 1991-1997 Sam Leffler
|
||||||
@@ -31,8 +31,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "tiffiop.h"
|
#include "tiffiop.h"
|
||||||
#include "tif_predict.h"
|
#include "tif_predict.h"
|
||||||
|
|
||||||
#ifdef COLORIMETRY_SUPPORT
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -66,7 +64,6 @@ TIFFDefaultRefBlackWhite(TIFFDirectory* td)
|
|||||||
td->td_refblackwhite[2*i+1] = (float)((1L<<td->td_bitspersample)-1L);
|
td->td_refblackwhite[2*i+1] = (float)((1L<<td->td_bitspersample)-1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Like TIFFGetField, but return any default
|
* Like TIFFGetField, but return any default
|
||||||
@@ -120,10 +117,9 @@ TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
case TIFFTAG_PREDICTOR:
|
case TIFFTAG_PREDICTOR:
|
||||||
{
|
{
|
||||||
TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data;
|
TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data;
|
||||||
*va_arg(ap, uint16*) = sp->predictor;
|
*va_arg(ap, uint16*) = (uint16) sp->predictor;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
#ifdef CMYK_SUPPORT
|
|
||||||
case TIFFTAG_DOTRANGE:
|
case TIFFTAG_DOTRANGE:
|
||||||
*va_arg(ap, uint16 *) = 0;
|
*va_arg(ap, uint16 *) = 0;
|
||||||
*va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1;
|
*va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1;
|
||||||
@@ -134,7 +130,6 @@ TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
case TIFFTAG_NUMBEROFINKS:
|
case TIFFTAG_NUMBEROFINKS:
|
||||||
*va_arg(ap, uint16 *) = td->td_ninks;
|
*va_arg(ap, uint16 *) = td->td_ninks;
|
||||||
return (1);
|
return (1);
|
||||||
#endif
|
|
||||||
case TIFFTAG_EXTRASAMPLES:
|
case TIFFTAG_EXTRASAMPLES:
|
||||||
*va_arg(ap, uint16 *) = td->td_extrasamples;
|
*va_arg(ap, uint16 *) = td->td_extrasamples;
|
||||||
*va_arg(ap, uint16 **) = td->td_sampleinfo;
|
*va_arg(ap, uint16 **) = td->td_sampleinfo;
|
||||||
@@ -156,7 +151,6 @@ TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
case TIFFTAG_IMAGEDEPTH:
|
case TIFFTAG_IMAGEDEPTH:
|
||||||
*va_arg(ap, uint32 *) = td->td_imagedepth;
|
*va_arg(ap, uint32 *) = td->td_imagedepth;
|
||||||
return (1);
|
return (1);
|
||||||
#ifdef YCBCR_SUPPORT
|
|
||||||
case TIFFTAG_YCBCRCOEFFICIENTS:
|
case TIFFTAG_YCBCRCOEFFICIENTS:
|
||||||
if (!td->td_ycbcrcoeffs) {
|
if (!td->td_ycbcrcoeffs) {
|
||||||
td->td_ycbcrcoeffs = (float *)
|
td->td_ycbcrcoeffs = (float *)
|
||||||
@@ -175,8 +169,20 @@ TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
case TIFFTAG_YCBCRPOSITIONING:
|
case TIFFTAG_YCBCRPOSITIONING:
|
||||||
*va_arg(ap, uint16 *) = td->td_ycbcrpositioning;
|
*va_arg(ap, uint16 *) = td->td_ycbcrpositioning;
|
||||||
return (1);
|
return (1);
|
||||||
#endif
|
case TIFFTAG_WHITEPOINT:
|
||||||
#ifdef COLORIMETRY_SUPPORT
|
if (!td->td_whitepoint) {
|
||||||
|
td->td_whitepoint = (float *)
|
||||||
|
_TIFFmalloc(2 * sizeof (float));
|
||||||
|
/* TIFF 6.0 specification says that it is no default
|
||||||
|
value for the WhitePoint, but AdobePhotoshop TIFF
|
||||||
|
Technical Note tells that it should be CIE D50. */
|
||||||
|
td->td_whitepoint[0] =
|
||||||
|
D50_X0 / (D50_X0 + D50_Y0 + D50_Z0);
|
||||||
|
td->td_whitepoint[1] =
|
||||||
|
D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0);
|
||||||
|
}
|
||||||
|
*va_arg(ap, float **) = td->td_whitepoint;
|
||||||
|
return (1);
|
||||||
case TIFFTAG_TRANSFERFUNCTION:
|
case TIFFTAG_TRANSFERFUNCTION:
|
||||||
if (!td->td_transferfunction[0])
|
if (!td->td_transferfunction[0])
|
||||||
TIFFDefaultTransferFunction(td);
|
TIFFDefaultTransferFunction(td);
|
||||||
@@ -191,7 +197,6 @@ TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
TIFFDefaultRefBlackWhite(td);
|
TIFFDefaultRefBlackWhite(td);
|
||||||
*va_arg(ap, float **) = td->td_refblackwhite;
|
*va_arg(ap, float **) = td->td_refblackwhite;
|
||||||
return (1);
|
return (1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_close.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_close.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -40,6 +40,9 @@ TIFFClose(TIFF* tif)
|
|||||||
(*tif->tif_cleanup)(tif);
|
(*tif->tif_cleanup)(tif);
|
||||||
TIFFFreeDirectory(tif);
|
TIFFFreeDirectory(tif);
|
||||||
|
|
||||||
|
if (tif->tif_dirlist)
|
||||||
|
_TIFFfree(tif->tif_dirlist);
|
||||||
|
|
||||||
/* Clean up client info links */
|
/* Clean up client info links */
|
||||||
while( tif->tif_clientinfo )
|
while( tif->tif_clientinfo )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_codec.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_codec.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -111,9 +111,40 @@ _notConfigured(TIFF* tif)
|
|||||||
static int
|
static int
|
||||||
NotConfigured(TIFF* tif, int scheme)
|
NotConfigured(TIFF* tif, int scheme)
|
||||||
{
|
{
|
||||||
|
(void) scheme;
|
||||||
|
|
||||||
tif->tif_decodestatus = FALSE;
|
tif->tif_decodestatus = FALSE;
|
||||||
tif->tif_setupdecode = _notConfigured;
|
tif->tif_setupdecode = _notConfigured;
|
||||||
tif->tif_encodestatus = FALSE;
|
tif->tif_encodestatus = FALSE;
|
||||||
tif->tif_setupencode = _notConfigured;
|
tif->tif_setupencode = _notConfigured;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* TIFFIsCODECConfigured() */
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether we have working codec for the specific coding scheme.
|
||||||
|
*
|
||||||
|
* @return returns 1 if the codec is configured and working. Otherwise
|
||||||
|
* 0 will be returned.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
TIFFIsCODECConfigured(uint16 scheme)
|
||||||
|
{
|
||||||
|
const TIFFCodec* codec = TIFFFindCODEC(scheme);
|
||||||
|
|
||||||
|
if(codec == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(codec->init == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(codec->init != NotConfigured){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,268 @@
|
|||||||
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_color.c,v 1.1 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
|
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Sam Leffler and Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CIE L*a*b* to CIE XYZ and CIE XYZ to RGB conversion routines are taken
|
||||||
|
* from the VIPS library (http://www.vips.ecs.soton.ac.uk) with
|
||||||
|
* the permission of John Cupitt, the VIPS author.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TIFF Library.
|
||||||
|
*
|
||||||
|
* Color space conversion routines.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "tiffiop.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert color value from the CIE L*a*b* 1976 space to CIE XYZ.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b,
|
||||||
|
float *X, float *Y, float *Z)
|
||||||
|
{
|
||||||
|
float L = (float)l * 100.0F / 255.0F;
|
||||||
|
float cby, tmp;
|
||||||
|
|
||||||
|
if( L < 8.856F ) {
|
||||||
|
*Y = (L * cielab->Y0) / 903.292F;
|
||||||
|
cby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F;
|
||||||
|
} else {
|
||||||
|
cby = (L + 16.0F) / 116.0F;
|
||||||
|
*Y = cielab->Y0 * cby * cby * cby;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = (float)a / 500.0F + cby;
|
||||||
|
if( tmp < 0.2069F )
|
||||||
|
*X = cielab->X0 * (tmp - 0.13793F) / 7.787F;
|
||||||
|
else
|
||||||
|
*X = cielab->X0 * tmp * tmp * tmp;
|
||||||
|
|
||||||
|
tmp = cby - (float)b / 200.0F;
|
||||||
|
if( tmp < 0.2069F )
|
||||||
|
*Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F;
|
||||||
|
else
|
||||||
|
*Z = cielab->Z0 * tmp * tmp * tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RINT(R) ((uint32)((R)>0?((R)+0.5):((R)-0.5)))
|
||||||
|
/*
|
||||||
|
* Convert color value from the XYZ space to RGB.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
|
||||||
|
uint32 *r, uint32 *g, uint32 *b)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
float Yr, Yg, Yb;
|
||||||
|
float *matrix = &cielab->display.d_mat[0][0];
|
||||||
|
|
||||||
|
/* Multiply through the matrix to get luminosity values. */
|
||||||
|
Yr = matrix[0] * X + matrix[1] * Y + matrix[2] * Z;
|
||||||
|
Yg = matrix[3] * X + matrix[4] * Y + matrix[5] * Z;
|
||||||
|
Yb = matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
|
||||||
|
|
||||||
|
/* Clip input */
|
||||||
|
Yr = TIFFmax( Yr, cielab->display.d_Y0R );
|
||||||
|
Yg = TIFFmax( Yg, cielab->display.d_Y0G );
|
||||||
|
Yb = TIFFmax( Yb, cielab->display.d_Y0B );
|
||||||
|
|
||||||
|
/* Turn luminosity to colour value. */
|
||||||
|
i = TIFFmin(cielab->range,
|
||||||
|
(int)((Yr - cielab->display.d_Y0R) / cielab->rstep));
|
||||||
|
*r = RINT(cielab->Yr2r[i]);
|
||||||
|
|
||||||
|
i = TIFFmin(cielab->range,
|
||||||
|
(int)((Yg - cielab->display.d_Y0G) / cielab->gstep));
|
||||||
|
*g = RINT(cielab->Yg2g[i]);
|
||||||
|
|
||||||
|
i = TIFFmin(cielab->range,
|
||||||
|
(int)((Yb - cielab->display.d_Y0B) / cielab->bstep));
|
||||||
|
*b = RINT(cielab->Yb2b[i]);
|
||||||
|
|
||||||
|
/* Clip output. */
|
||||||
|
*r = TIFFmin( *r, cielab->display.d_Vrwr );
|
||||||
|
*g = TIFFmin( *g, cielab->display.d_Vrwg );
|
||||||
|
*b = TIFFmin( *b, cielab->display.d_Vrwb );
|
||||||
|
}
|
||||||
|
#undef RINT
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allocate conversion state structures and make look_up tables for
|
||||||
|
* the Yr,Yb,Yg <=> r,g,b conversions.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
|
||||||
|
TIFFDisplay *display, float *refWhite)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
float gamma;
|
||||||
|
|
||||||
|
cielab->range = CIELABTORGB_TABLE_RANGE;
|
||||||
|
|
||||||
|
_TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
|
||||||
|
|
||||||
|
/* Red */
|
||||||
|
gamma = 1.0F / cielab->display.d_gammaR ;
|
||||||
|
cielab->rstep =
|
||||||
|
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||||
|
for(i = 0; i <= cielab->range; i++) {
|
||||||
|
cielab->Yr2r[i] = cielab->display.d_Vrwr
|
||||||
|
* ((float)pow((double)i / cielab->range, gamma));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Green */
|
||||||
|
gamma = 1.0F / cielab->display.d_gammaG ;
|
||||||
|
cielab->gstep =
|
||||||
|
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||||
|
for(i = 0; i <= cielab->range; i++) {
|
||||||
|
cielab->Yg2g[i] = cielab->display.d_Vrwg
|
||||||
|
* ((float)pow((double)i / cielab->range, gamma));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Blue */
|
||||||
|
gamma = 1.0F / cielab->display.d_gammaB ;
|
||||||
|
cielab->bstep =
|
||||||
|
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||||
|
for(i = 0; i <= cielab->range; i++) {
|
||||||
|
cielab->Yb2b[i] = cielab->display.d_Vrwb
|
||||||
|
* ((float)pow((double)i / cielab->range, gamma));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init reference white point */
|
||||||
|
cielab->X0 = refWhite[0];
|
||||||
|
cielab->Y0 = refWhite[1];
|
||||||
|
cielab->Z0 = refWhite[2];
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert color value from the YCbCr space to CIE XYZ.
|
||||||
|
* The colorspace conversion algorithm comes from the IJG v5a code;
|
||||||
|
* see below for more information on how it works.
|
||||||
|
*/
|
||||||
|
#define SHIFT 16
|
||||||
|
#define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5))
|
||||||
|
#define ONE_HALF ((int32)(1<<(SHIFT-1)))
|
||||||
|
#define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)((RW)-(RB)))
|
||||||
|
#define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f))
|
||||||
|
|
||||||
|
void
|
||||||
|
TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr,
|
||||||
|
uint32 *r, uint32 *g, uint32 *b)
|
||||||
|
{
|
||||||
|
/* XXX: Only 8-bit YCbCr input supported for now */
|
||||||
|
Y = CLAMP(Y, 0, 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]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the YCbCr->RGB conversion tables. The conversion
|
||||||
|
* is done according to the 6.0 spec:
|
||||||
|
*
|
||||||
|
* R = Y + Cr*(2 - 2*LumaRed)
|
||||||
|
* B = Y + Cb*(2 - 2*LumaBlue)
|
||||||
|
* G = Y
|
||||||
|
* - LumaBlue*Cb*(2-2*LumaBlue)/LumaGreen
|
||||||
|
* - LumaRed*Cr*(2-2*LumaRed)/LumaGreen
|
||||||
|
*
|
||||||
|
* To avoid floating point arithmetic the fractional constants that
|
||||||
|
* come out of the equations are represented as fixed point values
|
||||||
|
* in the range 0...2^16. We also eliminate multiplications by
|
||||||
|
* pre-calculating possible values indexed by Cb and Cr (this code
|
||||||
|
* assumes conversion is being done for 8-bit samples).
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
|
||||||
|
{
|
||||||
|
TIFFRGBValue* clamptab;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
#define LumaRed luma[0]
|
||||||
|
#define LumaGreen luma[1]
|
||||||
|
#define LumaBlue luma[2]
|
||||||
|
|
||||||
|
clamptab = (TIFFRGBValue*)(
|
||||||
|
(tidata_t) ycbcr+TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long)));
|
||||||
|
_TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
|
||||||
|
ycbcr->clamptab = (clamptab += 256);
|
||||||
|
for (i = 0; i < 256; i++)
|
||||||
|
clamptab[i] = (TIFFRGBValue) i;
|
||||||
|
_TIFFmemset(clamptab+256, 255, 2*256); /* v > 255 => 255 */
|
||||||
|
ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);
|
||||||
|
ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
|
||||||
|
ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256);
|
||||||
|
ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
|
||||||
|
ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
|
||||||
|
|
||||||
|
{ float f1 = 2-2*LumaRed; int32 D1 = FIX(f1);
|
||||||
|
float f2 = LumaRed*f1/LumaGreen; int32 D2 = -FIX(f2);
|
||||||
|
float f3 = 2-2*LumaBlue; int32 D3 = FIX(f3);
|
||||||
|
float f4 = LumaBlue*f3/LumaGreen; int32 D4 = -FIX(f4);
|
||||||
|
int x;
|
||||||
|
|
||||||
|
#undef LumaBlue
|
||||||
|
#undef LumaGreen
|
||||||
|
#undef LumaRed
|
||||||
|
|
||||||
|
/*
|
||||||
|
* i is the actual input pixel value in the range 0..255
|
||||||
|
* Cb and Cr values are in the range -128..127 (actually
|
||||||
|
* they are in a range defined by the ReferenceBlackWhite
|
||||||
|
* tag) so there is some range shifting to do here when
|
||||||
|
* constructing tables indexed by the raw pixel data.
|
||||||
|
*/
|
||||||
|
for (i = 0, x = -128; i < 256; i++, x++) {
|
||||||
|
int32 Cr = (int32)Code2V(x, refBlackWhite[4] - 128.0F,
|
||||||
|
refBlackWhite[5] - 128.0F, 127);
|
||||||
|
int32 Cb = (int32)Code2V(x, refBlackWhite[2] - 128.0F,
|
||||||
|
refBlackWhite[3] - 128.0F, 127);
|
||||||
|
|
||||||
|
ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);
|
||||||
|
ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);
|
||||||
|
ycbcr->Cr_g_tab[i] = D2*Cr;
|
||||||
|
ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF;
|
||||||
|
ycbcr->Y_tab[i] =
|
||||||
|
(int32)Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#undef CLAMP
|
||||||
|
#undef Code2V
|
||||||
|
#undef SHIFT
|
||||||
|
#undef ONE_HALF
|
||||||
|
#undef FIX
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dir.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dir.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -84,7 +84,6 @@ setExtraSamples(TIFFDirectory* td, va_list ap, int* v)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CMYK_SUPPORT
|
|
||||||
static int
|
static int
|
||||||
checkInkNamesString(TIFF* tif, int slen, const char* s)
|
checkInkNamesString(TIFF* tif, int slen, const char* s)
|
||||||
{
|
{
|
||||||
@@ -110,11 +109,12 @@ bad:
|
|||||||
td->td_samplesperpixel-i);
|
td->td_samplesperpixel-i);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
_TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
||||||
{
|
{
|
||||||
|
static const char module[] = "_TIFFVSetField";
|
||||||
|
|
||||||
TIFFDirectory* td = &tif->tif_dir;
|
TIFFDirectory* td = &tif->tif_dir;
|
||||||
int status = 1;
|
int status = 1;
|
||||||
uint32 v32;
|
uint32 v32;
|
||||||
@@ -168,7 +168,7 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
* Setup new compression routine state.
|
* Setup new compression routine state.
|
||||||
*/
|
*/
|
||||||
if( (status = TIFFSetCompressionScheme(tif, v)) != 0 )
|
if( (status = TIFFSetCompressionScheme(tif, v)) != 0 )
|
||||||
td->td_compression = v;
|
td->td_compression = (uint16) v;
|
||||||
else
|
else
|
||||||
status = 0;
|
status = 0;
|
||||||
break;
|
break;
|
||||||
@@ -393,19 +393,17 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
break;
|
break;
|
||||||
/* End Pixar Tags */
|
/* End Pixar Tags */
|
||||||
|
|
||||||
#if SUBIFD_SUPPORT
|
|
||||||
case TIFFTAG_SUBIFD:
|
case TIFFTAG_SUBIFD:
|
||||||
if ((tif->tif_flags & TIFF_INSUBIFD) == 0) {
|
if ((tif->tif_flags & TIFF_INSUBIFD) == 0) {
|
||||||
td->td_nsubifd = (uint16) va_arg(ap, int);
|
td->td_nsubifd = (uint16) va_arg(ap, int);
|
||||||
_TIFFsetLongArray(&td->td_subifd, va_arg(ap, uint32*),
|
_TIFFsetLongArray(&td->td_subifd, va_arg(ap, uint32*),
|
||||||
(long) td->td_nsubifd);
|
(long) td->td_nsubifd);
|
||||||
} else {
|
} else {
|
||||||
TIFFError(tif->tif_name, "Sorry, cannot nest SubIFDs");
|
TIFFError(module, "%s: Sorry, cannot nest SubIFDs",
|
||||||
|
tif->tif_name);
|
||||||
status = 0;
|
status = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef YCBCR_SUPPORT
|
|
||||||
case TIFFTAG_YCBCRCOEFFICIENTS:
|
case TIFFTAG_YCBCRCOEFFICIENTS:
|
||||||
_TIFFsetFloatArray(&td->td_ycbcrcoeffs, va_arg(ap, float*), 3);
|
_TIFFsetFloatArray(&td->td_ycbcrcoeffs, va_arg(ap, float*), 3);
|
||||||
break;
|
break;
|
||||||
@@ -416,8 +414,6 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
td->td_ycbcrsubsampling[0] = (uint16) va_arg(ap, int);
|
td->td_ycbcrsubsampling[0] = (uint16) va_arg(ap, int);
|
||||||
td->td_ycbcrsubsampling[1] = (uint16) va_arg(ap, int);
|
td->td_ycbcrsubsampling[1] = (uint16) va_arg(ap, int);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef COLORIMETRY_SUPPORT
|
|
||||||
case TIFFTAG_WHITEPOINT:
|
case TIFFTAG_WHITEPOINT:
|
||||||
_TIFFsetFloatArray(&td->td_whitepoint, va_arg(ap, float*), 2);
|
_TIFFsetFloatArray(&td->td_whitepoint, va_arg(ap, float*), 2);
|
||||||
break;
|
break;
|
||||||
@@ -434,8 +430,6 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
/* XXX should check for null range */
|
/* XXX should check for null range */
|
||||||
_TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6);
|
_TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef CMYK_SUPPORT
|
|
||||||
case TIFFTAG_INKSET:
|
case TIFFTAG_INKSET:
|
||||||
td->td_inkset = (uint16) va_arg(ap, int);
|
td->td_inkset = (uint16) va_arg(ap, int);
|
||||||
break;
|
break;
|
||||||
@@ -460,33 +454,22 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
case TIFFTAG_TARGETPRINTER:
|
case TIFFTAG_TARGETPRINTER:
|
||||||
_TIFFsetString(&td->td_targetprinter, va_arg(ap, char*));
|
_TIFFsetString(&td->td_targetprinter, va_arg(ap, char*));
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef ICC_SUPPORT
|
|
||||||
case TIFFTAG_ICCPROFILE:
|
case TIFFTAG_ICCPROFILE:
|
||||||
td->td_profileLength = (uint32) va_arg(ap, uint32);
|
td->td_profileLength = (uint32) va_arg(ap, uint32);
|
||||||
_TIFFsetByteArray(&td->td_profileData, va_arg(ap, void*),
|
_TIFFsetByteArray(&td->td_profileData, va_arg(ap, void*),
|
||||||
td->td_profileLength);
|
td->td_profileLength);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef PHOTOSHOP_SUPPORT
|
|
||||||
case TIFFTAG_PHOTOSHOP:
|
case TIFFTAG_PHOTOSHOP:
|
||||||
td->td_photoshopLength = (uint32) va_arg(ap, uint32);
|
td->td_photoshopLength = (uint32) va_arg(ap, uint32);
|
||||||
_TIFFsetByteArray (&td->td_photoshopData, va_arg(ap, void*),
|
_TIFFsetByteArray (&td->td_photoshopData, va_arg(ap, void*),
|
||||||
td->td_photoshopLength);
|
td->td_photoshopLength);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef IPTC_SUPPORT
|
|
||||||
case TIFFTAG_RICHTIFFIPTC:
|
case TIFFTAG_RICHTIFFIPTC:
|
||||||
td->td_richtiffiptcLength = (uint32) va_arg(ap, uint32);
|
td->td_richtiffiptcLength = (uint32) va_arg(ap, uint32);
|
||||||
#ifdef PHOTOSHOP_SUPPORT
|
_TIFFsetLongArray ((uint32**)&td->td_richtiffiptcData,
|
||||||
_TIFFsetLongArray ((uint32**)&td->td_richtiffiptcData, va_arg(ap, uint32*),
|
va_arg(ap, uint32*),
|
||||||
td->td_richtiffiptcLength);
|
td->td_richtiffiptcLength);
|
||||||
#else
|
|
||||||
_TIFFsetByteArray (&td->td_photoshopData, va_arg(ap, void*),
|
|
||||||
td->td_photoshopLength);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case TIFFTAG_XMLPACKET:
|
case TIFFTAG_XMLPACKET:
|
||||||
td->td_xmlpacketLength = (uint32) va_arg(ap, uint32);
|
td->td_xmlpacketLength = (uint32) va_arg(ap, uint32);
|
||||||
_TIFFsetByteArray(&td->td_xmlpacketData, va_arg(ap, void*),
|
_TIFFsetByteArray(&td->td_xmlpacketData, va_arg(ap, void*),
|
||||||
@@ -510,7 +493,7 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
*/
|
*/
|
||||||
if( fip == NULL || fip->field_bit != FIELD_CUSTOM )
|
if( fip == NULL || fip->field_bit != FIELD_CUSTOM )
|
||||||
{
|
{
|
||||||
TIFFError("TIFFSetField",
|
TIFFError(module,
|
||||||
"%s: Invalid %stag \"%s\" (not supported by codec)",
|
"%s: Invalid %stag \"%s\" (not supported by codec)",
|
||||||
tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
|
tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
|
||||||
_TIFFFieldWithTag(tif, tag)->field_name);
|
_TIFFFieldWithTag(tif, tag)->field_name);
|
||||||
@@ -564,6 +547,10 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
if( fip->field_passcount )
|
if( fip->field_passcount )
|
||||||
{
|
{
|
||||||
tv->value = _TIFFmalloc(tv_size * tv->count);
|
tv->value = _TIFFmalloc(tv_size * tv->count);
|
||||||
|
if ( !tv->value ) {
|
||||||
|
va_end(ap);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
_TIFFmemcpy( tv->value, (void *) va_arg(ap,void*),
|
_TIFFmemcpy( tv->value, (void *) va_arg(ap,void*),
|
||||||
tv->count * tv_size );
|
tv->count * tv_size );
|
||||||
}
|
}
|
||||||
@@ -572,15 +559,22 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
const char *value = (const char *) va_arg(ap,const char *);
|
const char *value = (const char *) va_arg(ap,const char *);
|
||||||
tv->count = strlen(value)+1;
|
tv->count = strlen(value)+1;
|
||||||
tv->value = _TIFFmalloc(tv->count);
|
tv->value = _TIFFmalloc(tv->count);
|
||||||
|
if ( !tv->value ) {
|
||||||
|
va_end(ap);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
strcpy( tv->value, value );
|
strcpy( tv->value, value );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* not supporting "pass by value" types yet */
|
/* not supporting "pass by value" types yet */
|
||||||
|
TIFFWarning(module, " ... pass by value not implemented.");
|
||||||
printf( "TIFFVSetField ... pass by value not imp.\n" );
|
|
||||||
|
|
||||||
tv->value = _TIFFmalloc(tv_size * tv->count);
|
tv->value = _TIFFmalloc(tv_size * tv->count);
|
||||||
|
if ( !tv->value ) {
|
||||||
|
va_end(ap);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
_TIFFmemset( tv->value, 0, tv->count * tv_size );
|
_TIFFmemset( tv->value, 0, tv->count * tv_size );
|
||||||
status = 0;
|
status = 0;
|
||||||
}
|
}
|
||||||
@@ -593,18 +587,18 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
return (status);
|
return (status);
|
||||||
badvalue:
|
badvalue:
|
||||||
TIFFError(tif->tif_name, "%d: Bad value for \"%s\"", v,
|
TIFFError(module, "%.1000s: Bad value %d for \"%s\"",
|
||||||
_TIFFFieldWithTag(tif, tag)->field_name);
|
tif->tif_name, v, _TIFFFieldWithTag(tif, tag)->field_name);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return (0);
|
return (0);
|
||||||
badvalue32:
|
badvalue32:
|
||||||
TIFFError(tif->tif_name, "%ld: Bad value for \"%s\"", v32,
|
TIFFError(module, "%.1000s: Bad value %ld for \"%s\"",
|
||||||
_TIFFFieldWithTag(tif, tag)->field_name);
|
tif->tif_name, v32, _TIFFFieldWithTag(tif, tag)->field_name);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return (0);
|
return (0);
|
||||||
badvaluedbl:
|
badvaluedbl:
|
||||||
TIFFError(tif->tif_name, "%f: Bad value for \"%s\"", d,
|
TIFFError(module, "%.1000s: Bad value %f for \"%s\"",
|
||||||
_TIFFFieldWithTag(tif, tag)->field_name);
|
tif->tif_name, d, _TIFFFieldWithTag(tif, tag)->field_name);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -836,13 +830,10 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
case TIFFTAG_STONITS:
|
case TIFFTAG_STONITS:
|
||||||
*va_arg(ap, double*) = td->td_stonits;
|
*va_arg(ap, double*) = td->td_stonits;
|
||||||
break;
|
break;
|
||||||
#if SUBIFD_SUPPORT
|
|
||||||
case TIFFTAG_SUBIFD:
|
case TIFFTAG_SUBIFD:
|
||||||
*va_arg(ap, uint16*) = td->td_nsubifd;
|
*va_arg(ap, uint16*) = td->td_nsubifd;
|
||||||
*va_arg(ap, uint32**) = td->td_subifd;
|
*va_arg(ap, uint32**) = td->td_subifd;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef YCBCR_SUPPORT
|
|
||||||
case TIFFTAG_YCBCRCOEFFICIENTS:
|
case TIFFTAG_YCBCRCOEFFICIENTS:
|
||||||
*va_arg(ap, float**) = td->td_ycbcrcoeffs;
|
*va_arg(ap, float**) = td->td_ycbcrcoeffs;
|
||||||
break;
|
break;
|
||||||
@@ -853,8 +844,6 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
*va_arg(ap, uint16*) = td->td_ycbcrsubsampling[0];
|
*va_arg(ap, uint16*) = td->td_ycbcrsubsampling[0];
|
||||||
*va_arg(ap, uint16*) = td->td_ycbcrsubsampling[1];
|
*va_arg(ap, uint16*) = td->td_ycbcrsubsampling[1];
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef COLORIMETRY_SUPPORT
|
|
||||||
case TIFFTAG_WHITEPOINT:
|
case TIFFTAG_WHITEPOINT:
|
||||||
*va_arg(ap, float**) = td->td_whitepoint;
|
*va_arg(ap, float**) = td->td_whitepoint;
|
||||||
break;
|
break;
|
||||||
@@ -871,8 +860,6 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
case TIFFTAG_REFERENCEBLACKWHITE:
|
case TIFFTAG_REFERENCEBLACKWHITE:
|
||||||
*va_arg(ap, float**) = td->td_refblackwhite;
|
*va_arg(ap, float**) = td->td_refblackwhite;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef CMYK_SUPPORT
|
|
||||||
case TIFFTAG_INKSET:
|
case TIFFTAG_INKSET:
|
||||||
*va_arg(ap, uint16*) = td->td_inkset;
|
*va_arg(ap, uint16*) = td->td_inkset;
|
||||||
break;
|
break;
|
||||||
@@ -889,25 +876,18 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
case TIFFTAG_TARGETPRINTER:
|
case TIFFTAG_TARGETPRINTER:
|
||||||
*va_arg(ap, char**) = td->td_targetprinter;
|
*va_arg(ap, char**) = td->td_targetprinter;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef ICC_SUPPORT
|
|
||||||
case TIFFTAG_ICCPROFILE:
|
case TIFFTAG_ICCPROFILE:
|
||||||
*va_arg(ap, uint32*) = td->td_profileLength;
|
*va_arg(ap, uint32*) = td->td_profileLength;
|
||||||
*va_arg(ap, void**) = td->td_profileData;
|
*va_arg(ap, void**) = td->td_profileData;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef PHOTOSHOP_SUPPORT
|
|
||||||
case TIFFTAG_PHOTOSHOP:
|
case TIFFTAG_PHOTOSHOP:
|
||||||
*va_arg(ap, uint32*) = td->td_photoshopLength;
|
*va_arg(ap, uint32*) = td->td_photoshopLength;
|
||||||
*va_arg(ap, void**) = td->td_photoshopData;
|
*va_arg(ap, void**) = td->td_photoshopData;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef IPTC_SUPPORT
|
|
||||||
case TIFFTAG_RICHTIFFIPTC:
|
case TIFFTAG_RICHTIFFIPTC:
|
||||||
*va_arg(ap, uint32*) = td->td_richtiffiptcLength;
|
*va_arg(ap, uint32*) = td->td_richtiffiptcLength;
|
||||||
*va_arg(ap, void**) = td->td_richtiffiptcData;
|
*va_arg(ap, void**) = td->td_richtiffiptcData;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case TIFFTAG_XMLPACKET:
|
case TIFFTAG_XMLPACKET:
|
||||||
*va_arg(ap, uint32*) = td->td_xmlpacketLength;
|
*va_arg(ap, uint32*) = td->td_xmlpacketLength;
|
||||||
*va_arg(ap, void**) = td->td_xmlpacketData;
|
*va_arg(ap, void**) = td->td_xmlpacketData;
|
||||||
@@ -951,7 +931,7 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
*/
|
*/
|
||||||
if( fip == NULL || fip->field_bit != FIELD_CUSTOM )
|
if( fip == NULL || fip->field_bit != FIELD_CUSTOM )
|
||||||
{
|
{
|
||||||
TIFFError("TIFFGetField",
|
TIFFError("_TIFFVGetField",
|
||||||
"%s: Invalid %stag \"%s\" (not supported by codec)",
|
"%s: Invalid %stag \"%s\" (not supported by codec)",
|
||||||
tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
|
tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
|
||||||
_TIFFFieldWithTag(tif, tag)->field_name);
|
_TIFFFieldWithTag(tif, tag)->field_name);
|
||||||
@@ -972,7 +952,7 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
|
|
||||||
if( fip->field_passcount )
|
if( fip->field_passcount )
|
||||||
{
|
{
|
||||||
*va_arg(ap, u_short *) = tv->count;
|
*va_arg(ap, u_short *) = (u_short) tv->count;
|
||||||
*va_arg(ap, void **) = tv->value;
|
*va_arg(ap, void **) = tv->value;
|
||||||
ret_val = 1;
|
ret_val = 1;
|
||||||
break;
|
break;
|
||||||
@@ -1053,33 +1033,19 @@ TIFFFreeDirectory(TIFF* tif)
|
|||||||
CleanupField(td_copyright);
|
CleanupField(td_copyright);
|
||||||
CleanupField(td_pagename);
|
CleanupField(td_pagename);
|
||||||
CleanupField(td_sampleinfo);
|
CleanupField(td_sampleinfo);
|
||||||
#if SUBIFD_SUPPORT
|
|
||||||
CleanupField(td_subifd);
|
CleanupField(td_subifd);
|
||||||
#endif
|
|
||||||
#ifdef YCBCR_SUPPORT
|
|
||||||
CleanupField(td_ycbcrcoeffs);
|
CleanupField(td_ycbcrcoeffs);
|
||||||
#endif
|
|
||||||
#ifdef CMYK_SUPPORT
|
|
||||||
CleanupField(td_inknames);
|
CleanupField(td_inknames);
|
||||||
CleanupField(td_targetprinter);
|
CleanupField(td_targetprinter);
|
||||||
#endif
|
|
||||||
#ifdef COLORIMETRY_SUPPORT
|
|
||||||
CleanupField(td_whitepoint);
|
CleanupField(td_whitepoint);
|
||||||
CleanupField(td_primarychromas);
|
CleanupField(td_primarychromas);
|
||||||
CleanupField(td_refblackwhite);
|
CleanupField(td_refblackwhite);
|
||||||
CleanupField(td_transferfunction[0]);
|
CleanupField(td_transferfunction[0]);
|
||||||
CleanupField(td_transferfunction[1]);
|
CleanupField(td_transferfunction[1]);
|
||||||
CleanupField(td_transferfunction[2]);
|
CleanupField(td_transferfunction[2]);
|
||||||
#endif
|
|
||||||
#ifdef ICC_SUPPORT
|
|
||||||
CleanupField(td_profileData);
|
CleanupField(td_profileData);
|
||||||
#endif
|
|
||||||
#ifdef PHOTOSHOP_SUPPORT
|
|
||||||
CleanupField(td_photoshopData);
|
CleanupField(td_photoshopData);
|
||||||
#endif
|
|
||||||
#ifdef IPTC_SUPPORT
|
|
||||||
CleanupField(td_richtiffiptcData);
|
CleanupField(td_richtiffiptcData);
|
||||||
#endif
|
|
||||||
CleanupField(td_xmlpacketData);
|
CleanupField(td_xmlpacketData);
|
||||||
CleanupField(td_stripoffset);
|
CleanupField(td_stripoffset);
|
||||||
CleanupField(td_stripbytecount);
|
CleanupField(td_stripbytecount);
|
||||||
@@ -1155,15 +1121,11 @@ TIFFDefaultDirectory(TIFF* tif)
|
|||||||
td->td_resolutionunit = RESUNIT_INCH;
|
td->td_resolutionunit = RESUNIT_INCH;
|
||||||
td->td_sampleformat = SAMPLEFORMAT_UINT;
|
td->td_sampleformat = SAMPLEFORMAT_UINT;
|
||||||
td->td_imagedepth = 1;
|
td->td_imagedepth = 1;
|
||||||
#ifdef YCBCR_SUPPORT
|
|
||||||
td->td_ycbcrsubsampling[0] = 2;
|
td->td_ycbcrsubsampling[0] = 2;
|
||||||
td->td_ycbcrsubsampling[1] = 2;
|
td->td_ycbcrsubsampling[1] = 2;
|
||||||
td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;
|
td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;
|
||||||
#endif
|
|
||||||
#ifdef CMYK_SUPPORT
|
|
||||||
td->td_inkset = INKSET_CMYK;
|
td->td_inkset = INKSET_CMYK;
|
||||||
td->td_ninks = 4;
|
td->td_ninks = 4;
|
||||||
#endif
|
|
||||||
tif->tif_postdecode = _TIFFNoPostDecode;
|
tif->tif_postdecode = _TIFFNoPostDecode;
|
||||||
tif->tif_tagmethods.vsetfield = _TIFFVSetField;
|
tif->tif_tagmethods.vsetfield = _TIFFVSetField;
|
||||||
tif->tif_tagmethods.vgetfield = _TIFFVGetField;
|
tif->tif_tagmethods.vgetfield = _TIFFVGetField;
|
||||||
@@ -1288,6 +1250,11 @@ TIFFSetDirectory(TIFF* tif, tdir_t dirn)
|
|||||||
* tif_curdir after successfully reading the directory.
|
* tif_curdir after successfully reading the directory.
|
||||||
*/
|
*/
|
||||||
tif->tif_curdir = (dirn - n) - 1;
|
tif->tif_curdir = (dirn - n) - 1;
|
||||||
|
/*
|
||||||
|
* Reset tif_dirnumber counter nad start new list of seen directories.
|
||||||
|
* We need this in order to prevent IFD loops.
|
||||||
|
*/
|
||||||
|
tif->tif_dirnumber = 0;
|
||||||
return (TIFFReadDirectory(tif));
|
return (TIFFReadDirectory(tif));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1301,6 +1268,11 @@ int
|
|||||||
TIFFSetSubDirectory(TIFF* tif, uint32 diroff)
|
TIFFSetSubDirectory(TIFF* tif, uint32 diroff)
|
||||||
{
|
{
|
||||||
tif->tif_nextdiroff = diroff;
|
tif->tif_nextdiroff = diroff;
|
||||||
|
/*
|
||||||
|
* Reset tif_dirnumber counter nad start new list of seen directories.
|
||||||
|
* We need this in order to prevent IFD loops.
|
||||||
|
*/
|
||||||
|
tif->tif_dirnumber = 0;
|
||||||
return (TIFFReadDirectory(tif));
|
return (TIFFReadDirectory(tif));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dir.h,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dir.h,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -251,7 +251,8 @@ extern "C" {
|
|||||||
extern void _TIFFSetupFieldInfo(TIFF*);
|
extern void _TIFFSetupFieldInfo(TIFF*);
|
||||||
extern void _TIFFPrintFieldInfo(TIFF*, FILE*);
|
extern void _TIFFPrintFieldInfo(TIFF*, FILE*);
|
||||||
extern TIFFDataType _TIFFSampleToTagType(TIFF*);
|
extern TIFFDataType _TIFFSampleToTagType(TIFF*);
|
||||||
extern const TIFFFieldInfo* _TIFFFindOrRegisterInfo( TIFF *tif, ttag_t tag,
|
extern const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif,
|
||||||
|
ttag_t tag,
|
||||||
TIFFDataType dt );
|
TIFFDataType dt );
|
||||||
extern TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,
|
extern TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,
|
||||||
TIFFDataType dt );
|
TIFFDataType dt );
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dirinfo.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dirinfo.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -140,10 +140,8 @@ const TIFFFieldInfo tiffFieldInfo[] = {
|
|||||||
TRUE, FALSE, "PageNumber" },
|
TRUE, FALSE, "PageNumber" },
|
||||||
{ TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE,
|
{ TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE,
|
||||||
TRUE, FALSE, "ColorResponseUnit" },
|
TRUE, FALSE, "ColorResponseUnit" },
|
||||||
#ifdef COLORIMETRY_SUPPORT
|
|
||||||
{ TIFFTAG_TRANSFERFUNCTION, -1,-1, TIFF_SHORT, FIELD_TRANSFERFUNCTION,
|
{ TIFFTAG_TRANSFERFUNCTION, -1,-1, TIFF_SHORT, FIELD_TRANSFERFUNCTION,
|
||||||
TRUE, FALSE, "TransferFunction" },
|
TRUE, FALSE, "TransferFunction" },
|
||||||
#endif
|
|
||||||
{ TIFFTAG_SOFTWARE, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
|
{ TIFFTAG_SOFTWARE, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
|
||||||
TRUE, FALSE, "Software" },
|
TRUE, FALSE, "Software" },
|
||||||
{ TIFFTAG_DATETIME, 20,20, TIFF_ASCII, FIELD_DATETIME,
|
{ TIFFTAG_DATETIME, 20,20, TIFF_ASCII, FIELD_DATETIME,
|
||||||
@@ -152,12 +150,10 @@ const TIFFFieldInfo tiffFieldInfo[] = {
|
|||||||
TRUE, FALSE, "Artist" },
|
TRUE, FALSE, "Artist" },
|
||||||
{ TIFFTAG_HOSTCOMPUTER, -1,-1, TIFF_ASCII, FIELD_HOSTCOMPUTER,
|
{ TIFFTAG_HOSTCOMPUTER, -1,-1, TIFF_ASCII, FIELD_HOSTCOMPUTER,
|
||||||
TRUE, FALSE, "HostComputer" },
|
TRUE, FALSE, "HostComputer" },
|
||||||
#ifdef COLORIMETRY_SUPPORT
|
|
||||||
{ TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL,FIELD_WHITEPOINT,
|
{ TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL,FIELD_WHITEPOINT,
|
||||||
TRUE, FALSE, "WhitePoint" },
|
TRUE, FALSE, "WhitePoint" },
|
||||||
{ TIFFTAG_PRIMARYCHROMATICITIES,6,6,TIFF_RATIONAL,FIELD_PRIMARYCHROMAS,
|
{ TIFFTAG_PRIMARYCHROMATICITIES,6,6,TIFF_RATIONAL,FIELD_PRIMARYCHROMAS,
|
||||||
TRUE, FALSE, "PrimaryChromaticities" },
|
TRUE, FALSE, "PrimaryChromaticities" },
|
||||||
#endif
|
|
||||||
{ TIFFTAG_COLORMAP, -1,-1, TIFF_SHORT, FIELD_COLORMAP,
|
{ TIFFTAG_COLORMAP, -1,-1, TIFF_SHORT, FIELD_COLORMAP,
|
||||||
TRUE, FALSE, "ColorMap" },
|
TRUE, FALSE, "ColorMap" },
|
||||||
{ TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, FIELD_HALFTONEHINTS,
|
{ TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, FIELD_HALFTONEHINTS,
|
||||||
@@ -176,11 +172,8 @@ const TIFFFieldInfo tiffFieldInfo[] = {
|
|||||||
FALSE, FALSE, "TileByteCounts" },
|
FALSE, FALSE, "TileByteCounts" },
|
||||||
{ TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS,
|
{ TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS,
|
||||||
FALSE, FALSE, "TileByteCounts" },
|
FALSE, FALSE, "TileByteCounts" },
|
||||||
#ifdef TIFFTAG_SUBIFD
|
|
||||||
{ TIFFTAG_SUBIFD, -1,-1, TIFF_LONG, FIELD_SUBIFD,
|
{ TIFFTAG_SUBIFD, -1,-1, TIFF_LONG, FIELD_SUBIFD,
|
||||||
TRUE, TRUE, "SubIFD" },
|
TRUE, TRUE, "SubIFD" },
|
||||||
#endif
|
|
||||||
#ifdef CMYK_SUPPORT /* 6.0 CMYK tags */
|
|
||||||
{ TIFFTAG_INKSET, 1, 1, TIFF_SHORT, FIELD_INKSET,
|
{ TIFFTAG_INKSET, 1, 1, TIFF_SHORT, FIELD_INKSET,
|
||||||
FALSE, FALSE, "InkSet" },
|
FALSE, FALSE, "InkSet" },
|
||||||
{ TIFFTAG_INKNAMES, -1,-1, TIFF_ASCII, FIELD_INKNAMES,
|
{ TIFFTAG_INKNAMES, -1,-1, TIFF_ASCII, FIELD_INKNAMES,
|
||||||
@@ -193,7 +186,6 @@ const TIFFFieldInfo tiffFieldInfo[] = {
|
|||||||
FALSE, FALSE, "DotRange" },
|
FALSE, FALSE, "DotRange" },
|
||||||
{ TIFFTAG_TARGETPRINTER, -1,-1, TIFF_ASCII, FIELD_TARGETPRINTER,
|
{ TIFFTAG_TARGETPRINTER, -1,-1, TIFF_ASCII, FIELD_TARGETPRINTER,
|
||||||
TRUE, FALSE, "TargetPrinter" },
|
TRUE, FALSE, "TargetPrinter" },
|
||||||
#endif
|
|
||||||
{ TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_SHORT, FIELD_EXTRASAMPLES,
|
{ TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_SHORT, FIELD_EXTRASAMPLES,
|
||||||
FALSE, FALSE, "ExtraSamples" },
|
FALSE, FALSE, "ExtraSamples" },
|
||||||
/* XXX for bogus Adobe Photoshop v2.5 files */
|
/* XXX for bogus Adobe Photoshop v2.5 files */
|
||||||
@@ -205,21 +197,17 @@ const TIFFFieldInfo tiffFieldInfo[] = {
|
|||||||
TRUE, FALSE, "SMinSampleValue" },
|
TRUE, FALSE, "SMinSampleValue" },
|
||||||
{ TIFFTAG_SMAXSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMAXSAMPLEVALUE,
|
{ TIFFTAG_SMAXSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMAXSAMPLEVALUE,
|
||||||
TRUE, FALSE, "SMaxSampleValue" },
|
TRUE, FALSE, "SMaxSampleValue" },
|
||||||
#ifdef YCBCR_SUPPORT /* 6.0 YCbCr tags */
|
|
||||||
{ TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, FIELD_YCBCRCOEFFICIENTS,
|
{ TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, FIELD_YCBCRCOEFFICIENTS,
|
||||||
FALSE, FALSE, "YCbCrCoefficients" },
|
FALSE, FALSE, "YCbCrCoefficients" },
|
||||||
{ TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, FIELD_YCBCRSUBSAMPLING,
|
{ TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, FIELD_YCBCRSUBSAMPLING,
|
||||||
FALSE, FALSE, "YCbCrSubsampling" },
|
FALSE, FALSE, "YCbCrSubsampling" },
|
||||||
{ TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, FIELD_YCBCRPOSITIONING,
|
{ TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, FIELD_YCBCRPOSITIONING,
|
||||||
FALSE, FALSE, "YCbCrPositioning" },
|
FALSE, FALSE, "YCbCrPositioning" },
|
||||||
#endif
|
|
||||||
#ifdef COLORIMETRY_SUPPORT
|
|
||||||
{ TIFFTAG_REFERENCEBLACKWHITE,6,6,TIFF_RATIONAL, FIELD_REFBLACKWHITE,
|
{ TIFFTAG_REFERENCEBLACKWHITE,6,6,TIFF_RATIONAL, FIELD_REFBLACKWHITE,
|
||||||
TRUE, FALSE, "ReferenceBlackWhite" },
|
TRUE, FALSE, "ReferenceBlackWhite" },
|
||||||
/* XXX temporarily accept LONG for backwards compatibility */
|
/* XXX temporarily accept LONG for backwards compatibility */
|
||||||
{ TIFFTAG_REFERENCEBLACKWHITE,6,6,TIFF_LONG, FIELD_REFBLACKWHITE,
|
{ TIFFTAG_REFERENCEBLACKWHITE,6,6,TIFF_LONG, FIELD_REFBLACKWHITE,
|
||||||
TRUE, FALSE, "ReferenceBlackWhite" },
|
TRUE, FALSE, "ReferenceBlackWhite" },
|
||||||
#endif
|
|
||||||
{ TIFFTAG_XMLPACKET, -1,-3, TIFF_UNDEFINED, FIELD_XMLPACKET,
|
{ TIFFTAG_XMLPACKET, -1,-3, TIFF_UNDEFINED, FIELD_XMLPACKET,
|
||||||
FALSE, TRUE, "XMLPacket" },
|
FALSE, TRUE, "XMLPacket" },
|
||||||
/* begin SGI tags */
|
/* begin SGI tags */
|
||||||
@@ -263,14 +251,10 @@ const TIFFFieldInfo tiffFieldInfo[] = {
|
|||||||
FALSE, TRUE, "RichTIFFIPTC" },
|
FALSE, TRUE, "RichTIFFIPTC" },
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef PHOTOSHOP_SUPPORT
|
|
||||||
{ TIFFTAG_PHOTOSHOP, -1,-3, TIFF_BYTE, FIELD_PHOTOSHOP,
|
{ TIFFTAG_PHOTOSHOP, -1,-3, TIFF_BYTE, FIELD_PHOTOSHOP,
|
||||||
FALSE, TRUE, "Photoshop" },
|
FALSE, TRUE, "Photoshop" },
|
||||||
#endif
|
|
||||||
#ifdef ICC_SUPPORT
|
|
||||||
{ TIFFTAG_ICCPROFILE, -1,-3, TIFF_UNDEFINED, FIELD_ICCPROFILE,
|
{ TIFFTAG_ICCPROFILE, -1,-3, TIFF_UNDEFINED, FIELD_ICCPROFILE,
|
||||||
FALSE, TRUE, "ICC Profile" },
|
FALSE, TRUE, "ICC Profile" },
|
||||||
#endif
|
|
||||||
{ TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, FIELD_STONITS,
|
{ TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, FIELD_STONITS,
|
||||||
FALSE, FALSE, "StoNits" },
|
FALSE, FALSE, "StoNits" },
|
||||||
};
|
};
|
||||||
@@ -308,7 +292,7 @@ tagCompare(const void* a, const void* b)
|
|||||||
if (ta->field_tag != tb->field_tag)
|
if (ta->field_tag != tb->field_tag)
|
||||||
return (ta->field_tag < tb->field_tag ? -1 : 1);
|
return (ta->field_tag < tb->field_tag ? -1 : 1);
|
||||||
else
|
else
|
||||||
return (tb->field_type < ta->field_type ? -1 : 1);
|
return ((int)tb->field_type - (int)ta->field_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -375,13 +359,14 @@ TIFFDataWidth(TIFFDataType type)
|
|||||||
case 4: /* TIFF_LONG */
|
case 4: /* TIFF_LONG */
|
||||||
case 9: /* TIFF_SLONG */
|
case 9: /* TIFF_SLONG */
|
||||||
case 11: /* TIFF_FLOAT */
|
case 11: /* TIFF_FLOAT */
|
||||||
|
case 13: /* TIFF_IFD */
|
||||||
return 4;
|
return 4;
|
||||||
case 5: /* TIFF_RATIONAL */
|
case 5: /* TIFF_RATIONAL */
|
||||||
case 10: /* TIFF_SRATIONAL */
|
case 10: /* TIFF_SRATIONAL */
|
||||||
case 12: /* TIFF_DOUBLE */
|
case 12: /* TIFF_DOUBLE */
|
||||||
return 8;
|
return 8;
|
||||||
default:
|
default:
|
||||||
return 1; /* will return safe value for unknown types */
|
return 0; /* will return 0 for unknown types */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +404,16 @@ _TIFFFindFieldInfo(TIFF* tif, ttag_t tag, TIFFDataType dt)
|
|||||||
(dt == TIFF_ANY || dt == last->field_type))
|
(dt == TIFF_ANY || dt == last->field_type))
|
||||||
return (last);
|
return (last);
|
||||||
/* NB: if table gets big, use sorted search (e.g. binary search) */
|
/* NB: if table gets big, use sorted search (e.g. binary search) */
|
||||||
for (i = 0, n = tif->tif_nfields; i < n; i++) {
|
if(dt != TIFF_ANY) {
|
||||||
|
TIFFFieldInfo key = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
key.field_tag = tag;
|
||||||
|
key.field_type = dt;
|
||||||
|
return((const TIFFFieldInfo *) bsearch(&key,
|
||||||
|
tif->tif_fieldinfo,
|
||||||
|
tif->tif_nfields,
|
||||||
|
sizeof(TIFFFieldInfo),
|
||||||
|
tagCompare));
|
||||||
|
} else for (i = 0, n = tif->tif_nfields; i < n; i++) {
|
||||||
const TIFFFieldInfo* fip = tif->tif_fieldinfo[i];
|
const TIFFFieldInfo* fip = tif->tif_fieldinfo[i];
|
||||||
if (fip->field_tag == tag &&
|
if (fip->field_tag == tag &&
|
||||||
(dt == TIFF_ANY || fip->field_type == dt))
|
(dt == TIFF_ANY || fip->field_type == dt))
|
||||||
@@ -465,7 +459,7 @@ _TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType field_type)
|
|||||||
{
|
{
|
||||||
TIFFFieldInfo *fld;
|
TIFFFieldInfo *fld;
|
||||||
|
|
||||||
fld = _TIFFmalloc(sizeof (TIFFFieldInfo));
|
fld = (TIFFFieldInfo *) _TIFFmalloc(sizeof (TIFFFieldInfo));
|
||||||
_TIFFmemset( fld, 0, sizeof(TIFFFieldInfo) );
|
_TIFFmemset( fld, 0, sizeof(TIFFFieldInfo) );
|
||||||
|
|
||||||
fld->field_tag = tag;
|
fld->field_tag = tag;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dirread.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dirread.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -97,6 +97,27 @@ TIFFReadDirectory(TIFF* tif)
|
|||||||
tif->tif_diroff = tif->tif_nextdiroff;
|
tif->tif_diroff = tif->tif_nextdiroff;
|
||||||
if (tif->tif_diroff == 0) /* no more directories */
|
if (tif->tif_diroff == 0) /* no more directories */
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX: Trick to prevent IFD looping. The one can create TIFF file
|
||||||
|
* with looped directory pointers. We will maintain a list of already
|
||||||
|
* seen directories and check every IFD offset against this list.
|
||||||
|
*/
|
||||||
|
for (n = 0; n < tif->tif_dirnumber; n++) {
|
||||||
|
if (tif->tif_dirlist[n] == tif->tif_diroff)
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
tif->tif_dirnumber++;
|
||||||
|
tif->tif_dirlist = _TIFFrealloc(tif->tif_dirlist,
|
||||||
|
tif->tif_dirnumber * sizeof(toff_t));
|
||||||
|
if (!tif->tif_dirlist) {
|
||||||
|
TIFFError(module,
|
||||||
|
"%.1000s: Failed to allocate space for IFD list",
|
||||||
|
tif->tif_name);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
tif->tif_dirlist[tif->tif_dirnumber - 1] = tif->tif_diroff;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cleanup any previous compression state.
|
* Cleanup any previous compression state.
|
||||||
*/
|
*/
|
||||||
@@ -227,7 +248,7 @@ TIFFReadDirectory(TIFF* tif)
|
|||||||
if( TIFFReassignTagToIgnore(TIS_EXTRACT, dp->tdir_tag) )
|
if( TIFFReassignTagToIgnore(TIS_EXTRACT, dp->tdir_tag) )
|
||||||
dp->tdir_tag = IGNORE;
|
dp->tdir_tag = IGNORE;
|
||||||
|
|
||||||
if (dp->tdir_tag == IGNORE)
|
if (fix >= tif->tif_nfields || dp->tdir_tag == IGNORE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -238,8 +259,7 @@ TIFFReadDirectory(TIFF* tif)
|
|||||||
if (dp->tdir_tag < tif->tif_fieldinfo[fix]->field_tag) {
|
if (dp->tdir_tag < tif->tif_fieldinfo[fix]->field_tag) {
|
||||||
if (!diroutoforderwarning) {
|
if (!diroutoforderwarning) {
|
||||||
TIFFWarning(module,
|
TIFFWarning(module,
|
||||||
"%.1000s: invalid TIFF directory; "
|
"%.1000s: invalid TIFF directory; tags are not sorted in ascending order",
|
||||||
"tags are not sorted in ascending order",
|
|
||||||
tif->tif_name);
|
tif->tif_name);
|
||||||
diroutoforderwarning = 1;
|
diroutoforderwarning = 1;
|
||||||
}
|
}
|
||||||
@@ -248,7 +268,7 @@ TIFFReadDirectory(TIFF* tif)
|
|||||||
while (fix < tif->tif_nfields &&
|
while (fix < tif->tif_nfields &&
|
||||||
tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
|
tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
|
||||||
fix++;
|
fix++;
|
||||||
if (fix == tif->tif_nfields ||
|
if (fix >= tif->tif_nfields ||
|
||||||
tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) {
|
tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) {
|
||||||
|
|
||||||
TIFFWarning(module,
|
TIFFWarning(module,
|
||||||
@@ -257,13 +277,13 @@ TIFFReadDirectory(TIFF* tif)
|
|||||||
|
|
||||||
TIFFMergeFieldInfo( tif,
|
TIFFMergeFieldInfo( tif,
|
||||||
_TIFFCreateAnonFieldInfo( tif,
|
_TIFFCreateAnonFieldInfo( tif,
|
||||||
dp->tdir_tag, dp->tdir_type ),
|
dp->tdir_tag,
|
||||||
|
(TIFFDataType) dp->tdir_type ),
|
||||||
1 );
|
1 );
|
||||||
fix = 0;
|
fix = 0;
|
||||||
while (fix < tif->tif_nfields &&
|
while (fix < tif->tif_nfields &&
|
||||||
tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
|
tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
|
||||||
fix++;
|
fix++;
|
||||||
dp->tdir_tag = IGNORE;
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Null out old tags that we ignore.
|
* Null out old tags that we ignore.
|
||||||
@@ -285,7 +305,8 @@ TIFFReadDirectory(TIFF* tif)
|
|||||||
fip->field_tag != dp->tdir_tag) {
|
fip->field_tag != dp->tdir_tag) {
|
||||||
TIFFWarning(module,
|
TIFFWarning(module,
|
||||||
"%.1000s: wrong data type %d for \"%s\"; tag ignored",
|
"%.1000s: wrong data type %d for \"%s\"; tag ignored",
|
||||||
tif->tif_name, dp->tdir_type, fip[-1].field_name);
|
tif->tif_name, dp->tdir_type,
|
||||||
|
fip[-1].field_name);
|
||||||
goto ignore;
|
goto ignore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -546,8 +567,7 @@ TIFFReadDirectory(TIFF* tif)
|
|||||||
* strip image.
|
* strip image.
|
||||||
*/
|
*/
|
||||||
TIFFWarning(module,
|
TIFFWarning(module,
|
||||||
"%.1000s: Bogus \"%s\" field, ignoring "
|
"%.1000s: Bogus \"%s\" field, ignoring and calculating from imagelength",
|
||||||
"and calculating from imagelength",
|
|
||||||
tif->tif_name,
|
tif->tif_name,
|
||||||
_TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
|
_TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
|
||||||
if(EstimateStripByteCounts(tif, dir, dircount) < 0)
|
if(EstimateStripByteCounts(tif, dir, dircount) < 0)
|
||||||
@@ -593,6 +613,8 @@ bad:
|
|||||||
static int
|
static int
|
||||||
EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
|
EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
|
||||||
{
|
{
|
||||||
|
static const char module[] = "EstimateStripByteCounts";
|
||||||
|
|
||||||
register TIFFDirEntry *dp;
|
register TIFFDirEntry *dp;
|
||||||
register TIFFDirectory *td = &tif->tif_dir;
|
register TIFFDirectory *td = &tif->tif_dir;
|
||||||
uint16 i;
|
uint16 i;
|
||||||
@@ -613,14 +635,14 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
|
|||||||
/* calculate amount of space used by indirect values */
|
/* calculate amount of space used by indirect values */
|
||||||
for (dp = dir, n = dircount; n > 0; n--, dp++)
|
for (dp = dir, n = dircount; n > 0; n--, dp++)
|
||||||
{
|
{
|
||||||
uint32 cc;
|
uint32 cc = TIFFDataWidth((TIFFDataType) dp->tdir_type);
|
||||||
if(dp->tdir_tag == IGNORE)
|
if (cc == 0) {
|
||||||
{
|
TIFFError(module,
|
||||||
TIFFError(tif->tif_name,
|
"%.1000s: Cannot determine size of unknown tag type %d",
|
||||||
"Cannot determine StripByteCounts values, because of tags with unknown sizes");
|
tif->tif_name, dp->tdir_type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
cc = dp->tdir_count*TIFFDataWidth(dp->tdir_type);
|
cc = cc * dp->tdir_count;
|
||||||
if (cc > sizeof (uint32))
|
if (cc > sizeof (uint32))
|
||||||
space += cc;
|
space += cc;
|
||||||
}
|
}
|
||||||
@@ -656,8 +678,11 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
|
|||||||
static void
|
static void
|
||||||
MissingRequired(TIFF* tif, const char* tagname)
|
MissingRequired(TIFF* tif, const char* tagname)
|
||||||
{
|
{
|
||||||
TIFFError(tif->tif_name,
|
static const char module[] = "MissingRequired";
|
||||||
"TIFF directory is missing required \"%s\" field", tagname);
|
|
||||||
|
TIFFError(module,
|
||||||
|
"%.1000s: TIFF directory is missing required \"%s\" field",
|
||||||
|
tif->tif_name, tagname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -685,7 +710,7 @@ CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
|
|||||||
static tsize_t
|
static tsize_t
|
||||||
TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
|
TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
|
||||||
{
|
{
|
||||||
int w = TIFFDataWidth(dir->tdir_type);
|
int w = TIFFDataWidth((TIFFDataType) dir->tdir_type);
|
||||||
tsize_t cc = dir->tdir_count * w;
|
tsize_t cc = dir->tdir_count * w;
|
||||||
|
|
||||||
if (!isMapped(tif)) {
|
if (!isMapped(tif)) {
|
||||||
@@ -906,7 +931,7 @@ TIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)
|
|||||||
uint32* l;
|
uint32* l;
|
||||||
|
|
||||||
l = (uint32*)CheckMalloc(tif,
|
l = (uint32*)CheckMalloc(tif,
|
||||||
dir->tdir_count*TIFFDataWidth(dir->tdir_type),
|
dir->tdir_count*TIFFDataWidth((TIFFDataType) dir->tdir_type),
|
||||||
"to fetch array of rationals");
|
"to fetch array of rationals");
|
||||||
if (l) {
|
if (l) {
|
||||||
if (TIFFFetchData(tif, dir, (char *)l)) {
|
if (TIFFFetchData(tif, dir, (char *)l)) {
|
||||||
@@ -1292,14 +1317,14 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)
|
|||||||
if( (status = TIFFFetchShortArray(tif, dir, dp)) != 0 ) {
|
if( (status = TIFFFetchShortArray(tif, dir, dp)) != 0 ) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < nstrips && i < dir->tdir_count; i++ )
|
for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ )
|
||||||
{
|
{
|
||||||
lp[i] = dp[i];
|
lp[i] = dp[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_TIFFfree((char*) dp);
|
_TIFFfree((char*) dp);
|
||||||
|
|
||||||
} else if( nstrips != dir->tdir_count ) {
|
} else if( nstrips != (int) dir->tdir_count ) {
|
||||||
/* Special case to correct length */
|
/* Special case to correct length */
|
||||||
|
|
||||||
uint32* dp = (uint32*) CheckMalloc(tif,
|
uint32* dp = (uint32*) CheckMalloc(tif,
|
||||||
@@ -1311,7 +1336,7 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)
|
|||||||
if( status != 0 ) {
|
if( status != 0 ) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < nstrips && i < dir->tdir_count; i++ )
|
for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ )
|
||||||
{
|
{
|
||||||
lp[i] = dp[i];
|
lp[i] = dp[i];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dirwrite.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_dirwrite.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -451,82 +451,124 @@ TIFFWriteNormalTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip)
|
|||||||
case TIFF_SSHORT:
|
case TIFF_SSHORT:
|
||||||
if (wc > 1) {
|
if (wc > 1) {
|
||||||
uint16* wp;
|
uint16* wp;
|
||||||
if (wc == (u_short) TIFF_VARIABLE)
|
if (wc == (u_short) TIFF_VARIABLE
|
||||||
|
|| fip->field_passcount)
|
||||||
TIFFGetField(tif, fip->field_tag, &wc, &wp);
|
TIFFGetField(tif, fip->field_tag, &wc, &wp);
|
||||||
else
|
else
|
||||||
TIFFGetField(tif, fip->field_tag, &wp);
|
TIFFGetField(tif, fip->field_tag, &wp);
|
||||||
if (!WRITEF(TIFFWriteShortArray, wp))
|
if (!WRITEF(TIFFWriteShortArray, wp))
|
||||||
return (0);
|
return (0);
|
||||||
|
} else {
|
||||||
|
if (fip->field_passcount) {
|
||||||
|
uint16* wp;
|
||||||
|
TIFFGetField(tif, fip->field_tag, &wc, &wp);
|
||||||
|
if (!WRITEF(TIFFWriteShortArray, wp))
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
uint16 sv;
|
uint16 sv;
|
||||||
TIFFGetField(tif, fip->field_tag, &sv);
|
TIFFGetField(tif, fip->field_tag, &sv);
|
||||||
dir->tdir_offset =
|
dir->tdir_offset =
|
||||||
TIFFInsertData(tif, dir->tdir_type, sv);
|
TIFFInsertData(tif, dir->tdir_type, sv);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TIFF_LONG:
|
case TIFF_LONG:
|
||||||
case TIFF_SLONG:
|
case TIFF_SLONG:
|
||||||
|
case TIFF_IFD:
|
||||||
if (wc > 1) {
|
if (wc > 1) {
|
||||||
uint32* lp;
|
uint32* lp;
|
||||||
if (wc == (u_short) TIFF_VARIABLE)
|
if (wc == (u_short) TIFF_VARIABLE
|
||||||
|
|| fip->field_passcount)
|
||||||
TIFFGetField(tif, fip->field_tag, &wc, &lp);
|
TIFFGetField(tif, fip->field_tag, &wc, &lp);
|
||||||
else
|
else
|
||||||
TIFFGetField(tif, fip->field_tag, &lp);
|
TIFFGetField(tif, fip->field_tag, &lp);
|
||||||
if (!WRITEF(TIFFWriteLongArray, lp))
|
if (!WRITEF(TIFFWriteLongArray, lp))
|
||||||
return (0);
|
return (0);
|
||||||
|
} else {
|
||||||
|
if (fip->field_passcount) {
|
||||||
|
uint32* lp;
|
||||||
|
TIFFGetField(tif, fip->field_tag, &wc, &lp);
|
||||||
|
if (!WRITEF(TIFFWriteLongArray, lp))
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* XXX handle LONG->SHORT conversion */
|
/* XXX handle LONG->SHORT conversion */
|
||||||
TIFFGetField(tif, fip->field_tag, &dir->tdir_offset);
|
TIFFGetField(tif, fip->field_tag,
|
||||||
|
&dir->tdir_offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TIFF_RATIONAL:
|
case TIFF_RATIONAL:
|
||||||
case TIFF_SRATIONAL:
|
case TIFF_SRATIONAL:
|
||||||
if (wc > 1) {
|
if (wc > 1) {
|
||||||
float* fp;
|
float* fp;
|
||||||
if (wc == (u_short) TIFF_VARIABLE)
|
if (wc == (u_short) TIFF_VARIABLE
|
||||||
|
|| fip->field_passcount)
|
||||||
TIFFGetField(tif, fip->field_tag, &wc, &fp);
|
TIFFGetField(tif, fip->field_tag, &wc, &fp);
|
||||||
else
|
else
|
||||||
TIFFGetField(tif, fip->field_tag, &fp);
|
TIFFGetField(tif, fip->field_tag, &fp);
|
||||||
if (!WRITEF(TIFFWriteRationalArray, fp))
|
if (!WRITEF(TIFFWriteRationalArray, fp))
|
||||||
return (0);
|
return (0);
|
||||||
|
} else {
|
||||||
|
if (fip->field_passcount) {
|
||||||
|
float* fp;
|
||||||
|
TIFFGetField(tif, fip->field_tag, &wc, &fp);
|
||||||
|
if (!WRITEF(TIFFWriteRationalArray, fp))
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
float fv;
|
float fv;
|
||||||
TIFFGetField(tif, fip->field_tag, &fv);
|
TIFFGetField(tif, fip->field_tag, &fv);
|
||||||
if (!WRITEF(TIFFWriteRationalArray, &fv))
|
if (!WRITEF(TIFFWriteRationalArray, &fv))
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TIFF_FLOAT:
|
case TIFF_FLOAT:
|
||||||
if (wc > 1) {
|
if (wc > 1) {
|
||||||
float* fp;
|
float* fp;
|
||||||
if (wc == (u_short) TIFF_VARIABLE)
|
if (wc == (u_short) TIFF_VARIABLE
|
||||||
|
|| fip->field_passcount)
|
||||||
TIFFGetField(tif, fip->field_tag, &wc, &fp);
|
TIFFGetField(tif, fip->field_tag, &wc, &fp);
|
||||||
else
|
else
|
||||||
TIFFGetField(tif, fip->field_tag, &fp);
|
TIFFGetField(tif, fip->field_tag, &fp);
|
||||||
if (!WRITEF(TIFFWriteFloatArray, fp))
|
if (!WRITEF(TIFFWriteFloatArray, fp))
|
||||||
return (0);
|
return (0);
|
||||||
|
} else {
|
||||||
|
if (fip->field_passcount) {
|
||||||
|
float* fp;
|
||||||
|
TIFFGetField(tif, fip->field_tag, &wc, &fp);
|
||||||
|
if (!WRITEF(TIFFWriteFloatArray, fp))
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
float fv;
|
float fv;
|
||||||
TIFFGetField(tif, fip->field_tag, &fv);
|
TIFFGetField(tif, fip->field_tag, &fv);
|
||||||
if (!WRITEF(TIFFWriteFloatArray, &fv))
|
if (!WRITEF(TIFFWriteFloatArray, &fv))
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TIFF_DOUBLE:
|
case TIFF_DOUBLE:
|
||||||
if (wc > 1) {
|
if (wc > 1) {
|
||||||
double* dp;
|
double* dp;
|
||||||
if (wc == (u_short) TIFF_VARIABLE)
|
if (wc == (u_short) TIFF_VARIABLE
|
||||||
|
|| fip->field_passcount)
|
||||||
TIFFGetField(tif, fip->field_tag, &wc, &dp);
|
TIFFGetField(tif, fip->field_tag, &wc, &dp);
|
||||||
else
|
else
|
||||||
TIFFGetField(tif, fip->field_tag, &dp);
|
TIFFGetField(tif, fip->field_tag, &dp);
|
||||||
if (!WRITEF(TIFFWriteDoubleArray, dp))
|
if (!WRITEF(TIFFWriteDoubleArray, dp))
|
||||||
return (0);
|
return (0);
|
||||||
|
} else {
|
||||||
|
if (fip->field_passcount) {
|
||||||
|
double* dp;
|
||||||
|
TIFFGetField(tif, fip->field_tag, &wc, &dp);
|
||||||
|
if (!WRITEF(TIFFWriteDoubleArray, dp))
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
double dv;
|
double dv;
|
||||||
TIFFGetField(tif, fip->field_tag, &dv);
|
TIFFGetField(tif, fip->field_tag, &dv);
|
||||||
if (!WRITEF(TIFFWriteDoubleArray, &dv))
|
if (!WRITEF(TIFFWriteDoubleArray, &dv))
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TIFF_ASCII:
|
case TIFF_ASCII:
|
||||||
{ char* cp;
|
{ char* cp;
|
||||||
@@ -543,7 +585,8 @@ TIFFWriteNormalTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip)
|
|||||||
case TIFF_SBYTE:
|
case TIFF_SBYTE:
|
||||||
if (wc > 1) {
|
if (wc > 1) {
|
||||||
char* cp;
|
char* cp;
|
||||||
if (wc == (u_short) TIFF_VARIABLE) {
|
if (wc == (u_short) TIFF_VARIABLE
|
||||||
|
|| fip->field_passcount) {
|
||||||
TIFFGetField(tif, fip->field_tag, &wc, &cp);
|
TIFFGetField(tif, fip->field_tag, &wc, &cp);
|
||||||
dir->tdir_count = wc;
|
dir->tdir_count = wc;
|
||||||
} else if (wc == (u_short) TIFF_VARIABLE2) {
|
} else if (wc == (u_short) TIFF_VARIABLE2) {
|
||||||
@@ -553,12 +596,20 @@ TIFFWriteNormalTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip)
|
|||||||
TIFFGetField(tif, fip->field_tag, &cp);
|
TIFFGetField(tif, fip->field_tag, &cp);
|
||||||
if (!TIFFWriteByteArray(tif, dir, cp))
|
if (!TIFFWriteByteArray(tif, dir, cp))
|
||||||
return (0);
|
return (0);
|
||||||
|
} else {
|
||||||
|
if (fip->field_passcount) {
|
||||||
|
char* cp;
|
||||||
|
TIFFGetField(tif, fip->field_tag, &wc, &cp);
|
||||||
|
dir->tdir_count = wc;
|
||||||
|
if (!TIFFWriteByteArray(tif, dir, cp))
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
char cv;
|
char cv;
|
||||||
TIFFGetField(tif, fip->field_tag, &cv);
|
TIFFGetField(tif, fip->field_tag, &cv);
|
||||||
if (!TIFFWriteByteArray(tif, dir, &cv))
|
if (!TIFFWriteByteArray(tif, dir, &cv))
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIFF_UNDEFINED:
|
case TIFF_UNDEFINED:
|
||||||
@@ -1008,7 +1059,7 @@ TIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dir->tdir_offset = tif->tif_dataoff;
|
dir->tdir_offset = tif->tif_dataoff;
|
||||||
cc = dir->tdir_count * TIFFDataWidth(dir->tdir_type);
|
cc = dir->tdir_count * TIFFDataWidth((TIFFDataType) dir->tdir_type);
|
||||||
if (SeekOK(tif, dir->tdir_offset) &&
|
if (SeekOK(tif, dir->tdir_offset) &&
|
||||||
WriteOK(tif, cp, cc)) {
|
WriteOK(tif, cp, cc)) {
|
||||||
tif->tif_dataoff += (cc + 1) & ~1;
|
tif->tif_dataoff += (cc + 1) & ~1;
|
||||||
@@ -1046,7 +1097,11 @@ TIFFRewriteDirectory( TIFF *tif )
|
|||||||
tif->tif_header.tiff_diroff = 0;
|
tif->tif_header.tiff_diroff = 0;
|
||||||
tif->tif_diroff = 0;
|
tif->tif_diroff = 0;
|
||||||
|
|
||||||
|
#if defined(__hpux) && defined(__LP64__)
|
||||||
|
#define HDROFF(f) ((toff_t)(unsigned long) &(((TIFFHeader*) 0)->f))
|
||||||
|
#else
|
||||||
#define HDROFF(f) ((toff_t) &(((TIFFHeader*) 0)->f))
|
#define HDROFF(f) ((toff_t) &(((TIFFHeader*) 0)->f))
|
||||||
|
#endif
|
||||||
TIFFSeekFile(tif, HDROFF(tiff_diroff), SEEK_SET);
|
TIFFSeekFile(tif, HDROFF(tiff_diroff), SEEK_SET);
|
||||||
if (!WriteOK(tif, &(tif->tif_header.tiff_diroff),
|
if (!WriteOK(tif, &(tif->tif_header.tiff_diroff),
|
||||||
sizeof (tif->tif_diroff)))
|
sizeof (tif->tif_diroff)))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_extension.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_extension.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -47,7 +47,7 @@ ttag_t TIFFGetTagListEntry( TIFF *tif, int tag_index )
|
|||||||
TIFFDirectory* td = &tif->tif_dir;
|
TIFFDirectory* td = &tif->tif_dir;
|
||||||
|
|
||||||
if( tag_index < 0 || tag_index >= td->td_customValueCount )
|
if( tag_index < 0 || tag_index >= td->td_customValueCount )
|
||||||
return -1;
|
return (ttag_t) -1;
|
||||||
else
|
else
|
||||||
return td->td_customValues[tag_index].info->field_tag;
|
return td->td_customValues[tag_index].info->field_tag;
|
||||||
}
|
}
|
||||||
@@ -99,10 +99,10 @@ void TIFFSetClientInfo( TIFF *tif, void *data, const char *name )
|
|||||||
** Create a new link.
|
** Create a new link.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
link = _TIFFmalloc(sizeof(TIFFClientInfoLink));
|
link = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));
|
||||||
link->next = tif->tif_clientinfo;
|
link->next = tif->tif_clientinfo;
|
||||||
link->name = _TIFFmalloc(strlen(name)+1);
|
link->name = (char *) _TIFFmalloc(strlen(name)+1);
|
||||||
strcpy( link->name, name );
|
strcpy(link->name, name);
|
||||||
link->data = data;
|
link->data = data;
|
||||||
|
|
||||||
tif->tif_clientinfo = link;
|
tif->tif_clientinfo = link;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_fax3.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_fax3.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990-1997 Sam Leffler
|
* Copyright (c) 1990-1997 Sam Leffler
|
||||||
@@ -66,8 +66,11 @@ typedef struct {
|
|||||||
} Fax3BaseState;
|
} Fax3BaseState;
|
||||||
#define Fax3State(tif) ((Fax3BaseState*) (tif)->tif_data)
|
#define Fax3State(tif) ((Fax3BaseState*) (tif)->tif_data)
|
||||||
|
|
||||||
|
typedef enum { G3_1D, G3_2D } Ttag;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Fax3BaseState b;
|
Fax3BaseState b;
|
||||||
|
|
||||||
|
/* Decoder state info */
|
||||||
const u_char* bitmap; /* bit reversal table */
|
const u_char* bitmap; /* bit reversal table */
|
||||||
uint32 data; /* current i/o byte/word */
|
uint32 data; /* current i/o byte/word */
|
||||||
int bit; /* current i/o bit in byte */
|
int bit; /* current i/o bit in byte */
|
||||||
@@ -76,20 +79,15 @@ typedef struct {
|
|||||||
uint32* runs; /* b&w runs for current/previous row */
|
uint32* runs; /* b&w runs for current/previous row */
|
||||||
uint32* refruns; /* runs for reference line */
|
uint32* refruns; /* runs for reference line */
|
||||||
uint32* curruns; /* runs for current line */
|
uint32* curruns; /* runs for current line */
|
||||||
} Fax3DecodeState;
|
|
||||||
#define DecoderState(tif) ((Fax3DecodeState*) Fax3State(tif))
|
|
||||||
|
|
||||||
typedef enum { G3_1D, G3_2D } Ttag;
|
/* Encoder state info */
|
||||||
typedef struct {
|
|
||||||
Fax3BaseState b;
|
|
||||||
int data; /* current i/o byte */
|
|
||||||
int bit; /* current i/o bit in byte */
|
|
||||||
Ttag tag; /* encoding state */
|
Ttag tag; /* encoding state */
|
||||||
u_char* refline; /* reference line for 2d decoding */
|
u_char* refline; /* reference line for 2d decoding */
|
||||||
int k; /* #rows left that can be 2d encoded */
|
int k; /* #rows left that can be 2d encoded */
|
||||||
int maxk; /* max #rows that can be 2d encoded */
|
int maxk; /* max #rows that can be 2d encoded */
|
||||||
} Fax3EncodeState;
|
} Fax3CodecState;
|
||||||
#define EncoderState(tif) ((Fax3EncodeState*) Fax3State(tif))
|
#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
|
||||||
|
#define EncoderState(tif) ((Fax3CodecState*) Fax3State(tif))
|
||||||
|
|
||||||
#define is2DEncoding(sp) \
|
#define is2DEncoding(sp) \
|
||||||
(sp->b.groupoptions & GROUP3OPT_2DENCODING)
|
(sp->b.groupoptions & GROUP3OPT_2DENCODING)
|
||||||
@@ -105,7 +103,7 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
#define DECLARE_STATE(tif, sp, mod) \
|
#define DECLARE_STATE(tif, sp, mod) \
|
||||||
static const char module[] = mod; \
|
static const char module[] = mod; \
|
||||||
Fax3DecodeState* sp = DecoderState(tif); \
|
Fax3CodecState* sp = DecoderState(tif); \
|
||||||
int a0; /* reference element */ \
|
int a0; /* reference element */ \
|
||||||
int lastx = sp->b.rowpixels; /* last element in row */ \
|
int lastx = sp->b.rowpixels; /* last element in row */ \
|
||||||
uint32 BitAcc; /* bit accumulator */ \
|
uint32 BitAcc; /* bit accumulator */ \
|
||||||
@@ -149,7 +147,7 @@ typedef struct {
|
|||||||
static int
|
static int
|
||||||
Fax3PreDecode(TIFF* tif, tsample_t s)
|
Fax3PreDecode(TIFF* tif, tsample_t s)
|
||||||
{
|
{
|
||||||
Fax3DecodeState* sp = DecoderState(tif);
|
Fax3CodecState* sp = DecoderState(tif);
|
||||||
|
|
||||||
(void) s;
|
(void) s;
|
||||||
assert(sp != NULL);
|
assert(sp != NULL);
|
||||||
@@ -240,8 +238,6 @@ Fax3Decode1D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
|||||||
(*sp->fill)(buf, thisrun, pa, lastx);
|
(*sp->fill)(buf, thisrun, pa, lastx);
|
||||||
buf += sp->b.rowbytes;
|
buf += sp->b.rowbytes;
|
||||||
occ -= sp->b.rowbytes;
|
occ -= sp->b.rowbytes;
|
||||||
if (occ != 0)
|
|
||||||
tif->tif_row++;
|
|
||||||
continue;
|
continue;
|
||||||
EOF1D: /* premature EOF */
|
EOF1D: /* premature EOF */
|
||||||
CLEANUP_RUNS();
|
CLEANUP_RUNS();
|
||||||
@@ -294,8 +290,6 @@ Fax3Decode2D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
|||||||
SWAP(uint32*, sp->curruns, sp->refruns);
|
SWAP(uint32*, sp->curruns, sp->refruns);
|
||||||
buf += sp->b.rowbytes;
|
buf += sp->b.rowbytes;
|
||||||
occ -= sp->b.rowbytes;
|
occ -= sp->b.rowbytes;
|
||||||
if (occ != 0)
|
|
||||||
tif->tif_row++;
|
|
||||||
continue;
|
continue;
|
||||||
EOF2D: /* premature EOF */
|
EOF2D: /* premature EOF */
|
||||||
CLEANUP_RUNS();
|
CLEANUP_RUNS();
|
||||||
@@ -457,6 +451,8 @@ Fax3SetupState(TIFF* tif)
|
|||||||
Fax3BaseState* sp = Fax3State(tif);
|
Fax3BaseState* sp = Fax3State(tif);
|
||||||
long rowbytes, rowpixels;
|
long rowbytes, rowpixels;
|
||||||
int needsRefLine;
|
int needsRefLine;
|
||||||
|
Fax3CodecState* dsp = DecoderState(tif);
|
||||||
|
uint32 nruns;
|
||||||
|
|
||||||
if (td->td_bitspersample != 1) {
|
if (td->td_bitspersample != 1) {
|
||||||
TIFFError(tif->tif_name,
|
TIFFError(tif->tif_name,
|
||||||
@@ -482,10 +478,8 @@ Fax3SetupState(TIFF* tif)
|
|||||||
(sp->groupoptions & GROUP3OPT_2DENCODING) ||
|
(sp->groupoptions & GROUP3OPT_2DENCODING) ||
|
||||||
td->td_compression == COMPRESSION_CCITTFAX4
|
td->td_compression == COMPRESSION_CCITTFAX4
|
||||||
);
|
);
|
||||||
if (sp->rw_mode == O_RDONLY) { /* 1d/2d decoding */
|
|
||||||
Fax3DecodeState* dsp = DecoderState(tif);
|
nruns = needsRefLine ? 2*TIFFroundup(rowpixels,32) : rowpixels;
|
||||||
uint32 nruns = needsRefLine ?
|
|
||||||
2*TIFFroundup(rowpixels,32) : rowpixels;
|
|
||||||
|
|
||||||
dsp->runs = (uint32*) _TIFFmalloc((2*nruns+3)*sizeof (uint32));
|
dsp->runs = (uint32*) _TIFFmalloc((2*nruns+3)*sizeof (uint32));
|
||||||
if (dsp->runs == NULL) {
|
if (dsp->runs == NULL) {
|
||||||
@@ -504,8 +498,9 @@ Fax3SetupState(TIFF* tif)
|
|||||||
tif->tif_decodestrip = Fax3Decode2D;
|
tif->tif_decodestrip = Fax3Decode2D;
|
||||||
tif->tif_decodetile = Fax3Decode2D;
|
tif->tif_decodetile = Fax3Decode2D;
|
||||||
}
|
}
|
||||||
} else if (needsRefLine) { /* 2d encoding */
|
|
||||||
Fax3EncodeState* esp = EncoderState(tif);
|
if (needsRefLine) { /* 2d encoding */
|
||||||
|
Fax3CodecState* esp = EncoderState(tif);
|
||||||
/*
|
/*
|
||||||
* 2d encoding requires a scanline
|
* 2d encoding requires a scanline
|
||||||
* buffer for the ``reference line''; the
|
* buffer for the ``reference line''; the
|
||||||
@@ -532,14 +527,14 @@ Fax3SetupState(TIFF* tif)
|
|||||||
#define Fax3FlushBits(tif, sp) { \
|
#define Fax3FlushBits(tif, sp) { \
|
||||||
if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \
|
if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \
|
||||||
(void) TIFFFlushData1(tif); \
|
(void) TIFFFlushData1(tif); \
|
||||||
*(tif)->tif_rawcp++ = (sp)->data; \
|
*(tif)->tif_rawcp++ = (tidataval_t) (sp)->data; \
|
||||||
(tif)->tif_rawcc++; \
|
(tif)->tif_rawcc++; \
|
||||||
(sp)->data = 0, (sp)->bit = 8; \
|
(sp)->data = 0, (sp)->bit = 8; \
|
||||||
}
|
}
|
||||||
#define _FlushBits(tif) { \
|
#define _FlushBits(tif) { \
|
||||||
if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \
|
if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \
|
||||||
(void) TIFFFlushData1(tif); \
|
(void) TIFFFlushData1(tif); \
|
||||||
*(tif)->tif_rawcp++ = data; \
|
*(tif)->tif_rawcp++ = (tidataval_t) data; \
|
||||||
(tif)->tif_rawcc++; \
|
(tif)->tif_rawcc++; \
|
||||||
data = 0, bit = 8; \
|
data = 0, bit = 8; \
|
||||||
}
|
}
|
||||||
@@ -565,7 +560,7 @@ static const int _msbmask[9] =
|
|||||||
static void
|
static void
|
||||||
Fax3PutBits(TIFF* tif, u_int bits, u_int length)
|
Fax3PutBits(TIFF* tif, u_int bits, u_int length)
|
||||||
{
|
{
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
Fax3CodecState* sp = EncoderState(tif);
|
||||||
u_int bit = sp->bit;
|
u_int bit = sp->bit;
|
||||||
int data = sp->data;
|
int data = sp->data;
|
||||||
|
|
||||||
@@ -600,7 +595,7 @@ Fax3PutBits(TIFF* tif, u_int bits, u_int length)
|
|||||||
static void
|
static void
|
||||||
putspan(TIFF* tif, int32 span, const tableentry* tab)
|
putspan(TIFF* tif, int32 span, const tableentry* tab)
|
||||||
{
|
{
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
Fax3CodecState* sp = EncoderState(tif);
|
||||||
u_int bit = sp->bit;
|
u_int bit = sp->bit;
|
||||||
int data = sp->data;
|
int data = sp->data;
|
||||||
u_int code, length;
|
u_int code, length;
|
||||||
@@ -643,7 +638,7 @@ putspan(TIFF* tif, int32 span, const tableentry* tab)
|
|||||||
static void
|
static void
|
||||||
Fax3PutEOL(TIFF* tif)
|
Fax3PutEOL(TIFF* tif)
|
||||||
{
|
{
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
Fax3CodecState* sp = EncoderState(tif);
|
||||||
u_int bit = sp->bit;
|
u_int bit = sp->bit;
|
||||||
int data = sp->data;
|
int data = sp->data;
|
||||||
u_int code, length, tparm;
|
u_int code, length, tparm;
|
||||||
@@ -680,7 +675,7 @@ Fax3PutEOL(TIFF* tif)
|
|||||||
static int
|
static int
|
||||||
Fax3PreEncode(TIFF* tif, tsample_t s)
|
Fax3PreEncode(TIFF* tif, tsample_t s)
|
||||||
{
|
{
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
Fax3CodecState* sp = EncoderState(tif);
|
||||||
|
|
||||||
(void) s;
|
(void) s;
|
||||||
assert(sp != NULL);
|
assert(sp != NULL);
|
||||||
@@ -908,7 +903,7 @@ find1span(u_char* bp, int32 bs, int32 be)
|
|||||||
static int
|
static int
|
||||||
Fax3Encode1DRow(TIFF* tif, u_char* bp, uint32 bits)
|
Fax3Encode1DRow(TIFF* tif, u_char* bp, uint32 bits)
|
||||||
{
|
{
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
Fax3CodecState* sp = EncoderState(tif);
|
||||||
int32 span;
|
int32 span;
|
||||||
uint32 bs = 0;
|
uint32 bs = 0;
|
||||||
|
|
||||||
@@ -1000,7 +995,7 @@ Fax3Encode2DRow(TIFF* tif, u_char* bp, u_char* rp, uint32 bits)
|
|||||||
static int
|
static int
|
||||||
Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
Fax3CodecState* sp = EncoderState(tif);
|
||||||
|
|
||||||
(void) s;
|
(void) s;
|
||||||
while ((long)cc > 0) {
|
while ((long)cc > 0) {
|
||||||
@@ -1027,8 +1022,6 @@ Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
}
|
}
|
||||||
bp += sp->b.rowbytes;
|
bp += sp->b.rowbytes;
|
||||||
cc -= sp->b.rowbytes;
|
cc -= sp->b.rowbytes;
|
||||||
if (cc != 0)
|
|
||||||
tif->tif_row++;
|
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@@ -1036,7 +1029,7 @@ Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
static int
|
static int
|
||||||
Fax3PostEncode(TIFF* tif)
|
Fax3PostEncode(TIFF* tif)
|
||||||
{
|
{
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
Fax3CodecState* sp = EncoderState(tif);
|
||||||
|
|
||||||
if (sp->bit != 8)
|
if (sp->bit != 8)
|
||||||
Fax3FlushBits(tif, sp);
|
Fax3FlushBits(tif, sp);
|
||||||
@@ -1047,7 +1040,7 @@ static void
|
|||||||
Fax3Close(TIFF* tif)
|
Fax3Close(TIFF* tif)
|
||||||
{
|
{
|
||||||
if ((Fax3State(tif)->mode & FAXMODE_NORTC) == 0) {
|
if ((Fax3State(tif)->mode & FAXMODE_NORTC) == 0) {
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
Fax3CodecState* sp = EncoderState(tif);
|
||||||
u_int code = EOL;
|
u_int code = EOL;
|
||||||
u_int length = 12;
|
u_int length = 12;
|
||||||
int i;
|
int i;
|
||||||
@@ -1064,15 +1057,13 @@ static void
|
|||||||
Fax3Cleanup(TIFF* tif)
|
Fax3Cleanup(TIFF* tif)
|
||||||
{
|
{
|
||||||
if (tif->tif_data) {
|
if (tif->tif_data) {
|
||||||
if (Fax3State(tif)->rw_mode == O_RDONLY) {
|
Fax3CodecState* sp = DecoderState(tif);
|
||||||
Fax3DecodeState* sp = DecoderState(tif);
|
|
||||||
if (sp->runs)
|
if (sp->runs)
|
||||||
_TIFFfree(sp->runs);
|
_TIFFfree(sp->runs);
|
||||||
} else {
|
|
||||||
Fax3EncodeState* sp = EncoderState(tif);
|
|
||||||
if (sp->refline)
|
if (sp->refline)
|
||||||
_TIFFfree(sp->refline);
|
_TIFFfree(sp->refline);
|
||||||
}
|
|
||||||
if (Fax3State(tif)->subaddress)
|
if (Fax3State(tif)->subaddress)
|
||||||
_TIFFfree(Fax3State(tif)->subaddress);
|
_TIFFfree(Fax3State(tif)->subaddress);
|
||||||
_TIFFfree(tif->tif_data);
|
_TIFFfree(tif->tif_data);
|
||||||
@@ -1131,7 +1122,6 @@ Fax3VSetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
sp->mode = va_arg(ap, int);
|
sp->mode = va_arg(ap, int);
|
||||||
return (1); /* NB: pseudo tag */
|
return (1); /* NB: pseudo tag */
|
||||||
case TIFFTAG_FAXFILLFUNC:
|
case TIFFTAG_FAXFILLFUNC:
|
||||||
if (sp->rw_mode == O_RDONLY)
|
|
||||||
DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);
|
DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);
|
||||||
return (1); /* NB: pseudo tag */
|
return (1); /* NB: pseudo tag */
|
||||||
case TIFFTAG_GROUP3OPTIONS:
|
case TIFFTAG_GROUP3OPTIONS:
|
||||||
@@ -1174,7 +1164,6 @@ Fax3VGetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
*va_arg(ap, int*) = sp->mode;
|
*va_arg(ap, int*) = sp->mode;
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_FAXFILLFUNC:
|
case TIFFTAG_FAXFILLFUNC:
|
||||||
if (sp->rw_mode == O_RDONLY)
|
|
||||||
*va_arg(ap, TIFFFaxFillFunc*) = DecoderState(tif)->fill;
|
*va_arg(ap, TIFFFaxFillFunc*) = DecoderState(tif)->fill;
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_GROUP3OPTIONS:
|
case TIFFTAG_GROUP3OPTIONS:
|
||||||
@@ -1269,12 +1258,8 @@ InitCCITTFax3(TIFF* tif)
|
|||||||
/*
|
/*
|
||||||
* Allocate state block so tag methods have storage to record values.
|
* Allocate state block so tag methods have storage to record values.
|
||||||
*/
|
*/
|
||||||
if (tif->tif_mode == O_RDONLY)
|
|
||||||
tif->tif_data = (tidata_t)
|
tif->tif_data = (tidata_t)
|
||||||
_TIFFmalloc(sizeof (Fax3DecodeState));
|
_TIFFmalloc(sizeof (Fax3CodecState));
|
||||||
else
|
|
||||||
tif->tif_data = (tidata_t)
|
|
||||||
_TIFFmalloc(sizeof (Fax3EncodeState));
|
|
||||||
|
|
||||||
if (tif->tif_data == NULL) {
|
if (tif->tif_data == NULL) {
|
||||||
TIFFError("TIFFInitCCITTFax3",
|
TIFFError("TIFFInitCCITTFax3",
|
||||||
@@ -1299,11 +1284,9 @@ InitCCITTFax3(TIFF* tif)
|
|||||||
sp->recvparams = 0;
|
sp->recvparams = 0;
|
||||||
sp->subaddress = NULL;
|
sp->subaddress = NULL;
|
||||||
|
|
||||||
if (sp->rw_mode == O_RDONLY) {
|
tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
|
||||||
tif->tif_flags |= TIFF_NOBITREV;/* decoder does bit reversal */
|
|
||||||
DecoderState(tif)->runs = NULL;
|
DecoderState(tif)->runs = NULL;
|
||||||
TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
|
TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
|
||||||
} else
|
|
||||||
EncoderState(tif)->refline = NULL;
|
EncoderState(tif)->refline = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1375,8 +1358,6 @@ Fax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
|||||||
SWAP(uint32*, sp->curruns, sp->refruns);
|
SWAP(uint32*, sp->curruns, sp->refruns);
|
||||||
buf += sp->b.rowbytes;
|
buf += sp->b.rowbytes;
|
||||||
occ -= sp->b.rowbytes;
|
occ -= sp->b.rowbytes;
|
||||||
if (occ != 0)
|
|
||||||
tif->tif_row++;
|
|
||||||
continue;
|
continue;
|
||||||
EOFG4:
|
EOFG4:
|
||||||
NeedBits16( 13, BADG4 );
|
NeedBits16( 13, BADG4 );
|
||||||
@@ -1401,7 +1382,7 @@ Fax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
|||||||
static int
|
static int
|
||||||
Fax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
Fax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
Fax3EncodeState *sp = EncoderState(tif);
|
Fax3CodecState *sp = EncoderState(tif);
|
||||||
|
|
||||||
(void) s;
|
(void) s;
|
||||||
while ((long)cc > 0) {
|
while ((long)cc > 0) {
|
||||||
@@ -1410,8 +1391,6 @@ Fax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
_TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);
|
_TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);
|
||||||
bp += sp->b.rowbytes;
|
bp += sp->b.rowbytes;
|
||||||
cc -= sp->b.rowbytes;
|
cc -= sp->b.rowbytes;
|
||||||
if (cc != 0)
|
|
||||||
tif->tif_row++;
|
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@@ -1419,7 +1398,7 @@ Fax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
static int
|
static int
|
||||||
Fax4PostEncode(TIFF* tif)
|
Fax4PostEncode(TIFF* tif)
|
||||||
{
|
{
|
||||||
Fax3EncodeState *sp = EncoderState(tif);
|
Fax3CodecState *sp = EncoderState(tif);
|
||||||
|
|
||||||
/* terminate strip w/ EOFB */
|
/* terminate strip w/ EOFB */
|
||||||
Fax3PutBits(tif, EOL, 12);
|
Fax3PutBits(tif, EOL, 12);
|
||||||
@@ -1492,8 +1471,6 @@ Fax3DecodeRLE(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
|||||||
}
|
}
|
||||||
buf += sp->b.rowbytes;
|
buf += sp->b.rowbytes;
|
||||||
occ -= sp->b.rowbytes;
|
occ -= sp->b.rowbytes;
|
||||||
if (occ != 0)
|
|
||||||
tif->tif_row++;
|
|
||||||
continue;
|
continue;
|
||||||
EOFRLE: /* premature EOF */
|
EOFRLE: /* premature EOF */
|
||||||
(*sp->fill)(buf, thisrun, pa, lastx);
|
(*sp->fill)(buf, thisrun, pa, lastx);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_getimage.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_getimage.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1991-1997 Sam Leffler
|
* Copyright (c) 1991-1997 Sam Leffler
|
||||||
@@ -42,6 +42,28 @@ static int pickTileSeparateCase(TIFFRGBAImage*);
|
|||||||
|
|
||||||
static const char photoTag[] = "PhotometricInterpretation";
|
static const char photoTag[] = "PhotometricInterpretation";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper constants used in Orientation tag handling
|
||||||
|
*/
|
||||||
|
#define FLIP_VERTICALLY 0x01
|
||||||
|
#define FLIP_HORIZONTALLY 0x02
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Color conversion constants. We will define display types here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
TIFFDisplay display_sRGB = {
|
||||||
|
{ /* XYZ -> luminance matrix */
|
||||||
|
{ 3.2410F, -1.5374F, -0.4986F },
|
||||||
|
{ -0.9692F, 1.8760F, 0.0416F },
|
||||||
|
{ 0.0556F, -0.2040F, 1.0570F }
|
||||||
|
},
|
||||||
|
100.0F, 100.0F, 100.0F, /* Light o/p for reference white */
|
||||||
|
255, 255, 255, /* Pixel values for ref. white */
|
||||||
|
1.0F, 1.0F, 1.0F, /* Residual light o/p for black pixel */
|
||||||
|
2.4F, 2.4F, 2.4F, /* Gamma values for the three guns */
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the image to see if TIFFReadRGBAImage can deal with it.
|
* Check the image to see if TIFFReadRGBAImage can deal with it.
|
||||||
* 1/0 is returned according to whether or not the image can
|
* 1/0 is returned according to whether or not the image can
|
||||||
@@ -117,7 +139,6 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef CMYK_SUPPORT
|
|
||||||
case PHOTOMETRIC_SEPARATED:
|
case PHOTOMETRIC_SEPARATED:
|
||||||
if (td->td_inkset != INKSET_CMYK) {
|
if (td->td_inkset != INKSET_CMYK) {
|
||||||
sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
|
sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
|
||||||
@@ -130,7 +151,6 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case PHOTOMETRIC_LOGL:
|
case PHOTOMETRIC_LOGL:
|
||||||
if (td->td_compression != COMPRESSION_SGILOG) {
|
if (td->td_compression != COMPRESSION_SGILOG) {
|
||||||
sprintf(emsg, "Sorry, LogL data must have %s=%d",
|
sprintf(emsg, "Sorry, LogL data must have %s=%d",
|
||||||
@@ -151,6 +171,8 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PHOTOMETRIC_CIELAB:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(emsg, "Sorry, can not handle image with %s=%d",
|
sprintf(emsg, "Sorry, can not handle image with %s=%d",
|
||||||
photoTag, photometric);
|
photoTag, photometric);
|
||||||
@@ -170,6 +192,8 @@ TIFFRGBAImageEnd(TIFFRGBAImage* img)
|
|||||||
_TIFFfree(img->PALmap), img->PALmap = NULL;
|
_TIFFfree(img->PALmap), img->PALmap = NULL;
|
||||||
if (img->ycbcr)
|
if (img->ycbcr)
|
||||||
_TIFFfree(img->ycbcr), img->ycbcr = NULL;
|
_TIFFfree(img->ycbcr), img->ycbcr = NULL;
|
||||||
|
if (img->cielab)
|
||||||
|
_TIFFfree(img->cielab), img->cielab = NULL;
|
||||||
|
|
||||||
if( img->redcmap ) {
|
if( img->redcmap ) {
|
||||||
_TIFFfree( img->redcmap );
|
_TIFFfree( img->redcmap );
|
||||||
@@ -206,6 +230,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
|||||||
img->redcmap = NULL;
|
img->redcmap = NULL;
|
||||||
img->greencmap = NULL;
|
img->greencmap = NULL;
|
||||||
img->bluecmap = NULL;
|
img->bluecmap = NULL;
|
||||||
|
img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */
|
||||||
|
|
||||||
img->tif = tif;
|
img->tif = tif;
|
||||||
img->stoponerr = stop;
|
img->stoponerr = stop;
|
||||||
@@ -215,7 +240,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
|||||||
case 8: case 16:
|
case 8: case 16:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(emsg, "Sorry, can not image with %d-bit samples",
|
sprintf(emsg, "Sorry, can not handle images with %d-bit samples",
|
||||||
img->bitspersample);
|
img->bitspersample);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -375,6 +400,8 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
|||||||
img->photometric = PHOTOMETRIC_RGB; /* little white lie */
|
img->photometric = PHOTOMETRIC_RGB; /* little white lie */
|
||||||
img->bitspersample = 8;
|
img->bitspersample = 8;
|
||||||
break;
|
break;
|
||||||
|
case PHOTOMETRIC_CIELAB:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(emsg, "Sorry, can not handle image with %s=%d",
|
sprintf(emsg, "Sorry, can not handle image with %s=%d",
|
||||||
photoTag, img->photometric);
|
photoTag, img->photometric);
|
||||||
@@ -384,6 +411,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
|||||||
img->BWmap = NULL;
|
img->BWmap = NULL;
|
||||||
img->PALmap = NULL;
|
img->PALmap = NULL;
|
||||||
img->ycbcr = NULL;
|
img->ycbcr = NULL;
|
||||||
|
img->cielab = NULL;
|
||||||
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
|
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
|
||||||
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
|
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
|
||||||
TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
|
TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
|
||||||
@@ -414,17 +442,21 @@ TIFFRGBAImageGet(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the specified image into an ABGR-format raster.
|
* Read the specified image into an ABGR-format rastertaking in account
|
||||||
|
* specified orientation.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
TIFFReadRGBAImage(TIFF* tif,
|
TIFFReadRGBAImageOriented(TIFF* tif,
|
||||||
uint32 rwidth, uint32 rheight, uint32* raster, int stop)
|
uint32 rwidth, uint32 rheight, uint32* raster,
|
||||||
|
int orientation, int stop)
|
||||||
{
|
{
|
||||||
char emsg[1024];
|
char emsg[1024];
|
||||||
TIFFRGBAImage img;
|
TIFFRGBAImage img;
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) {
|
if (TIFFRGBAImageOK(tif, emsg) &&
|
||||||
|
TIFFRGBAImageBegin(&img, tif, stop, emsg)) {
|
||||||
|
img.req_orientation = orientation;
|
||||||
/* XXX verify rwidth and rheight against width and height */
|
/* XXX verify rwidth and rheight against width and height */
|
||||||
ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth,
|
ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth,
|
||||||
rwidth, img.height);
|
rwidth, img.height);
|
||||||
@@ -436,34 +468,77 @@ TIFFReadRGBAImage(TIFF* tif,
|
|||||||
return (ok);
|
return (ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32
|
/*
|
||||||
setorientation(TIFFRGBAImage* img, uint32 h)
|
* Read the specified image into an ABGR-format raster. Use bottom left
|
||||||
|
* origin for raster by default.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
TIFFReadRGBAImage(TIFF* tif,
|
||||||
|
uint32 rwidth, uint32 rheight, uint32* raster, int stop)
|
||||||
{
|
{
|
||||||
TIFF* tif = img->tif;
|
return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,
|
||||||
uint32 y;
|
ORIENTATION_BOTLEFT, stop);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
setorientation(TIFFRGBAImage* img)
|
||||||
|
{
|
||||||
switch (img->orientation) {
|
switch (img->orientation) {
|
||||||
case ORIENTATION_BOTRIGHT:
|
|
||||||
case ORIENTATION_RIGHTBOT: /* XXX */
|
|
||||||
case ORIENTATION_LEFTBOT: /* XXX */
|
|
||||||
TIFFWarning(TIFFFileName(tif), "using bottom-left orientation");
|
|
||||||
img->orientation = ORIENTATION_BOTLEFT;
|
|
||||||
/* fall thru... */
|
|
||||||
case ORIENTATION_BOTLEFT:
|
|
||||||
y = 0;
|
|
||||||
break;
|
|
||||||
case ORIENTATION_TOPRIGHT:
|
|
||||||
case ORIENTATION_RIGHTTOP: /* XXX */
|
|
||||||
case ORIENTATION_LEFTTOP: /* XXX */
|
|
||||||
default:
|
|
||||||
TIFFWarning(TIFFFileName(tif), "using top-left orientation");
|
|
||||||
img->orientation = ORIENTATION_TOPLEFT;
|
|
||||||
/* fall thru... */
|
|
||||||
case ORIENTATION_TOPLEFT:
|
case ORIENTATION_TOPLEFT:
|
||||||
y = h-1;
|
case ORIENTATION_LEFTTOP:
|
||||||
break;
|
if (img->req_orientation == ORIENTATION_TOPRIGHT ||
|
||||||
|
img->req_orientation == ORIENTATION_RIGHTTOP)
|
||||||
|
return FLIP_HORIZONTALLY;
|
||||||
|
else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
|
||||||
|
img->req_orientation == ORIENTATION_RIGHTBOT)
|
||||||
|
return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
|
||||||
|
else if (img->req_orientation == ORIENTATION_BOTLEFT ||
|
||||||
|
img->req_orientation == ORIENTATION_LEFTBOT)
|
||||||
|
return FLIP_VERTICALLY;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
case ORIENTATION_TOPRIGHT:
|
||||||
|
case ORIENTATION_RIGHTTOP:
|
||||||
|
if (img->req_orientation == ORIENTATION_TOPLEFT ||
|
||||||
|
img->req_orientation == ORIENTATION_LEFTTOP)
|
||||||
|
return FLIP_HORIZONTALLY;
|
||||||
|
else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
|
||||||
|
img->req_orientation == ORIENTATION_RIGHTBOT)
|
||||||
|
return FLIP_VERTICALLY;
|
||||||
|
else if (img->req_orientation == ORIENTATION_BOTLEFT ||
|
||||||
|
img->req_orientation == ORIENTATION_LEFTBOT)
|
||||||
|
return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
case ORIENTATION_BOTRIGHT:
|
||||||
|
case ORIENTATION_RIGHTBOT:
|
||||||
|
if (img->req_orientation == ORIENTATION_TOPLEFT ||
|
||||||
|
img->req_orientation == ORIENTATION_LEFTTOP)
|
||||||
|
return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
|
||||||
|
else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
|
||||||
|
img->req_orientation == ORIENTATION_RIGHTTOP)
|
||||||
|
return FLIP_VERTICALLY;
|
||||||
|
else if (img->req_orientation == ORIENTATION_BOTLEFT ||
|
||||||
|
img->req_orientation == ORIENTATION_LEFTBOT)
|
||||||
|
return FLIP_HORIZONTALLY;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
case ORIENTATION_BOTLEFT:
|
||||||
|
case ORIENTATION_LEFTBOT:
|
||||||
|
if (img->req_orientation == ORIENTATION_TOPLEFT ||
|
||||||
|
img->req_orientation == ORIENTATION_LEFTTOP)
|
||||||
|
return FLIP_VERTICALLY;
|
||||||
|
else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
|
||||||
|
img->req_orientation == ORIENTATION_RIGHTTOP)
|
||||||
|
return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
|
||||||
|
else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
|
||||||
|
img->req_orientation == ORIENTATION_RIGHTBOT)
|
||||||
|
return FLIP_HORIZONTALLY;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
default: /* NOTREACHED */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return (y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -477,13 +552,13 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
{
|
{
|
||||||
TIFF* tif = img->tif;
|
TIFF* tif = img->tif;
|
||||||
tileContigRoutine put = img->put.contig;
|
tileContigRoutine put = img->put.contig;
|
||||||
uint16 orientation;
|
uint32 col, row, y, rowstoread;
|
||||||
uint32 col, row, y, rowstoread, ret = 1;
|
|
||||||
uint32 pos;
|
uint32 pos;
|
||||||
uint32 tw, th;
|
uint32 tw, th;
|
||||||
u_char* buf;
|
u_char* buf;
|
||||||
int32 fromskew, toskew;
|
int32 fromskew, toskew;
|
||||||
uint32 nrow;
|
uint32 nrow;
|
||||||
|
int ret = 1, flip;
|
||||||
|
|
||||||
buf = (u_char*) _TIFFmalloc(TIFFTileSize(tif));
|
buf = (u_char*) _TIFFmalloc(TIFFTileSize(tif));
|
||||||
if (buf == 0) {
|
if (buf == 0) {
|
||||||
@@ -492,9 +567,17 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
}
|
}
|
||||||
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
|
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
|
||||||
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
|
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
|
||||||
y = setorientation(img, h);
|
|
||||||
orientation = img->orientation;
|
flip = setorientation(img);
|
||||||
toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? tw+w : tw-w);
|
if (flip & FLIP_VERTICALLY) {
|
||||||
|
y = h - 1;
|
||||||
|
toskew = -(int32)(tw + w);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
y = 0;
|
||||||
|
toskew = -(int32)(tw - w);
|
||||||
|
}
|
||||||
|
|
||||||
for (row = 0; row < h; row += nrow)
|
for (row = 0; row < h; row += nrow)
|
||||||
{
|
{
|
||||||
rowstoread = th - (row + img->row_offset) % th;
|
rowstoread = th - (row + img->row_offset) % th;
|
||||||
@@ -525,13 +608,28 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
{
|
{
|
||||||
(*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + pos);
|
(*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
y += (orientation == ORIENTATION_TOPLEFT ? -(int32) nrow : (int32) nrow);
|
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
||||||
}
|
}
|
||||||
_TIFFfree(buf);
|
_TIFFfree(buf);
|
||||||
|
|
||||||
|
if (flip & FLIP_HORIZONTALLY) {
|
||||||
|
uint32 line;
|
||||||
|
|
||||||
|
for (line = 0; line < h; line++) {
|
||||||
|
uint32 *left = raster + (line * w);
|
||||||
|
uint32 *right = left + w - 1;
|
||||||
|
|
||||||
|
while ( left < right ) {
|
||||||
|
uint32 temp = *left;
|
||||||
|
*left = *right;
|
||||||
|
*right = temp;
|
||||||
|
left++, right--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,7 +644,6 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
{
|
{
|
||||||
TIFF* tif = img->tif;
|
TIFF* tif = img->tif;
|
||||||
tileSeparateRoutine put = img->put.separate;
|
tileSeparateRoutine put = img->put.separate;
|
||||||
uint16 orientation;
|
|
||||||
uint32 col, row, y, rowstoread;
|
uint32 col, row, y, rowstoread;
|
||||||
uint32 pos;
|
uint32 pos;
|
||||||
uint32 tw, th;
|
uint32 tw, th;
|
||||||
@@ -559,7 +656,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
int32 fromskew, toskew;
|
int32 fromskew, toskew;
|
||||||
int alpha = img->alpha;
|
int alpha = img->alpha;
|
||||||
uint32 nrow;
|
uint32 nrow;
|
||||||
int ret = 1;
|
int ret = 1, flip;
|
||||||
|
|
||||||
tilesize = TIFFTileSize(tif);
|
tilesize = TIFFTileSize(tif);
|
||||||
buf = (u_char*) _TIFFmalloc(4*tilesize);
|
buf = (u_char*) _TIFFmalloc(4*tilesize);
|
||||||
@@ -575,9 +672,17 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
memset(a, 0xff, tilesize);
|
memset(a, 0xff, tilesize);
|
||||||
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
|
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
|
||||||
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
|
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
|
||||||
y = setorientation(img, h);
|
|
||||||
orientation = img->orientation;
|
flip = setorientation(img);
|
||||||
toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? tw+w : tw-w);
|
if (flip & FLIP_VERTICALLY) {
|
||||||
|
y = h - 1;
|
||||||
|
toskew = -(int32)(tw + w);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
y = 0;
|
||||||
|
toskew = -(int32)(tw - w);
|
||||||
|
}
|
||||||
|
|
||||||
for (row = 0; row < h; row += nrow)
|
for (row = 0; row < h; row += nrow)
|
||||||
{
|
{
|
||||||
rowstoread = th - (row + img->row_offset) % th;
|
rowstoread = th - (row + img->row_offset) % th;
|
||||||
@@ -630,8 +735,25 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
y += (orientation == ORIENTATION_TOPLEFT ?-(int32) nrow : (int32) nrow);
|
y += (flip & FLIP_VERTICALLY ?-(int32) nrow : (int32) nrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flip & FLIP_HORIZONTALLY) {
|
||||||
|
uint32 line;
|
||||||
|
|
||||||
|
for (line = 0; line < h; line++) {
|
||||||
|
uint32 *left = raster + (line * w);
|
||||||
|
uint32 *right = left + w - 1;
|
||||||
|
|
||||||
|
while ( left < right ) {
|
||||||
|
uint32 temp = *left;
|
||||||
|
*left = *right;
|
||||||
|
*right = temp;
|
||||||
|
left++, right--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_TIFFfree(buf);
|
_TIFFfree(buf);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@@ -647,7 +769,6 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
{
|
{
|
||||||
TIFF* tif = img->tif;
|
TIFF* tif = img->tif;
|
||||||
tileContigRoutine put = img->put.contig;
|
tileContigRoutine put = img->put.contig;
|
||||||
uint16 orientation;
|
|
||||||
uint32 row, y, nrow, rowstoread;
|
uint32 row, y, nrow, rowstoread;
|
||||||
uint32 pos;
|
uint32 pos;
|
||||||
u_char* buf;
|
u_char* buf;
|
||||||
@@ -655,16 +776,24 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
uint32 imagewidth = img->width;
|
uint32 imagewidth = img->width;
|
||||||
tsize_t scanline;
|
tsize_t scanline;
|
||||||
int32 fromskew, toskew;
|
int32 fromskew, toskew;
|
||||||
int ret = 1;
|
int ret = 1, flip;
|
||||||
|
|
||||||
buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
|
buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
|
||||||
if (buf == 0) {
|
if (buf == 0) {
|
||||||
TIFFError(TIFFFileName(tif), "No space for strip buffer");
|
TIFFError(TIFFFileName(tif), "No space for strip buffer");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
y = setorientation(img, h);
|
|
||||||
orientation = img->orientation;
|
flip = setorientation(img);
|
||||||
toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? w+w : w-w);
|
if (flip & FLIP_VERTICALLY) {
|
||||||
|
y = h - 1;
|
||||||
|
toskew = -(int32)(w + w);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
y = 0;
|
||||||
|
toskew = -(int32)(w - w);
|
||||||
|
}
|
||||||
|
|
||||||
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||||
scanline = TIFFScanlineSize(tif);
|
scanline = TIFFScanlineSize(tif);
|
||||||
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
||||||
@@ -684,8 +813,25 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
|
|
||||||
pos = ((row + img->row_offset) % rowsperstrip) * scanline;
|
pos = ((row + img->row_offset) % rowsperstrip) * scanline;
|
||||||
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos);
|
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos);
|
||||||
y += (orientation == ORIENTATION_TOPLEFT ?-(int32) nrow : (int32) nrow);
|
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flip & FLIP_HORIZONTALLY) {
|
||||||
|
uint32 line;
|
||||||
|
|
||||||
|
for (line = 0; line < h; line++) {
|
||||||
|
uint32 *left = raster + (line * w);
|
||||||
|
uint32 *right = left + w - 1;
|
||||||
|
|
||||||
|
while ( left < right ) {
|
||||||
|
uint32 temp = *left;
|
||||||
|
*left = *right;
|
||||||
|
*right = temp;
|
||||||
|
left++, right--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_TIFFfree(buf);
|
_TIFFfree(buf);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@@ -701,7 +847,6 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
{
|
{
|
||||||
TIFF* tif = img->tif;
|
TIFF* tif = img->tif;
|
||||||
tileSeparateRoutine put = img->put.separate;
|
tileSeparateRoutine put = img->put.separate;
|
||||||
uint16 orientation;
|
|
||||||
u_char *buf;
|
u_char *buf;
|
||||||
u_char *r, *g, *b, *a;
|
u_char *r, *g, *b, *a;
|
||||||
uint32 row, y, nrow, rowstoread;
|
uint32 row, y, nrow, rowstoread;
|
||||||
@@ -712,7 +857,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
tsize_t stripsize;
|
tsize_t stripsize;
|
||||||
int32 fromskew, toskew;
|
int32 fromskew, toskew;
|
||||||
int alpha = img->alpha;
|
int alpha = img->alpha;
|
||||||
int ret = 1;
|
int ret = 1, flip;
|
||||||
|
|
||||||
stripsize = TIFFStripSize(tif);
|
stripsize = TIFFStripSize(tif);
|
||||||
r = buf = (u_char *)_TIFFmalloc(4*stripsize);
|
r = buf = (u_char *)_TIFFmalloc(4*stripsize);
|
||||||
@@ -725,9 +870,17 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
a = b + stripsize;
|
a = b + stripsize;
|
||||||
if (!alpha)
|
if (!alpha)
|
||||||
memset(a, 0xff, stripsize);
|
memset(a, 0xff, stripsize);
|
||||||
y = setorientation(img, h);
|
|
||||||
orientation = img->orientation;
|
flip = setorientation(img);
|
||||||
toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? w+w : w-w);
|
if (flip & FLIP_VERTICALLY) {
|
||||||
|
y = h - 1;
|
||||||
|
toskew = -(int32)(w + w);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
y = 0;
|
||||||
|
toskew = -(int32)(w - w);
|
||||||
|
}
|
||||||
|
|
||||||
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||||
scanline = TIFFScanlineSize(tif);
|
scanline = TIFFScanlineSize(tif);
|
||||||
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
||||||
@@ -769,8 +922,25 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
pos = ((row + img->row_offset) % rowsperstrip) * scanline;
|
pos = ((row + img->row_offset) % rowsperstrip) * scanline;
|
||||||
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, r + pos, g + pos,
|
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, r + pos, g + pos,
|
||||||
b + pos, a + pos);
|
b + pos, a + pos);
|
||||||
y += (orientation == ORIENTATION_TOPLEFT ? -(int32) nrow : (int32) nrow);
|
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flip & FLIP_HORIZONTALLY) {
|
||||||
|
uint32 line;
|
||||||
|
|
||||||
|
for (line = 0; line < h; line++) {
|
||||||
|
uint32 *left = raster + (line * w);
|
||||||
|
uint32 *right = left + w - 1;
|
||||||
|
|
||||||
|
while ( left < right ) {
|
||||||
|
uint32 temp = *left;
|
||||||
|
*left = *right;
|
||||||
|
*right = temp;
|
||||||
|
left++, right--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_TIFFfree(buf);
|
_TIFFfree(buf);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@@ -1374,25 +1544,39 @@ DECLARESepPutFunc(putRGBUAseparate16bittile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* YCbCr -> RGB conversion and packing routines. The colorspace
|
* 8-bit packed CIE L*a*b 1976 samples => RGB
|
||||||
* conversion algorithm comes from the IJG v5a code; see below
|
*/
|
||||||
* for more information on how it works.
|
DECLAREContigPutFunc(putcontig8bitCIELab)
|
||||||
|
{
|
||||||
|
float X, Y, Z;
|
||||||
|
uint32 r, g, b;
|
||||||
|
(void) y;
|
||||||
|
fromskew *= 3;
|
||||||
|
while (h-- > 0) {
|
||||||
|
for (x = w; x-- > 0;) {
|
||||||
|
TIFFCIELabToXYZ(img->cielab,
|
||||||
|
(u_char)pp[0],
|
||||||
|
(signed char)pp[1],
|
||||||
|
(signed char)pp[2],
|
||||||
|
&X, &Y, &Z);
|
||||||
|
TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
|
||||||
|
*cp++ = PACK(r, g, b);
|
||||||
|
pp += 3;
|
||||||
|
}
|
||||||
|
cp += toskew;
|
||||||
|
pp += fromskew;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* YCbCr -> RGB conversion and packing routines.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define YCbCrtoRGB(dst, yc) { \
|
#define YCbCrtoRGB(dst, Y) { \
|
||||||
int Y = (yc); \
|
uint32 r, g, b; \
|
||||||
dst = PACK( \
|
TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b); \
|
||||||
clamptab[Y+Crrtab[Cr]], \
|
dst = PACK(r, g, b); \
|
||||||
clamptab[Y + (int)((Cbgtab[Cb]+Crgtab[Cr])>>16)], \
|
|
||||||
clamptab[Y+Cbbtab[Cb]]); \
|
|
||||||
}
|
}
|
||||||
#define YCbCrSetup \
|
|
||||||
TIFFYCbCrToRGB* ycbcr = img->ycbcr; \
|
|
||||||
int* Crrtab = ycbcr->Cr_r_tab; \
|
|
||||||
int* Cbbtab = ycbcr->Cb_b_tab; \
|
|
||||||
int32* Crgtab = ycbcr->Cr_g_tab; \
|
|
||||||
int32* Cbgtab = ycbcr->Cb_g_tab; \
|
|
||||||
TIFFRGBValue* clamptab = ycbcr->clamptab
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 8-bit packed YCbCr samples => RGB
|
* 8-bit packed YCbCr samples => RGB
|
||||||
@@ -1414,13 +1598,11 @@ static void putcontig8bitYCbCrGenericTile(
|
|||||||
int v_group )
|
int v_group )
|
||||||
|
|
||||||
{
|
{
|
||||||
YCbCrSetup;
|
|
||||||
|
|
||||||
uint32* cp1 = cp+w+toskew;
|
uint32* cp1 = cp+w+toskew;
|
||||||
uint32* cp2 = cp1+w+toskew;
|
uint32* cp2 = cp1+w+toskew;
|
||||||
uint32* cp3 = cp2+w+toskew;
|
uint32* cp3 = cp2+w+toskew;
|
||||||
int32 incr = 3*w+4*toskew;
|
int32 incr = 3*w+4*toskew;
|
||||||
int Cb, Cr;
|
int32 Cb, Cr;
|
||||||
int group_size = v_group * h_group + 2;
|
int group_size = v_group * h_group + 2;
|
||||||
|
|
||||||
(void) y;
|
(void) y;
|
||||||
@@ -1477,7 +1659,6 @@ static void putcontig8bitYCbCrGenericTile(
|
|||||||
*/
|
*/
|
||||||
DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
|
DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
|
||||||
{
|
{
|
||||||
YCbCrSetup;
|
|
||||||
uint32* cp1 = cp+w+toskew;
|
uint32* cp1 = cp+w+toskew;
|
||||||
uint32* cp2 = cp1+w+toskew;
|
uint32* cp2 = cp1+w+toskew;
|
||||||
uint32* cp3 = cp2+w+toskew;
|
uint32* cp3 = cp2+w+toskew;
|
||||||
@@ -1490,8 +1671,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
|
|||||||
for (; h >= 4; h -= 4) {
|
for (; h >= 4; h -= 4) {
|
||||||
x = w>>2;
|
x = w>>2;
|
||||||
do {
|
do {
|
||||||
int Cb = pp[16];
|
int32 Cb = pp[16];
|
||||||
int Cr = pp[17];
|
int32 Cr = pp[17];
|
||||||
|
|
||||||
YCbCrtoRGB(cp [0], pp[ 0]);
|
YCbCrtoRGB(cp [0], pp[ 0]);
|
||||||
YCbCrtoRGB(cp [1], pp[ 1]);
|
YCbCrtoRGB(cp [1], pp[ 1]);
|
||||||
@@ -1519,8 +1700,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
|
|||||||
} else {
|
} else {
|
||||||
while (h > 0) {
|
while (h > 0) {
|
||||||
for (x = w; x > 0;) {
|
for (x = w; x > 0;) {
|
||||||
int Cb = pp[16];
|
int32 Cb = pp[16];
|
||||||
int Cr = pp[17];
|
int32 Cr = pp[17];
|
||||||
switch (x) {
|
switch (x) {
|
||||||
default:
|
default:
|
||||||
switch (h) {
|
switch (h) {
|
||||||
@@ -1575,7 +1756,6 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
|
|||||||
*/
|
*/
|
||||||
DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
|
DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
|
||||||
{
|
{
|
||||||
YCbCrSetup;
|
|
||||||
uint32* cp1 = cp+w+toskew;
|
uint32* cp1 = cp+w+toskew;
|
||||||
int32 incr = 2*toskew+w;
|
int32 incr = 2*toskew+w;
|
||||||
|
|
||||||
@@ -1585,8 +1765,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
|
|||||||
for (; h >= 2; h -= 2) {
|
for (; h >= 2; h -= 2) {
|
||||||
x = w>>2;
|
x = w>>2;
|
||||||
do {
|
do {
|
||||||
int Cb = pp[8];
|
int32 Cb = pp[8];
|
||||||
int Cr = pp[9];
|
int32 Cr = pp[9];
|
||||||
|
|
||||||
YCbCrtoRGB(cp [0], pp[0]);
|
YCbCrtoRGB(cp [0], pp[0]);
|
||||||
YCbCrtoRGB(cp [1], pp[1]);
|
YCbCrtoRGB(cp [1], pp[1]);
|
||||||
@@ -1606,8 +1786,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
|
|||||||
} else {
|
} else {
|
||||||
while (h > 0) {
|
while (h > 0) {
|
||||||
for (x = w; x > 0;) {
|
for (x = w; x > 0;) {
|
||||||
int Cb = pp[8];
|
int32 Cb = pp[8];
|
||||||
int Cr = pp[9];
|
int32 Cr = pp[9];
|
||||||
switch (x) {
|
switch (x) {
|
||||||
default:
|
default:
|
||||||
switch (h) {
|
switch (h) {
|
||||||
@@ -1654,15 +1834,13 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
|
|||||||
*/
|
*/
|
||||||
DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
|
DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
|
||||||
{
|
{
|
||||||
YCbCrSetup;
|
|
||||||
|
|
||||||
(void) y;
|
(void) y;
|
||||||
/* XXX adjust fromskew */
|
/* XXX adjust fromskew */
|
||||||
do {
|
do {
|
||||||
x = w>>2;
|
x = w>>2;
|
||||||
do {
|
do {
|
||||||
int Cb = pp[4];
|
int32 Cb = pp[4];
|
||||||
int Cr = pp[5];
|
int32 Cr = pp[5];
|
||||||
|
|
||||||
YCbCrtoRGB(cp [0], pp[0]);
|
YCbCrtoRGB(cp [0], pp[0]);
|
||||||
YCbCrtoRGB(cp [1], pp[1]);
|
YCbCrtoRGB(cp [1], pp[1]);
|
||||||
@@ -1675,8 +1853,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
|
|||||||
|
|
||||||
if( (w&3) != 0 )
|
if( (w&3) != 0 )
|
||||||
{
|
{
|
||||||
int Cb = pp[4];
|
int32 Cb = pp[4];
|
||||||
int Cr = pp[5];
|
int32 Cr = pp[5];
|
||||||
|
|
||||||
switch( (w&3) ) {
|
switch( (w&3) ) {
|
||||||
case 3: YCbCrtoRGB(cp [2], pp[2]);
|
case 3: YCbCrtoRGB(cp [2], pp[2]);
|
||||||
@@ -1700,7 +1878,6 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
|
|||||||
*/
|
*/
|
||||||
DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
|
DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
|
||||||
{
|
{
|
||||||
YCbCrSetup;
|
|
||||||
uint32* cp1 = cp+w+toskew;
|
uint32* cp1 = cp+w+toskew;
|
||||||
int32 incr = 2*toskew+w;
|
int32 incr = 2*toskew+w;
|
||||||
|
|
||||||
@@ -1710,8 +1887,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
|
|||||||
for (; h >= 2; h -= 2) {
|
for (; h >= 2; h -= 2) {
|
||||||
x = w>>1;
|
x = w>>1;
|
||||||
do {
|
do {
|
||||||
int Cb = pp[4];
|
int32 Cb = pp[4];
|
||||||
int Cr = pp[5];
|
int32 Cr = pp[5];
|
||||||
|
|
||||||
YCbCrtoRGB(cp [0], pp[0]);
|
YCbCrtoRGB(cp [0], pp[0]);
|
||||||
YCbCrtoRGB(cp [1], pp[1]);
|
YCbCrtoRGB(cp [1], pp[1]);
|
||||||
@@ -1727,8 +1904,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
|
|||||||
} else {
|
} else {
|
||||||
while (h > 0) {
|
while (h > 0) {
|
||||||
for (x = w; x > 0;) {
|
for (x = w; x > 0;) {
|
||||||
int Cb = pp[4];
|
int32 Cb = pp[4];
|
||||||
int Cr = pp[5];
|
int32 Cr = pp[5];
|
||||||
switch (x) {
|
switch (x) {
|
||||||
default:
|
default:
|
||||||
switch (h) {
|
switch (h) {
|
||||||
@@ -1765,15 +1942,13 @@ DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
|
|||||||
*/
|
*/
|
||||||
DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
|
DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
|
||||||
{
|
{
|
||||||
YCbCrSetup;
|
|
||||||
|
|
||||||
(void) y;
|
(void) y;
|
||||||
fromskew = (fromskew * 4) / 2;
|
fromskew = (fromskew * 4) / 2;
|
||||||
do {
|
do {
|
||||||
x = w>>1;
|
x = w>>1;
|
||||||
do {
|
do {
|
||||||
int Cb = pp[2];
|
int32 Cb = pp[2];
|
||||||
int Cr = pp[3];
|
int32 Cr = pp[3];
|
||||||
|
|
||||||
YCbCrtoRGB(cp[0], pp[0]);
|
YCbCrtoRGB(cp[0], pp[0]);
|
||||||
YCbCrtoRGB(cp[1], pp[1]);
|
YCbCrtoRGB(cp[1], pp[1]);
|
||||||
@@ -1784,8 +1959,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
|
|||||||
|
|
||||||
if( (w&1) != 0 )
|
if( (w&1) != 0 )
|
||||||
{
|
{
|
||||||
int Cb = pp[2];
|
int32 Cb = pp[2];
|
||||||
int Cr = pp[3];
|
int32 Cr = pp[3];
|
||||||
|
|
||||||
YCbCrtoRGB(cp [0], pp[0]);
|
YCbCrtoRGB(cp [0], pp[0]);
|
||||||
|
|
||||||
@@ -1803,15 +1978,13 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
|
|||||||
*/
|
*/
|
||||||
DECLAREContigPutFunc(putcontig8bitYCbCr11tile)
|
DECLAREContigPutFunc(putcontig8bitYCbCr11tile)
|
||||||
{
|
{
|
||||||
YCbCrSetup;
|
|
||||||
|
|
||||||
(void) y;
|
(void) y;
|
||||||
fromskew *= 3;
|
fromskew *= 3;
|
||||||
do {
|
do {
|
||||||
x = w; /* was x = w>>1; patched 2000/09/25 [email protected] */
|
x = w; /* was x = w>>1; patched 2000/09/25 [email protected] */
|
||||||
do {
|
do {
|
||||||
int Cb = pp[1];
|
int32 Cb = pp[1];
|
||||||
int Cr = pp[2];
|
int32 Cr = pp[2];
|
||||||
|
|
||||||
YCbCrtoRGB(*cp++, pp[0]);
|
YCbCrtoRGB(*cp++, pp[0]);
|
||||||
|
|
||||||
@@ -1821,86 +1994,14 @@ DECLAREContigPutFunc(putcontig8bitYCbCr11tile)
|
|||||||
pp += fromskew;
|
pp += fromskew;
|
||||||
} while (--h);
|
} while (--h);
|
||||||
}
|
}
|
||||||
#undef YCbCrSetup
|
|
||||||
#undef YCbCrtoRGB
|
#undef YCbCrtoRGB
|
||||||
|
|
||||||
#define LumaRed coeffs[0]
|
|
||||||
#define LumaGreen coeffs[1]
|
|
||||||
#define LumaBlue coeffs[2]
|
|
||||||
#define SHIFT 16
|
|
||||||
#define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5))
|
|
||||||
#define ONE_HALF ((int32)(1<<(SHIFT-1)))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the YCbCr->RGB conversion tables. The conversion
|
|
||||||
* is done according to the 6.0 spec:
|
|
||||||
*
|
|
||||||
* R = Y + Cr*(2 - 2*LumaRed)
|
|
||||||
* B = Y + Cb*(2 - 2*LumaBlue)
|
|
||||||
* G = Y
|
|
||||||
* - LumaBlue*Cb*(2-2*LumaBlue)/LumaGreen
|
|
||||||
* - LumaRed*Cr*(2-2*LumaRed)/LumaGreen
|
|
||||||
*
|
|
||||||
* To avoid floating point arithmetic the fractional constants that
|
|
||||||
* come out of the equations are represented as fixed point values
|
|
||||||
* in the range 0...2^16. We also eliminate multiplications by
|
|
||||||
* pre-calculating possible values indexed by Cb and Cr (this code
|
|
||||||
* assumes conversion is being done for 8-bit samples).
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, TIFF* tif)
|
|
||||||
{
|
|
||||||
TIFFRGBValue* clamptab;
|
|
||||||
float* coeffs;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
clamptab = (TIFFRGBValue*)(
|
|
||||||
(tidata_t) ycbcr+TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long)));
|
|
||||||
_TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
|
|
||||||
ycbcr->clamptab = (clamptab += 256);
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
clamptab[i] = i;
|
|
||||||
_TIFFmemset(clamptab+256, 255, 2*256); /* v > 255 => 255 */
|
|
||||||
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS, &coeffs);
|
|
||||||
_TIFFmemcpy(ycbcr->coeffs, coeffs, 3*sizeof (float));
|
|
||||||
{ float f1 = 2-2*LumaRed; int32 D1 = FIX(f1);
|
|
||||||
float f2 = LumaRed*f1/LumaGreen; int32 D2 = -FIX(f2);
|
|
||||||
float f3 = 2-2*LumaBlue; int32 D3 = FIX(f3);
|
|
||||||
float f4 = LumaBlue*f3/LumaGreen; int32 D4 = -FIX(f4);
|
|
||||||
int x;
|
|
||||||
|
|
||||||
ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);
|
|
||||||
ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
|
|
||||||
ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256);
|
|
||||||
ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
|
|
||||||
/*
|
|
||||||
* i is the actual input pixel value in the range 0..255
|
|
||||||
* Cb and Cr values are in the range -128..127 (actually
|
|
||||||
* they are in a range defined by the ReferenceBlackWhite
|
|
||||||
* tag) so there is some range shifting to do here when
|
|
||||||
* constructing tables indexed by the raw pixel data.
|
|
||||||
*
|
|
||||||
* XXX handle ReferenceBlackWhite correctly to calculate
|
|
||||||
* Cb/Cr values to use in constructing the tables.
|
|
||||||
*/
|
|
||||||
for (i = 0, x = -128; i < 256; i++, x++) {
|
|
||||||
ycbcr->Cr_r_tab[i] = (int)((D1*x + ONE_HALF)>>SHIFT);
|
|
||||||
ycbcr->Cb_b_tab[i] = (int)((D3*x + ONE_HALF)>>SHIFT);
|
|
||||||
ycbcr->Cr_g_tab[i] = D2*x;
|
|
||||||
ycbcr->Cb_g_tab[i] = D4*x + ONE_HALF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#undef SHIFT
|
|
||||||
#undef ONE_HALF
|
|
||||||
#undef FIX
|
|
||||||
#undef LumaBlue
|
|
||||||
#undef LumaGreen
|
|
||||||
#undef LumaRed
|
|
||||||
|
|
||||||
static tileContigRoutine
|
static tileContigRoutine
|
||||||
initYCbCrConversion(TIFFRGBAImage* img)
|
initYCbCrConversion(TIFFRGBAImage* img)
|
||||||
{
|
{
|
||||||
|
static char module[] = "initCIELabConversion";
|
||||||
|
|
||||||
|
float *luma, *refBlackWhite;
|
||||||
uint16 hs, vs;
|
uint16 hs, vs;
|
||||||
|
|
||||||
if (img->ycbcr == NULL) {
|
if (img->ycbcr == NULL) {
|
||||||
@@ -1908,21 +2009,21 @@ initYCbCrConversion(TIFFRGBAImage* img)
|
|||||||
TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long))
|
TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long))
|
||||||
+ 4*256*sizeof (TIFFRGBValue)
|
+ 4*256*sizeof (TIFFRGBValue)
|
||||||
+ 2*256*sizeof (int)
|
+ 2*256*sizeof (int)
|
||||||
+ 2*256*sizeof (int32)
|
+ 3*256*sizeof (int32)
|
||||||
);
|
);
|
||||||
if (img->ycbcr == NULL) {
|
if (img->ycbcr == NULL) {
|
||||||
TIFFError(TIFFFileName(img->tif),
|
TIFFError(module,
|
||||||
"No space for YCbCr->RGB conversion state");
|
"No space for YCbCr->RGB conversion state");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
TIFFYCbCrToRGBInit(img->ycbcr, img->tif);
|
|
||||||
} else {
|
|
||||||
float* coeffs;
|
|
||||||
|
|
||||||
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &coeffs);
|
|
||||||
if (_TIFFmemcmp(coeffs, img->ycbcr->coeffs, 3*sizeof (float)) != 0)
|
|
||||||
TIFFYCbCrToRGBInit(img->ycbcr, img->tif);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);
|
||||||
|
TIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE,
|
||||||
|
&refBlackWhite);
|
||||||
|
if (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The 6.0 spec says that subsampling must be
|
* The 6.0 spec says that subsampling must be
|
||||||
* one of 1, 2, or 4, and that vertical subsampling
|
* one of 1, 2, or 4, and that vertical subsampling
|
||||||
@@ -1939,9 +2040,43 @@ initYCbCrConversion(TIFFRGBAImage* img)
|
|||||||
case 0x21: return (putcontig8bitYCbCr21tile);
|
case 0x21: return (putcontig8bitYCbCr21tile);
|
||||||
case 0x11: return (putcontig8bitYCbCr11tile);
|
case 0x11: return (putcontig8bitYCbCr11tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static tileContigRoutine
|
||||||
|
initCIELabConversion(TIFFRGBAImage* img)
|
||||||
|
{
|
||||||
|
static char module[] = "initCIELabConversion";
|
||||||
|
|
||||||
|
float *whitePoint;
|
||||||
|
float refWhite[3];
|
||||||
|
|
||||||
|
if (!img->cielab) {
|
||||||
|
img->cielab = (TIFFCIELabToRGB *)
|
||||||
|
_TIFFmalloc(sizeof(TIFFCIELabToRGB));
|
||||||
|
if (!img->cielab) {
|
||||||
|
TIFFError(module,
|
||||||
|
"No space for CIE L*a*b*->RGB conversion state.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
|
||||||
|
refWhite[1] = 100.0F;
|
||||||
|
refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
|
||||||
|
refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
|
||||||
|
/ whitePoint[1] * refWhite[1];
|
||||||
|
if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) {
|
||||||
|
TIFFError(module,
|
||||||
|
"Failed to initialize CIE L*a*b*->RGB conversion state.");
|
||||||
|
_TIFFfree(img->cielab);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return putcontig8bitCIELab;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Greyscale images with less than 8 bits/sample are handled
|
* Greyscale images with less than 8 bits/sample are handled
|
||||||
* with a table to avoid lots of shifts and masks. The table
|
* with a table to avoid lots of shifts and masks. The table
|
||||||
@@ -2106,7 +2241,7 @@ makecmap(TIFFRGBAImage* img)
|
|||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
TIFFRGBValue c;
|
TIFFRGBValue c;
|
||||||
img->PALmap[i] = p;
|
img->PALmap[i] = p;
|
||||||
#define CMAP(x) c = x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
|
#define CMAP(x) c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
|
||||||
switch (bitspersample) {
|
switch (bitspersample) {
|
||||||
case 1:
|
case 1:
|
||||||
CMAP(i>>7);
|
CMAP(i>>7);
|
||||||
@@ -2240,6 +2375,10 @@ pickTileContigCase(TIFFRGBAImage* img)
|
|||||||
if (img->bitspersample == 8)
|
if (img->bitspersample == 8)
|
||||||
put = initYCbCrConversion(img);
|
put = initYCbCrConversion(img);
|
||||||
break;
|
break;
|
||||||
|
case PHOTOMETRIC_CIELAB:
|
||||||
|
if (img->bitspersample == 8)
|
||||||
|
put = initCIELabConversion(img);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ((img->put.contig = put) != 0);
|
return ((img->put.contig = put) != 0);
|
||||||
@@ -2383,7 +2522,8 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
* Setup the RGBA reader.
|
* Setup the RGBA reader.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!TIFFRGBAImageOK(tif, emsg) || !TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
|
if (!TIFFRGBAImageOK(tif, emsg)
|
||||||
|
|| !TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
|
||||||
TIFFError(TIFFFileName(tif), emsg);
|
TIFFError(TIFFFileName(tif), emsg);
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@@ -2427,8 +2567,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
if( read_xsize == tile_xsize && read_ysize == tile_ysize )
|
if( read_xsize == tile_xsize && read_ysize == tile_ysize )
|
||||||
return( ok );
|
return( ok );
|
||||||
|
|
||||||
for( i_row = 0; i_row < read_ysize; i_row++ )
|
for( i_row = 0; i_row < read_ysize; i_row++ ) {
|
||||||
{
|
|
||||||
memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
||||||
raster + (read_ysize - i_row - 1) * read_xsize,
|
raster + (read_ysize - i_row - 1) * read_xsize,
|
||||||
read_xsize * sizeof(uint32) );
|
read_xsize * sizeof(uint32) );
|
||||||
@@ -2436,8 +2575,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
0, sizeof(uint32) * (tile_xsize - read_xsize) );
|
0, sizeof(uint32) * (tile_xsize - read_xsize) );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i_row = read_ysize; i_row < tile_ysize; i_row++ )
|
for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) {
|
||||||
{
|
|
||||||
_TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
_TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
||||||
0, sizeof(uint32) * tile_xsize );
|
0, sizeof(uint32) * tile_xsize );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ LogL16Decode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
|||||||
for (i = 0; i < npixels && cc > 0; )
|
for (i = 0; i < npixels && cc > 0; )
|
||||||
if (*bp >= 128) { /* run */
|
if (*bp >= 128) { /* run */
|
||||||
rc = *bp++ + (2-128);
|
rc = *bp++ + (2-128);
|
||||||
b = (int16)*bp++ << shft;
|
b = (int16)(*bp++ << shft);
|
||||||
cc -= 2;
|
cc -= 2;
|
||||||
while (rc--)
|
while (rc--)
|
||||||
tp[i++] |= b;
|
tp[i++] |= b;
|
||||||
@@ -405,7 +405,7 @@ LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
}
|
}
|
||||||
mask = 0xff << shft; /* find next run */
|
mask = 0xff << shft; /* find next run */
|
||||||
for (beg = i; beg < npixels; beg += rc) {
|
for (beg = i; beg < npixels; beg += rc) {
|
||||||
b = tp[beg] & mask;
|
b = (int16) (tp[beg] & mask);
|
||||||
rc = 1;
|
rc = 1;
|
||||||
while (rc < 127+2 && beg+rc < npixels &&
|
while (rc < 127+2 && beg+rc < npixels &&
|
||||||
(tp[beg+rc] & mask) == b)
|
(tp[beg+rc] & mask) == b)
|
||||||
@@ -414,12 +414,12 @@ LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
break; /* long enough */
|
break; /* long enough */
|
||||||
}
|
}
|
||||||
if (beg-i > 1 && beg-i < MINRUN) {
|
if (beg-i > 1 && beg-i < MINRUN) {
|
||||||
b = tp[i] & mask; /* check short run */
|
b = (int16) (tp[i] & mask);/*check short run */
|
||||||
j = i+1;
|
j = i+1;
|
||||||
while ((tp[j++] & mask) == b)
|
while ((tp[j++] & mask) == b)
|
||||||
if (j == beg) {
|
if (j == beg) {
|
||||||
*op++ = 128-2+j-i;
|
*op++ = (tidataval_t)(128-2+j-i);
|
||||||
*op++ = b >> shft;
|
*op++ = (tidataval_t) (b >> shft);
|
||||||
occ -= 2;
|
occ -= 2;
|
||||||
i = beg;
|
i = beg;
|
||||||
break;
|
break;
|
||||||
@@ -435,15 +435,15 @@ LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
op = tif->tif_rawcp;
|
op = tif->tif_rawcp;
|
||||||
occ = tif->tif_rawdatasize - tif->tif_rawcc;
|
occ = tif->tif_rawdatasize - tif->tif_rawcc;
|
||||||
}
|
}
|
||||||
*op++ = j; occ--;
|
*op++ = (tidataval_t) j; occ--;
|
||||||
while (j--) {
|
while (j--) {
|
||||||
*op++ = tp[i++] >> shft & 0xff;
|
*op++ = (tidataval_t) (tp[i++] >> shft & 0xff);
|
||||||
occ--;
|
occ--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc >= MINRUN) { /* write out run */
|
if (rc >= MINRUN) { /* write out run */
|
||||||
*op++ = 128-2+rc;
|
*op++ = (tidataval_t) (128-2+rc);
|
||||||
*op++ = tp[beg] >> shft & 0xff;
|
*op++ = (tidataval_t) (tp[beg] >> shft & 0xff);
|
||||||
occ -= 2;
|
occ -= 2;
|
||||||
} else
|
} else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
@@ -569,14 +569,14 @@ LogLuvEncode32(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
op = tif->tif_rawcp;
|
op = tif->tif_rawcp;
|
||||||
occ = tif->tif_rawdatasize - tif->tif_rawcc;
|
occ = tif->tif_rawdatasize - tif->tif_rawcc;
|
||||||
}
|
}
|
||||||
*op++ = j; occ--;
|
*op++ = (tidataval_t) j; occ--;
|
||||||
while (j--) {
|
while (j--) {
|
||||||
*op++ = (tidataval_t)(tp[i++] >> shft & 0xff);
|
*op++ = (tidataval_t)(tp[i++] >> shft & 0xff);
|
||||||
occ--;
|
occ--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc >= MINRUN) { /* write out run */
|
if (rc >= MINRUN) { /* write out run */
|
||||||
*op++ = 128-2+rc;
|
*op++ = (tidataval_t) (128-2+rc);
|
||||||
*op++ = (tidataval_t)(tp[beg] >> shft & 0xff);
|
*op++ = (tidataval_t)(tp[beg] >> shft & 0xff);
|
||||||
occ -= 2;
|
occ -= 2;
|
||||||
} else
|
} else
|
||||||
@@ -693,7 +693,7 @@ L16toGry(LogLuvState* sp, tidata_t op, int n)
|
|||||||
|
|
||||||
while (n-- > 0) {
|
while (n-- > 0) {
|
||||||
double Y = LogL16toY(*l16++);
|
double Y = LogL16toY(*l16++);
|
||||||
*gp++ = (Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256.*sqrt(Y));
|
*gp++ = (uint8) ((Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256.*sqrt(Y)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,7 +704,7 @@ L16fromY(LogLuvState* sp, tidata_t op, int n)
|
|||||||
float* yp = (float*) op;
|
float* yp = (float*) op;
|
||||||
|
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
*l16++ = LogL16fromY(*yp++, sp->encode_meth);
|
*l16++ = (int16) (LogL16fromY(*yp++, sp->encode_meth));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !LOGLUV_PUBLIC
|
#if !LOGLUV_PUBLIC
|
||||||
@@ -720,9 +720,9 @@ XYZtoRGB24(float xyz[3], uint8 rgb[3])
|
|||||||
b = 0.061*xyz[0] + -0.224*xyz[1] + 1.163*xyz[2];
|
b = 0.061*xyz[0] + -0.224*xyz[1] + 1.163*xyz[2];
|
||||||
/* assume 2.0 gamma for speed */
|
/* assume 2.0 gamma for speed */
|
||||||
/* could use integer sqrt approx., but this is probably faster */
|
/* could use integer sqrt approx., but this is probably faster */
|
||||||
rgb[0] = (r <= 0.) ? 0 : (r >= 1.) ? 255 : (int)(256.*sqrt(r));
|
rgb[0] = (uint8)((r<=0.) ? 0 : (r >= 1.) ? 255 : (int)(256.*sqrt(r)));
|
||||||
rgb[1] = (g <= 0.) ? 0 : (g >= 1.) ? 255 : (int)(256.*sqrt(g));
|
rgb[1] = (uint8)((g<=0.) ? 0 : (g >= 1.) ? 255 : (int)(256.*sqrt(g)));
|
||||||
rgb[2] = (b <= 0.) ? 0 : (b >= 1.) ? 255 : (int)(256.*sqrt(b));
|
rgb[2] = (uint8)((b<=0.) ? 0 : (b >= 1.) ? 255 : (int)(256.*sqrt(b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !LOGLUV_PUBLIC
|
#if !LOGLUV_PUBLIC
|
||||||
@@ -993,7 +993,7 @@ Luv24fromLuv48(LogLuvState* sp, tidata_t op, int n)
|
|||||||
else
|
else
|
||||||
Le = itrunc(.25*(luv3[0]-3314.), sp->encode_meth);
|
Le = itrunc(.25*(luv3[0]-3314.), sp->encode_meth);
|
||||||
|
|
||||||
Ce = uv_encode((luv[1]+.5)/(1<<15), (luv[2]+.5)/(1<<15),
|
Ce = uv_encode((luv3[1]+.5)/(1<<15), (luv3[2]+.5)/(1<<15),
|
||||||
sp->encode_meth);
|
sp->encode_meth);
|
||||||
if (Ce < 0) /* never happens */
|
if (Ce < 0) /* never happens */
|
||||||
Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);
|
Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_lzw.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_lzw.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -107,6 +107,15 @@ typedef struct {
|
|||||||
#define lzw_nextdata base.nextdata
|
#define lzw_nextdata base.nextdata
|
||||||
#define lzw_nextbits base.nextbits
|
#define lzw_nextbits base.nextbits
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Encoding-specific state.
|
||||||
|
*/
|
||||||
|
typedef uint16 hcode_t; /* codes fit in 16 bits */
|
||||||
|
typedef struct {
|
||||||
|
long hash;
|
||||||
|
hcode_t code;
|
||||||
|
} hash_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decoding-specific state.
|
* Decoding-specific state.
|
||||||
*/
|
*/
|
||||||
@@ -121,6 +130,8 @@ typedef int (*decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t);
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
LZWBaseState base;
|
LZWBaseState base;
|
||||||
|
|
||||||
|
/* Decoding specific data */
|
||||||
long dec_nbitsmask; /* lzw_nbits 1 bits, right adjusted */
|
long dec_nbitsmask; /* lzw_nbits 1 bits, right adjusted */
|
||||||
long dec_restart; /* restart count */
|
long dec_restart; /* restart count */
|
||||||
#ifdef LZW_CHECKEOS
|
#ifdef LZW_CHECKEOS
|
||||||
@@ -132,19 +143,8 @@ typedef struct {
|
|||||||
code_t* dec_free_entp; /* next free entry */
|
code_t* dec_free_entp; /* next free entry */
|
||||||
code_t* dec_maxcodep; /* max available entry */
|
code_t* dec_maxcodep; /* max available entry */
|
||||||
code_t* dec_codetab; /* kept separate for small machines */
|
code_t* dec_codetab; /* kept separate for small machines */
|
||||||
} LZWDecodeState;
|
|
||||||
|
|
||||||
/*
|
/* Encoding specific data */
|
||||||
* Encoding-specific state.
|
|
||||||
*/
|
|
||||||
typedef uint16 hcode_t; /* codes fit in 16 bits */
|
|
||||||
typedef struct {
|
|
||||||
long hash;
|
|
||||||
hcode_t code;
|
|
||||||
} hash_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
LZWBaseState base;
|
|
||||||
int enc_oldcode; /* last code encountered */
|
int enc_oldcode; /* last code encountered */
|
||||||
long enc_checkpoint; /* point at which to clear table */
|
long enc_checkpoint; /* point at which to clear table */
|
||||||
#define CHECK_GAP 10000 /* enc_ratio check interval */
|
#define CHECK_GAP 10000 /* enc_ratio check interval */
|
||||||
@@ -153,17 +153,17 @@ typedef struct {
|
|||||||
long enc_outcount; /* encoded (output) bytes */
|
long enc_outcount; /* encoded (output) bytes */
|
||||||
tidata_t enc_rawlimit; /* bound on tif_rawdata buffer */
|
tidata_t enc_rawlimit; /* bound on tif_rawdata buffer */
|
||||||
hash_t* enc_hashtab; /* kept separate for small machines */
|
hash_t* enc_hashtab; /* kept separate for small machines */
|
||||||
} LZWEncodeState;
|
} LZWCodecState;
|
||||||
|
|
||||||
#define LZWState(tif) ((LZWBaseState*) (tif)->tif_data)
|
#define LZWState(tif) ((LZWBaseState*) (tif)->tif_data)
|
||||||
#define DecoderState(tif) ((LZWDecodeState*) LZWState(tif))
|
#define DecoderState(tif) ((LZWCodecState*) LZWState(tif))
|
||||||
#define EncoderState(tif) ((LZWEncodeState*) LZWState(tif))
|
#define EncoderState(tif) ((LZWCodecState*) LZWState(tif))
|
||||||
|
|
||||||
static int LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t);
|
static int LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
#ifdef LZW_COMPAT
|
#ifdef LZW_COMPAT
|
||||||
static int LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t);
|
static int LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
#endif
|
#endif
|
||||||
static void cl_hash(LZWEncodeState*);
|
static void cl_hash(LZWCodecState*);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LZW Decoder.
|
* LZW Decoder.
|
||||||
@@ -192,7 +192,7 @@ static void cl_hash(LZWEncodeState*);
|
|||||||
static int
|
static int
|
||||||
LZWSetupDecode(TIFF* tif)
|
LZWSetupDecode(TIFF* tif)
|
||||||
{
|
{
|
||||||
LZWDecodeState* sp = DecoderState(tif);
|
LZWCodecState* sp = DecoderState(tif);
|
||||||
static const char module[] = " LZWSetupDecode";
|
static const char module[] = " LZWSetupDecode";
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ LZWSetupDecode(TIFF* tif)
|
|||||||
* Allocate state block so tag methods have storage to record
|
* Allocate state block so tag methods have storage to record
|
||||||
* values.
|
* values.
|
||||||
*/
|
*/
|
||||||
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof(LZWDecodeState));
|
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof(LZWCodecState));
|
||||||
if (tif->tif_data == NULL)
|
if (tif->tif_data == NULL)
|
||||||
{
|
{
|
||||||
TIFFError("LZWPreDecode", "No space for LZW state block");
|
TIFFError("LZWPreDecode", "No space for LZW state block");
|
||||||
@@ -248,7 +248,7 @@ LZWSetupDecode(TIFF* tif)
|
|||||||
static int
|
static int
|
||||||
LZWPreDecode(TIFF* tif, tsample_t s)
|
LZWPreDecode(TIFF* tif, tsample_t s)
|
||||||
{
|
{
|
||||||
LZWDecodeState *sp = DecoderState(tif);
|
LZWCodecState *sp = DecoderState(tif);
|
||||||
|
|
||||||
(void) s;
|
(void) s;
|
||||||
assert(sp != NULL);
|
assert(sp != NULL);
|
||||||
@@ -339,7 +339,7 @@ codeLoop(TIFF* tif)
|
|||||||
static int
|
static int
|
||||||
LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||||
{
|
{
|
||||||
LZWDecodeState *sp = DecoderState(tif);
|
LZWCodecState *sp = DecoderState(tif);
|
||||||
char *op = (char*) op0;
|
char *op = (char*) op0;
|
||||||
long occ = (long) occ0;
|
long occ = (long) occ0;
|
||||||
char *tp;
|
char *tp;
|
||||||
@@ -541,7 +541,7 @@ LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
|||||||
static int
|
static int
|
||||||
LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||||
{
|
{
|
||||||
LZWDecodeState *sp = DecoderState(tif);
|
LZWCodecState *sp = DecoderState(tif);
|
||||||
char *op = (char*) op0;
|
char *op = (char*) op0;
|
||||||
long occ = (long) occ0;
|
long occ = (long) occ0;
|
||||||
char *tp;
|
char *tp;
|
||||||
@@ -713,7 +713,7 @@ LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
|||||||
static int
|
static int
|
||||||
LZWSetupEncode(TIFF* tif)
|
LZWSetupEncode(TIFF* tif)
|
||||||
{
|
{
|
||||||
LZWEncodeState* sp = EncoderState(tif);
|
LZWCodecState* sp = EncoderState(tif);
|
||||||
static const char module[] = "LZWSetupEncode";
|
static const char module[] = "LZWSetupEncode";
|
||||||
|
|
||||||
assert(sp != NULL);
|
assert(sp != NULL);
|
||||||
@@ -731,7 +731,7 @@ LZWSetupEncode(TIFF* tif)
|
|||||||
static int
|
static int
|
||||||
LZWPreEncode(TIFF* tif, tsample_t s)
|
LZWPreEncode(TIFF* tif, tsample_t s)
|
||||||
{
|
{
|
||||||
LZWEncodeState *sp = EncoderState(tif);
|
LZWCodecState *sp = EncoderState(tif);
|
||||||
|
|
||||||
(void) s;
|
(void) s;
|
||||||
assert(sp != NULL);
|
assert(sp != NULL);
|
||||||
@@ -790,7 +790,7 @@ LZWPreEncode(TIFF* tif, tsample_t s)
|
|||||||
static int
|
static int
|
||||||
LZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
register LZWEncodeState *sp = EncoderState(tif);
|
register LZWCodecState *sp = EncoderState(tif);
|
||||||
register long fcode;
|
register long fcode;
|
||||||
register hash_t *hp;
|
register hash_t *hp;
|
||||||
register int h, c;
|
register int h, c;
|
||||||
@@ -952,7 +952,7 @@ LZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
static int
|
static int
|
||||||
LZWPostEncode(TIFF* tif)
|
LZWPostEncode(TIFF* tif)
|
||||||
{
|
{
|
||||||
register LZWEncodeState *sp = EncoderState(tif);
|
register LZWCodecState *sp = EncoderState(tif);
|
||||||
tidata_t op = tif->tif_rawcp;
|
tidata_t op = tif->tif_rawcp;
|
||||||
long nextbits = sp->lzw_nextbits;
|
long nextbits = sp->lzw_nextbits;
|
||||||
long nextdata = sp->lzw_nextdata;
|
long nextdata = sp->lzw_nextdata;
|
||||||
@@ -979,7 +979,7 @@ LZWPostEncode(TIFF* tif)
|
|||||||
* Reset encoding hash table.
|
* Reset encoding hash table.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
cl_hash(LZWEncodeState* sp)
|
cl_hash(LZWCodecState* sp)
|
||||||
{
|
{
|
||||||
register hash_t *hp = &sp->enc_hashtab[HSIZE-1];
|
register hash_t *hp = &sp->enc_hashtab[HSIZE-1];
|
||||||
register long i = HSIZE-8;
|
register long i = HSIZE-8;
|
||||||
@@ -1004,13 +1004,12 @@ static void
|
|||||||
LZWCleanup(TIFF* tif)
|
LZWCleanup(TIFF* tif)
|
||||||
{
|
{
|
||||||
if (tif->tif_data) {
|
if (tif->tif_data) {
|
||||||
if (LZWState(tif)->rw_mode == O_RDONLY) {
|
|
||||||
if (DecoderState(tif)->dec_codetab)
|
if (DecoderState(tif)->dec_codetab)
|
||||||
_TIFFfree(DecoderState(tif)->dec_codetab);
|
_TIFFfree(DecoderState(tif)->dec_codetab);
|
||||||
} else {
|
|
||||||
if (EncoderState(tif)->enc_hashtab)
|
if (EncoderState(tif)->enc_hashtab)
|
||||||
_TIFFfree(EncoderState(tif)->enc_hashtab);
|
_TIFFfree(EncoderState(tif)->enc_hashtab);
|
||||||
}
|
|
||||||
_TIFFfree(tif->tif_data);
|
_TIFFfree(tif->tif_data);
|
||||||
tif->tif_data = NULL;
|
tif->tif_data = NULL;
|
||||||
}
|
}
|
||||||
@@ -1023,19 +1022,12 @@ TIFFInitLZW(TIFF* tif, int scheme)
|
|||||||
/*
|
/*
|
||||||
* Allocate state block so tag methods have storage to record values.
|
* Allocate state block so tag methods have storage to record values.
|
||||||
*/
|
*/
|
||||||
if (tif->tif_mode == O_RDONLY) {
|
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LZWCodecState));
|
||||||
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LZWDecodeState));
|
|
||||||
if (tif->tif_data == NULL)
|
if (tif->tif_data == NULL)
|
||||||
goto bad;
|
goto bad;
|
||||||
DecoderState(tif)->dec_codetab = NULL;
|
DecoderState(tif)->dec_codetab = NULL;
|
||||||
DecoderState(tif)->dec_decode = NULL;
|
DecoderState(tif)->dec_decode = NULL;
|
||||||
} else {
|
|
||||||
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LZWEncodeState));
|
|
||||||
if (tif->tif_data == NULL)
|
|
||||||
goto bad;
|
|
||||||
EncoderState(tif)->enc_hashtab = NULL;
|
EncoderState(tif)->enc_hashtab = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
LZWState(tif)->rw_mode = tif->tif_mode;
|
LZWState(tif)->rw_mode = tif->tif_mode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_next.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_next.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#define SETPIXEL(op, v) { \
|
#define SETPIXEL(op, v) { \
|
||||||
switch (npixels++ & 3) { \
|
switch (npixels++ & 3) { \
|
||||||
case 0: op[0] = (v) << 6; break; \
|
case 0: op[0] = (u_char) ((v) << 6); break; \
|
||||||
case 1: op[0] |= (v) << 4; break; \
|
case 1: op[0] |= (v) << 4; break; \
|
||||||
case 2: op[0] |= (v) << 2; break; \
|
case 2: op[0] |= (v) << 2; break; \
|
||||||
case 3: *op++ |= (v); break; \
|
case 3: *op++ |= (v); break; \
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_open.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_open.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -32,19 +32,19 @@
|
|||||||
void _TIFFSetDefaultCompressionState(TIFF* tif);
|
void _TIFFSetDefaultCompressionState(TIFF* tif);
|
||||||
|
|
||||||
static const long typemask[13] = {
|
static const long typemask[13] = {
|
||||||
0L, /* TIFF_NOTYPE */
|
(long)0L, /* TIFF_NOTYPE */
|
||||||
0x000000ffL, /* TIFF_BYTE */
|
(long)0x000000ffL, /* TIFF_BYTE */
|
||||||
0xffffffffL, /* TIFF_ASCII */
|
(long)0xffffffffL, /* TIFF_ASCII */
|
||||||
0x0000ffffL, /* TIFF_SHORT */
|
(long)0x0000ffffL, /* TIFF_SHORT */
|
||||||
0xffffffffL, /* TIFF_LONG */
|
(long)0xffffffffL, /* TIFF_LONG */
|
||||||
0xffffffffL, /* TIFF_RATIONAL */
|
(long)0xffffffffL, /* TIFF_RATIONAL */
|
||||||
0x000000ffL, /* TIFF_SBYTE */
|
(long)0x000000ffL, /* TIFF_SBYTE */
|
||||||
0x000000ffL, /* TIFF_UNDEFINED */
|
(long)0x000000ffL, /* TIFF_UNDEFINED */
|
||||||
0x0000ffffL, /* TIFF_SSHORT */
|
(long)0x0000ffffL, /* TIFF_SSHORT */
|
||||||
0xffffffffL, /* TIFF_SLONG */
|
(long)0xffffffffL, /* TIFF_SLONG */
|
||||||
0xffffffffL, /* TIFF_SRATIONAL */
|
(long)0xffffffffL, /* TIFF_SRATIONAL */
|
||||||
0xffffffffL, /* TIFF_FLOAT */
|
(long)0xffffffffL, /* TIFF_FLOAT */
|
||||||
0xffffffffL, /* TIFF_DOUBLE */
|
(long)0xffffffffL, /* TIFF_DOUBLE */
|
||||||
};
|
};
|
||||||
static const int bigTypeshift[13] = {
|
static const int bigTypeshift[13] = {
|
||||||
0, /* TIFF_NOTYPE */
|
0, /* TIFF_NOTYPE */
|
||||||
@@ -313,6 +313,8 @@ TIFFClientOpen(
|
|||||||
if (!TIFFDefaultDirectory(tif))
|
if (!TIFFDefaultDirectory(tif))
|
||||||
goto bad;
|
goto bad;
|
||||||
tif->tif_diroff = 0;
|
tif->tif_diroff = 0;
|
||||||
|
tif->tif_dirlist = NULL;
|
||||||
|
tif->tif_dirnumber = 0;
|
||||||
return (tif);
|
return (tif);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_packbits.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_packbits.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -109,16 +109,16 @@ PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
|||||||
state = RUN;
|
state = RUN;
|
||||||
if (n > 128) {
|
if (n > 128) {
|
||||||
*op++ = (tidata) -127;
|
*op++ = (tidata) -127;
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
n -= 128;
|
n -= 128;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
*op++ = (tidataval_t)(-(n-1));
|
*op++ = (tidataval_t)(-(n-1));
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
} else {
|
} else {
|
||||||
lastliteral = op;
|
lastliteral = op;
|
||||||
*op++ = 0;
|
*op++ = 0;
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
state = LITERAL;
|
state = LITERAL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -127,32 +127,32 @@ PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
|||||||
state = LITERAL_RUN;
|
state = LITERAL_RUN;
|
||||||
if (n > 128) {
|
if (n > 128) {
|
||||||
*op++ = (tidata) -127;
|
*op++ = (tidata) -127;
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
n -= 128;
|
n -= 128;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
*op++ = (tidataval_t)(-(n-1)); /* encode run */
|
*op++ = (tidataval_t)(-(n-1)); /* encode run */
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
} else { /* extend literal */
|
} else { /* extend literal */
|
||||||
if (++(*lastliteral) == 127)
|
if (++(*lastliteral) == 127)
|
||||||
state = BASE;
|
state = BASE;
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RUN: /* last object was run */
|
case RUN: /* last object was run */
|
||||||
if (n > 1) {
|
if (n > 1) {
|
||||||
if (n > 128) {
|
if (n > 128) {
|
||||||
*op++ = (tidata) -127;
|
*op++ = (tidata) -127;
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
n -= 128;
|
n -= 128;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
*op++ = (tidataval_t)(-(n-1));
|
*op++ = (tidataval_t)(-(n-1));
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
} else {
|
} else {
|
||||||
lastliteral = op;
|
lastliteral = op;
|
||||||
*op++ = 0;
|
*op++ = 0;
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
state = LITERAL;
|
state = LITERAL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -188,7 +188,11 @@ PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
|||||||
static int
|
static int
|
||||||
PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
|
#if defined(__hpux) && defined(__LP64__)
|
||||||
|
tsize_t rowsize = (tsize_t)(unsigned long) tif->tif_data;
|
||||||
|
#else
|
||||||
tsize_t rowsize = (tsize_t) tif->tif_data;
|
tsize_t rowsize = (tsize_t) tif->tif_data;
|
||||||
|
#endif
|
||||||
|
|
||||||
assert(rowsize > 0);
|
assert(rowsize > 0);
|
||||||
|
|
||||||
@@ -197,9 +201,14 @@ PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
* YCBCR data isn't really separable into rows, so we
|
* YCBCR data isn't really separable into rows, so we
|
||||||
* might as well encode the whole tile/strip as one chunk.
|
* might as well encode the whole tile/strip as one chunk.
|
||||||
*/
|
*/
|
||||||
if( tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR )
|
if( tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR ) {
|
||||||
|
#if defined(__hpux) && defined(__LP64__)
|
||||||
|
rowsize = (tsize_t)(unsigned long) tif->tif_data;
|
||||||
|
#else
|
||||||
rowsize = (tsize_t) tif->tif_data;
|
rowsize = (tsize_t) tif->tif_data;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
while ((long)cc > 0) {
|
while ((long)cc > 0) {
|
||||||
int chunk = rowsize;
|
int chunk = rowsize;
|
||||||
@@ -249,7 +258,7 @@ PackBitsDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
|||||||
occ -= n;
|
occ -= n;
|
||||||
b = *bp++, cc--;
|
b = *bp++, cc--;
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
*op++ = b;
|
*op++ = (tidataval_t) b;
|
||||||
} else { /* copy next n+1 bytes literally */
|
} else { /* copy next n+1 bytes literally */
|
||||||
if (occ < n + 1)
|
if (occ < n + 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_predict.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_predict.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -174,9 +174,9 @@ horAcc8(TIFF* tif, tidata_t cp0, tsize_t cc)
|
|||||||
u_int cb = cp[2];
|
u_int cb = cp[2];
|
||||||
do {
|
do {
|
||||||
cc -= 3, cp += 3;
|
cc -= 3, cp += 3;
|
||||||
cp[0] = (cr += cp[0]);
|
cp[0] = (char) (cr += cp[0]);
|
||||||
cp[1] = (cg += cp[1]);
|
cp[1] = (char) (cg += cp[1]);
|
||||||
cp[2] = (cb += cp[2]);
|
cp[2] = (char) (cb += cp[2]);
|
||||||
} while ((int32) cc > 0);
|
} while ((int32) cc > 0);
|
||||||
} else if (stride == 4) {
|
} else if (stride == 4) {
|
||||||
u_int cr = cp[0];
|
u_int cr = cp[0];
|
||||||
@@ -185,14 +185,14 @@ horAcc8(TIFF* tif, tidata_t cp0, tsize_t cc)
|
|||||||
u_int ca = cp[3];
|
u_int ca = cp[3];
|
||||||
do {
|
do {
|
||||||
cc -= 4, cp += 4;
|
cc -= 4, cp += 4;
|
||||||
cp[0] = (cr += cp[0]);
|
cp[0] = (char) (cr += cp[0]);
|
||||||
cp[1] = (cg += cp[1]);
|
cp[1] = (char) (cg += cp[1]);
|
||||||
cp[2] = (cb += cp[2]);
|
cp[2] = (char) (cb += cp[2]);
|
||||||
cp[3] = (ca += cp[3]);
|
cp[3] = (char) (ca += cp[3]);
|
||||||
} while ((int32) cc > 0);
|
} while ((int32) cc > 0);
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
REPEAT4(stride, cp[stride] += *cp; cp++)
|
REPEAT4(stride, cp[stride] = (char) (cp[stride] + *cp); cp++)
|
||||||
cc -= stride;
|
cc -= stride;
|
||||||
} while ((int32) cc > 0);
|
} while ((int32) cc > 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_print.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_print.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -494,9 +494,10 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
|||||||
** Custom tag support.
|
** Custom tag support.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i, count;
|
int i;
|
||||||
|
short count;
|
||||||
|
|
||||||
count = TIFFGetTagListCount( tif );
|
count = (short) TIFFGetTagListCount( tif );
|
||||||
for( i = 0; i < count; i++ )
|
for( i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
ttag_t tag = TIFFGetTagListEntry( tif, i );
|
ttag_t tag = TIFFGetTagListEntry( tif, i );
|
||||||
@@ -508,19 +509,29 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
|||||||
|
|
||||||
if( fld->field_passcount )
|
if( fld->field_passcount )
|
||||||
{
|
{
|
||||||
int count, i;
|
short value_count;
|
||||||
|
int j;
|
||||||
void *raw_data;
|
void *raw_data;
|
||||||
|
|
||||||
if( TIFFGetField( tif, tag, &count, &raw_data ) != 1 )
|
if( TIFFGetField( tif, tag, &value_count, &raw_data ) != 1 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fprintf(fd, " %s: ", fld->field_name );
|
fprintf(fd, " %s: ", fld->field_name );
|
||||||
|
|
||||||
for( i = 0; i < count; i++ )
|
for( j = 0; j < value_count; j++ )
|
||||||
{
|
{
|
||||||
if( fld->field_type == TIFF_SHORT )
|
if( fld->field_type == TIFF_BYTE )
|
||||||
fprintf( fd, "%d",
|
fprintf( fd, "%d",
|
||||||
(int) ((short *) raw_data)[i] );
|
(int) ((char *) raw_data)[j] );
|
||||||
|
else if( fld->field_type == TIFF_SHORT )
|
||||||
|
fprintf( fd, "%d",
|
||||||
|
(int) ((short *) raw_data)[j] );
|
||||||
|
else if( fld->field_type == TIFF_LONG )
|
||||||
|
fprintf( fd, "%d",
|
||||||
|
(int) ((long *) raw_data)[j] );
|
||||||
|
else if( fld->field_type == TIFF_RATIONAL )
|
||||||
|
fprintf( fd, "%f",
|
||||||
|
((float *) raw_data)[j] );
|
||||||
else if( fld->field_type == TIFF_ASCII )
|
else if( fld->field_type == TIFF_ASCII )
|
||||||
{
|
{
|
||||||
fprintf( fd, "%s",
|
fprintf( fd, "%s",
|
||||||
@@ -529,13 +540,10 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
|||||||
}
|
}
|
||||||
else if( fld->field_type == TIFF_DOUBLE )
|
else if( fld->field_type == TIFF_DOUBLE )
|
||||||
fprintf( fd, "%f",
|
fprintf( fd, "%f",
|
||||||
((double *) raw_data)[i] );
|
((double *) raw_data)[j] );
|
||||||
else if( fld->field_type == TIFF_FLOAT )
|
else if( fld->field_type == TIFF_FLOAT )
|
||||||
fprintf( fd, "%f",
|
fprintf( fd, "%f",
|
||||||
(float) ((double *) raw_data)[i] );
|
((float *) raw_data)[j] );
|
||||||
else if( fld->field_type == TIFF_LONG )
|
|
||||||
fprintf( fd, "%d",
|
|
||||||
(int) ((long *) raw_data)[i] );
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf( fd,
|
fprintf( fd,
|
||||||
@@ -543,7 +551,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( i < count-1 )
|
if( j < value_count-1 )
|
||||||
fprintf( fd, "," );
|
fprintf( fd, "," );
|
||||||
}
|
}
|
||||||
fprintf( fd, "\n" );
|
fprintf( fd, "\n" );
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_strip.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_strip.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1991-1997 Sam Leffler
|
* Copyright (c) 1991-1997 Sam Leffler
|
||||||
@@ -111,6 +111,26 @@ TIFFVStripSize(TIFF* tif, uint32 nrows)
|
|||||||
return ((tsize_t)(nrows * TIFFScanlineSize(tif)));
|
return ((tsize_t)(nrows * TIFFScanlineSize(tif)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute the # bytes in a raw strip.
|
||||||
|
*/
|
||||||
|
tsize_t
|
||||||
|
TIFFRawStripSize(TIFF* tif, tstrip_t strip)
|
||||||
|
{
|
||||||
|
TIFFDirectory* td = &tif->tif_dir;
|
||||||
|
tsize_t bytecount = td->td_stripbytecount[strip];
|
||||||
|
|
||||||
|
if (bytecount <= 0) {
|
||||||
|
TIFFError(tif->tif_name,
|
||||||
|
"%lu: Invalid strip byte count, strip %lu",
|
||||||
|
(u_long) bytecount, (u_long) strip);
|
||||||
|
bytecount = (tsize_t) -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytecount;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute the # bytes in a (row-aligned) strip.
|
* Compute the # bytes in a (row-aligned) strip.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_swab.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_swab.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -36,7 +36,7 @@ void
|
|||||||
TIFFSwabShort(uint16* wp)
|
TIFFSwabShort(uint16* wp)
|
||||||
{
|
{
|
||||||
register u_char* cp = (u_char*) wp;
|
register u_char* cp = (u_char*) wp;
|
||||||
int t;
|
u_char t;
|
||||||
|
|
||||||
t = cp[1]; cp[1] = cp[0]; cp[0] = t;
|
t = cp[1]; cp[1] = cp[0]; cp[0] = t;
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ void
|
|||||||
TIFFSwabLong(uint32* lp)
|
TIFFSwabLong(uint32* lp)
|
||||||
{
|
{
|
||||||
register u_char* cp = (u_char*) lp;
|
register u_char* cp = (u_char*) lp;
|
||||||
int t;
|
u_char t;
|
||||||
|
|
||||||
t = cp[3]; cp[3] = cp[0]; cp[0] = t;
|
t = cp[3]; cp[3] = cp[0]; cp[0] = t;
|
||||||
t = cp[2]; cp[2] = cp[1]; cp[1] = t;
|
t = cp[2]; cp[2] = cp[1]; cp[1] = t;
|
||||||
@@ -59,7 +59,7 @@ void
|
|||||||
TIFFSwabArrayOfShort(uint16* wp, register u_long n)
|
TIFFSwabArrayOfShort(uint16* wp, register u_long n)
|
||||||
{
|
{
|
||||||
register u_char* cp;
|
register u_char* cp;
|
||||||
register int t;
|
register u_char t;
|
||||||
|
|
||||||
/* XXX unroll loop some */
|
/* XXX unroll loop some */
|
||||||
while (n-- > 0) {
|
while (n-- > 0) {
|
||||||
@@ -75,7 +75,7 @@ void
|
|||||||
TIFFSwabArrayOfLong(register uint32* lp, register u_long n)
|
TIFFSwabArrayOfLong(register uint32* lp, register u_long n)
|
||||||
{
|
{
|
||||||
register unsigned char *cp;
|
register unsigned char *cp;
|
||||||
register int t;
|
register unsigned char t;
|
||||||
|
|
||||||
/* XXX unroll loop some */
|
/* XXX unroll loop some */
|
||||||
while (n-- > 0) {
|
while (n-- > 0) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_thunder.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_thunder.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -60,7 +60,7 @@ static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 };
|
|||||||
if (npixels++ & 1) \
|
if (npixels++ & 1) \
|
||||||
*op++ |= lastpixel; \
|
*op++ |= lastpixel; \
|
||||||
else \
|
else \
|
||||||
op[0] = lastpixel << 4; \
|
op[0] = (tidataval_t) (lastpixel << 4); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -92,7 +92,7 @@ ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels)
|
|||||||
lastpixel |= lastpixel << 4;
|
lastpixel |= lastpixel << 4;
|
||||||
npixels += n;
|
npixels += n;
|
||||||
for (; n > 0; n -= 2)
|
for (; n > 0; n -= 2)
|
||||||
*op++ = lastpixel;
|
*op++ = (tidataval_t) lastpixel;
|
||||||
if (n == -1)
|
if (n == -1)
|
||||||
*--op &= 0xf0;
|
*--op &= 0xf0;
|
||||||
lastpixel &= 0xf;
|
lastpixel &= 0xf;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_tile.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_tile.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1991-1997 Sam Leffler
|
* Copyright (c) 1991-1997 Sam Leffler
|
||||||
@@ -62,7 +62,7 @@ TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, tsample_t s)
|
|||||||
xpt*(y/dy) +
|
xpt*(y/dy) +
|
||||||
x/dx;
|
x/dx;
|
||||||
else
|
else
|
||||||
tile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx + s;
|
tile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx;
|
||||||
}
|
}
|
||||||
return (tile);
|
return (tile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_write.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_write.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -152,6 +152,10 @@ TIFFWriteScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample)
|
|||||||
return (-1);
|
return (-1);
|
||||||
tif->tif_row = row;
|
tif->tif_row = row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* swab if needed - note that source buffer will be altered */
|
||||||
|
tif->tif_postdecode( tif, (tidata_t) buf, tif->tif_scanlinesize );
|
||||||
|
|
||||||
status = (*tif->tif_encoderow)(tif, (tidata_t) buf,
|
status = (*tif->tif_encoderow)(tif, (tidata_t) buf,
|
||||||
tif->tif_scanlinesize, sample);
|
tif->tif_scanlinesize, sample);
|
||||||
|
|
||||||
@@ -229,6 +233,10 @@ TIFFWriteEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t data, tsize_t cc)
|
|||||||
sample = (tsample_t)(strip / td->td_stripsperimage);
|
sample = (tsample_t)(strip / td->td_stripsperimage);
|
||||||
if (!(*tif->tif_preencode)(tif, sample))
|
if (!(*tif->tif_preencode)(tif, sample))
|
||||||
return ((tsize_t) -1);
|
return ((tsize_t) -1);
|
||||||
|
|
||||||
|
/* swab if needed - note that source buffer will be altered */
|
||||||
|
tif->tif_postdecode( tif, (tidata_t) data, cc );
|
||||||
|
|
||||||
if (!(*tif->tif_encodestrip)(tif, (tidata_t) data, cc, sample))
|
if (!(*tif->tif_encodestrip)(tif, (tidata_t) data, cc, sample))
|
||||||
return ((tsize_t) 0);
|
return ((tsize_t) 0);
|
||||||
if (!(*tif->tif_postencode)(tif))
|
if (!(*tif->tif_postencode)(tif))
|
||||||
@@ -386,6 +394,10 @@ TIFFWriteEncodedTile(TIFF* tif, ttile_t tile, tdata_t data, tsize_t cc)
|
|||||||
*/
|
*/
|
||||||
if ( cc < 1 || cc > tif->tif_tilesize)
|
if ( cc < 1 || cc > tif->tif_tilesize)
|
||||||
cc = tif->tif_tilesize;
|
cc = tif->tif_tilesize;
|
||||||
|
|
||||||
|
/* swab if needed - note that source buffer will be altered */
|
||||||
|
tif->tif_postdecode( tif, (tidata_t) data, cc );
|
||||||
|
|
||||||
if (!(*tif->tif_encodetile)(tif, (tidata_t) data, cc, sample))
|
if (!(*tif->tif_encodetile)(tif, (tidata_t) data, cc, sample))
|
||||||
return ((tsize_t) 0);
|
return ((tsize_t) 0);
|
||||||
if (!(*tif->tif_postencode)(tif))
|
if (!(*tif->tif_postencode)(tif))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_zip.c,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tif_zip.c,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995-1997 Sam Leffler
|
* Copyright (c) 1995-1997 Sam Leffler
|
||||||
@@ -228,7 +228,8 @@ ZIPPostEncode(TIFF* tif)
|
|||||||
switch (state) {
|
switch (state) {
|
||||||
case Z_STREAM_END:
|
case Z_STREAM_END:
|
||||||
case Z_OK:
|
case Z_OK:
|
||||||
if (sp->stream.avail_out != tif->tif_rawdatasize) {
|
if ((int)sp->stream.avail_out != (int)tif->tif_rawdatasize)
|
||||||
|
{
|
||||||
tif->tif_rawcc =
|
tif->tif_rawcc =
|
||||||
tif->tif_rawdatasize - sp->stream.avail_out;
|
tif->tif_rawdatasize - sp->stream.avail_out;
|
||||||
TIFFFlushData1(tif);
|
TIFFFlushData1(tif);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiff.h,v 1.2 2003/07/31 23:09:27 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiff.h,v 1.3 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -108,7 +108,8 @@ typedef enum {
|
|||||||
TIFF_SLONG = 9, /* !32-bit signed integer */
|
TIFF_SLONG = 9, /* !32-bit signed integer */
|
||||||
TIFF_SRATIONAL = 10, /* !64-bit signed fraction */
|
TIFF_SRATIONAL = 10, /* !64-bit signed fraction */
|
||||||
TIFF_FLOAT = 11, /* !32-bit IEEE floating point */
|
TIFF_FLOAT = 11, /* !32-bit IEEE floating point */
|
||||||
TIFF_DOUBLE = 12 /* !64-bit IEEE floating point */
|
TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */
|
||||||
|
TIFF_IFD = 13 /* %32-bit unsigned integer (offset) */
|
||||||
} TIFFDataType;
|
} TIFFDataType;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiffcomp.h,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiffcomp.h,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990-1997 Sam Leffler
|
* Copyright (c) 1990-1997 Sam Leffler
|
||||||
@@ -119,11 +119,17 @@
|
|||||||
* then define BSDTYPES in your Makefile.
|
* then define BSDTYPES in your Makefile.
|
||||||
*/
|
*/
|
||||||
#if defined(BSDTYPES)
|
#if defined(BSDTYPES)
|
||||||
|
# ifndef _BSDTYPES_DEFINED
|
||||||
|
# ifndef __u_char_defined
|
||||||
typedef unsigned char u_char;
|
typedef unsigned char u_char;
|
||||||
typedef unsigned short u_short;
|
typedef unsigned short u_short;
|
||||||
typedef unsigned int u_int;
|
typedef unsigned int u_int;
|
||||||
typedef unsigned long u_long;
|
typedef unsigned long u_long;
|
||||||
#endif
|
# define __u_char_defined
|
||||||
|
# endif /* __u_char_defined */
|
||||||
|
# define _BSDTYPES_DEFINED
|
||||||
|
# endif /* _BSDTYPES_DEFINED */
|
||||||
|
#endif /* BSDTYPES */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dblparam_t is the type that a double precision
|
* dblparam_t is the type that a double precision
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiffconf.h,v 1.2 2003/07/20 14:34:15 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiffconf.h,v 1.3 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
#define _TIFFCONF_
|
#define _TIFFCONF_
|
||||||
|
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
|
// For getting Endianness from BeOS (BIG_ENDIAN)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Library Configuration Definitions.
|
* Library Configuration Definitions.
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
* #defines on the command line, this file can be edited to
|
* #defines on the command line, this file can be edited to
|
||||||
* configure the library. Otherwise, one can override portability
|
* configure the library. Otherwise, one can override portability
|
||||||
* and configuration-related definitions from a Makefile or command
|
* and configuration-related definitions from a Makefile or command
|
||||||
* line by defining FEATURE_SUPPORT and COMPRESSION_SUPPORT (see below).
|
* line by defining COMPRESSION_SUPPORT (see below).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -71,25 +72,6 @@
|
|||||||
# define USE_64BIT_API 0
|
# define USE_64BIT_API 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FEATURE_SUPPORT
|
|
||||||
/*
|
|
||||||
* Feature support definitions:
|
|
||||||
*
|
|
||||||
* COLORIMETRY_SUPPORT enable support for 6.0 colorimetry tags
|
|
||||||
* YCBCR_SUPPORT enable support for 6.0 YCbCr tags
|
|
||||||
* CMYK_SUPPORT enable support for 6.0 CMYK tags
|
|
||||||
* ICC_SUPPORT enable support for ICC profile tag
|
|
||||||
* PHOTOSHOP_SUPPORT enable support for PHOTOSHOP resource tag
|
|
||||||
* IPTC_SUPPORT enable support for RichTIFF IPTC tag
|
|
||||||
*/
|
|
||||||
#define COLORIMETRY_SUPPORT
|
|
||||||
#define YCBCR_SUPPORT
|
|
||||||
#define CMYK_SUPPORT
|
|
||||||
#define ICC_SUPPORT
|
|
||||||
#define PHOTOSHOP_SUPPORT
|
|
||||||
#define IPTC_SUPPORT
|
|
||||||
#endif /* FEATURE_SUPPORT */
|
|
||||||
|
|
||||||
#ifndef COMPRESSION_SUPPORT
|
#ifndef COMPRESSION_SUPPORT
|
||||||
/*
|
/*
|
||||||
* Compression support defines:
|
* Compression support defines:
|
||||||
@@ -160,4 +142,16 @@
|
|||||||
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
|
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Feature support definitions.
|
||||||
|
* XXX: These macros are obsoleted. Don't use them in your apps!
|
||||||
|
* Macros stays here for backward compatibility and should be always defined.
|
||||||
|
*/
|
||||||
|
#define COLORIMETRY_SUPPORT
|
||||||
|
#define YCBCR_SUPPORT
|
||||||
|
#define CMYK_SUPPORT
|
||||||
|
#define ICC_SUPPORT
|
||||||
|
#define PHOTOSHOP_SUPPORT
|
||||||
|
#define IPTC_SUPPORT
|
||||||
|
|
||||||
#endif /* _TIFFCONF_ */
|
#endif /* _TIFFCONF_ */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiffio.h,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiffio.h,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -114,10 +114,72 @@ typedef void* thandle_t; /* client data handle */
|
|||||||
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
|
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
|
||||||
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
|
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Colour conversion stuff
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* reference white */
|
||||||
|
#define D65_X0 (95.0470F)
|
||||||
|
#define D65_Y0 (100.0F)
|
||||||
|
#define D65_Z0 (108.8827F)
|
||||||
|
|
||||||
|
#define D50_X0 (96.4250F)
|
||||||
|
#define D50_Y0 (100.0F)
|
||||||
|
#define D50_Z0 (82.4680F)
|
||||||
|
|
||||||
|
/* Structure for holding information about a display device. */
|
||||||
|
|
||||||
|
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
float d_mat[3][3]; /* XYZ -> luminance matrix */
|
||||||
|
float d_YCR; /* Light o/p for reference white */
|
||||||
|
float d_YCG;
|
||||||
|
float d_YCB;
|
||||||
|
uint32 d_Vrwr; /* Pixel values for ref. white */
|
||||||
|
uint32 d_Vrwg;
|
||||||
|
uint32 d_Vrwb;
|
||||||
|
float d_Y0R; /* Residual light for black pixel */
|
||||||
|
float d_Y0G;
|
||||||
|
float d_Y0B;
|
||||||
|
float d_gammaR; /* Gamma values for the three guns */
|
||||||
|
float d_gammaG;
|
||||||
|
float d_gammaB;
|
||||||
|
} TIFFDisplay;
|
||||||
|
|
||||||
|
typedef struct { /* YCbCr->RGB support */
|
||||||
|
TIFFRGBValue* clamptab; /* range clamping table */
|
||||||
|
int* Cr_r_tab;
|
||||||
|
int* Cb_b_tab;
|
||||||
|
int32* Cr_g_tab;
|
||||||
|
int32* Cb_g_tab;
|
||||||
|
int32* Y_tab;
|
||||||
|
} TIFFYCbCrToRGB;
|
||||||
|
|
||||||
|
typedef struct { /* CIE Lab 1976->RGB support */
|
||||||
|
int range; /* Size of conversion table */
|
||||||
|
#define CIELABTORGB_TABLE_RANGE 1500
|
||||||
|
float rstep, gstep, bstep;
|
||||||
|
float X0, Y0, Z0; /* Reference white point */
|
||||||
|
TIFFDisplay display;
|
||||||
|
float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
|
||||||
|
float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
|
||||||
|
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
|
||||||
|
} TIFFCIELabToRGB;
|
||||||
|
|
||||||
|
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
|
||||||
|
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
|
||||||
|
float *, float *, float *);
|
||||||
|
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
|
||||||
|
uint32 *, uint32 *, uint32 *);
|
||||||
|
|
||||||
|
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
|
||||||
|
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
|
||||||
|
uint32 *, uint32 *, uint32 *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RGBA-style image support.
|
* RGBA-style image support.
|
||||||
*/
|
*/
|
||||||
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
|
|
||||||
typedef struct _TIFFRGBAImage TIFFRGBAImage;
|
typedef struct _TIFFRGBAImage TIFFRGBAImage;
|
||||||
/*
|
/*
|
||||||
* The image reading and conversion routines invoke
|
* The image reading and conversion routines invoke
|
||||||
@@ -138,15 +200,6 @@ typedef void (*tileSeparateRoutine)
|
|||||||
/*
|
/*
|
||||||
* RGBA-reader state.
|
* RGBA-reader state.
|
||||||
*/
|
*/
|
||||||
typedef struct { /* YCbCr->RGB support */
|
|
||||||
TIFFRGBValue* clamptab; /* range clamping table */
|
|
||||||
int* Cr_r_tab;
|
|
||||||
int* Cb_b_tab;
|
|
||||||
int32* Cr_g_tab;
|
|
||||||
int32* Cb_g_tab;
|
|
||||||
float coeffs[3]; /* cached for repeated use */
|
|
||||||
} TIFFYCbCrToRGB;
|
|
||||||
|
|
||||||
struct _TIFFRGBAImage {
|
struct _TIFFRGBAImage {
|
||||||
TIFF* tif; /* image handle */
|
TIFF* tif; /* image handle */
|
||||||
int stoponerr; /* stop on read error */
|
int stoponerr; /* stop on read error */
|
||||||
@@ -157,6 +210,7 @@ struct _TIFFRGBAImage {
|
|||||||
uint16 bitspersample; /* image bits/sample */
|
uint16 bitspersample; /* image bits/sample */
|
||||||
uint16 samplesperpixel; /* image samples/pixel */
|
uint16 samplesperpixel; /* image samples/pixel */
|
||||||
uint16 orientation; /* image orientation */
|
uint16 orientation; /* image orientation */
|
||||||
|
uint16 req_orientation; /* requested orientation */
|
||||||
uint16 photometric; /* image photometric interp */
|
uint16 photometric; /* image photometric interp */
|
||||||
uint16* redcmap; /* colormap pallete */
|
uint16* redcmap; /* colormap pallete */
|
||||||
uint16* greencmap;
|
uint16* greencmap;
|
||||||
@@ -172,6 +226,7 @@ struct _TIFFRGBAImage {
|
|||||||
uint32** BWmap; /* black&white map */
|
uint32** BWmap; /* black&white map */
|
||||||
uint32** PALmap; /* palette image map */
|
uint32** PALmap; /* palette image map */
|
||||||
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
|
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
|
||||||
|
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
|
||||||
|
|
||||||
int row_offset;
|
int row_offset;
|
||||||
int col_offset;
|
int col_offset;
|
||||||
@@ -225,6 +280,7 @@ extern const char* TIFFGetVersion(void);
|
|||||||
extern const TIFFCodec* TIFFFindCODEC(uint16);
|
extern const TIFFCodec* TIFFFindCODEC(uint16);
|
||||||
extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
|
extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
|
||||||
extern void TIFFUnRegisterCODEC(TIFFCodec*);
|
extern void TIFFUnRegisterCODEC(TIFFCodec*);
|
||||||
|
extern int TIFFIsCODECConfigured(uint16);
|
||||||
|
|
||||||
extern tdata_t _TIFFmalloc(tsize_t);
|
extern tdata_t _TIFFmalloc(tsize_t);
|
||||||
extern tdata_t _TIFFrealloc(tdata_t, tsize_t);
|
extern tdata_t _TIFFrealloc(tdata_t, tsize_t);
|
||||||
@@ -244,6 +300,7 @@ extern int TIFFReadDirectory(TIFF*);
|
|||||||
extern tsize_t TIFFScanlineSize(TIFF*);
|
extern tsize_t TIFFScanlineSize(TIFF*);
|
||||||
extern tsize_t TIFFRasterScanlineSize(TIFF*);
|
extern tsize_t TIFFRasterScanlineSize(TIFF*);
|
||||||
extern tsize_t TIFFStripSize(TIFF*);
|
extern tsize_t TIFFStripSize(TIFF*);
|
||||||
|
extern tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
|
||||||
extern tsize_t TIFFVStripSize(TIFF*, uint32);
|
extern tsize_t TIFFVStripSize(TIFF*, uint32);
|
||||||
extern tsize_t TIFFTileRowSize(TIFF*);
|
extern tsize_t TIFFTileRowSize(TIFF*);
|
||||||
extern tsize_t TIFFTileSize(TIFF*);
|
extern tsize_t TIFFTileSize(TIFF*);
|
||||||
@@ -283,11 +340,14 @@ extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
|
|||||||
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
|
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
|
||||||
extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
|
extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
|
||||||
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
|
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
|
||||||
|
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
|
||||||
|
int = ORIENTATION_BOTLEFT, int = 0);
|
||||||
#else
|
#else
|
||||||
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
|
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
|
||||||
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
|
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
|
||||||
extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
|
extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
|
||||||
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
|
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
|
||||||
|
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
|
extern int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiffiop.h,v 1.1 2003/07/19 16:40:33 mwilber Exp $ */
|
/* $Header: /tmp/bonefish/open-beos/current/src/add-ons/translators/libtifftranslator/tiffiop.h,v 1.2 2004/01/03 15:22:08 mwilber Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@@ -92,6 +92,9 @@ struct tiff {
|
|||||||
#define TIFF_STRIPCHOP 0x8000 /* enable strip chopping support */
|
#define TIFF_STRIPCHOP 0x8000 /* enable strip chopping support */
|
||||||
toff_t tif_diroff; /* file offset of current directory */
|
toff_t tif_diroff; /* file offset of current directory */
|
||||||
toff_t tif_nextdiroff; /* file offset of following directory */
|
toff_t tif_nextdiroff; /* file offset of following directory */
|
||||||
|
toff_t* tif_dirlist; /* list of offsets to already seen */
|
||||||
|
/* directories to prevent IFD looping */
|
||||||
|
uint16 tif_dirnumber; /* number of already seen directories */
|
||||||
TIFFDirectory tif_dir; /* internal rep of current directory */
|
TIFFDirectory tif_dir; /* internal rep of current directory */
|
||||||
TIFFHeader tif_header; /* file's header block */
|
TIFFHeader tif_header; /* file's header block */
|
||||||
const int* tif_typeshift; /* data type shift counts */
|
const int* tif_typeshift; /* data type shift counts */
|
||||||
@@ -198,6 +201,9 @@ struct tiff {
|
|||||||
#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
|
#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
|
||||||
#define TIFFroundup(x, y) (TIFFhowmany(x,y)*((uint32)(y)))
|
#define TIFFroundup(x, y) (TIFFhowmany(x,y)*((uint32)(y)))
|
||||||
|
|
||||||
|
#define TIFFmax(A,B) ((A)>(B)?(A):(B))
|
||||||
|
#define TIFFmin(A,B) ((A)<(B)?(A):(B))
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.6.0 beta2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
|
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.6.1\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
|
||||||
/*
|
/*
|
||||||
* This define can be used in code that requires
|
* This define can be used in code that requires
|
||||||
* compilation-related definitions specific to a
|
* compilation-related definitions specific to a
|
||||||
@@ -6,4 +6,4 @@
|
|||||||
* version checking should be done based on the
|
* version checking should be done based on the
|
||||||
* string returned by TIFFGetVersion.
|
* string returned by TIFFGetVersion.
|
||||||
*/
|
*/
|
||||||
#define TIFFLIB_VERSION 20030619
|
#define TIFFLIB_VERSION 20031226
|
||||||
|
|||||||
Reference in New Issue
Block a user