* Copyright (c) 1990-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Copyright (c) 1990-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
- * Permission to use, copy, modify, distribute, and sell this software and
+ * 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.
* 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.
- *
+ *
+ * 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,
* 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
+ * 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
- Fax3BaseState b;
- int data; /* current i/o byte */
- int bit; /* current i/o bit in byte */
- enum { G3_1D, G3_2D } tag; /* encoding state */
- u_char* refline; /* reference line for 2d decoding */
- int k; /* #rows left that can be 2d encoded */
- int maxk; /* max #rows that can be 2d encoded */
+ Fax3BaseState b;
+ int data; /* current i/o byte */
+ int bit; /* current i/o bit in byte */
+ enum { G3_1D, G3_2D } tag; /* encoding state */
+ u_char* refline; /* reference line for 2d decoding */
+ int k; /* #rows left that can be 2d encoded */
+ int maxk; /* max #rows that can be 2d encoded */
Fax3Unexpected(const char* module, TIFF* tif, uint32 a0)
{
TIFFError(module, "%s: Bad code word at scanline %d (x %lu)",
Fax3Unexpected(const char* module, TIFF* tif, uint32 a0)
{
TIFFError(module, "%s: Bad code word at scanline %d (x %lu)",
}
#define unexpected(table, a0) Fax3Unexpected(module, tif, a0)
}
#define unexpected(table, a0) Fax3Unexpected(module, tif, a0)
Fax3BadLength(const char* module, TIFF* tif, uint32 a0, uint32 lastx)
{
TIFFWarning(module, "%s: %s at scanline %d (got %lu, expected %lu)",
Fax3BadLength(const char* module, TIFF* tif, uint32 a0, uint32 lastx)
{
TIFFWarning(module, "%s: %s at scanline %d (got %lu, expected %lu)",
}
#define badlength(a0,lastx) Fax3BadLength(module, tif, a0, lastx)
}
#define badlength(a0,lastx) Fax3BadLength(module, tif, a0, lastx)
Fax3PrematureEOF(const char* module, TIFF* tif, uint32 a0)
{
TIFFWarning(module, "%s: Premature EOF at scanline %d (x %lu)",
Fax3PrematureEOF(const char* module, TIFF* tif, uint32 a0)
{
TIFFWarning(module, "%s: Premature EOF at scanline %d (x %lu)",
Fax3Decode1D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE(tif, sp, "Fax3Decode1D");
Fax3Decode1D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE(tif, sp, "Fax3Decode1D");
Fax3Decode2D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
Fax3Decode2D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
Fax3PutBits(TIFF* tif, u_int bits, u_int length)
{
Fax3EncodeState* sp = EncoderState(tif);
Fax3PutBits(TIFF* tif, u_int bits, u_int length)
{
Fax3EncodeState* sp = EncoderState(tif);
putspan(TIFF* tif, int32 span, const tableentry* tab)
{
Fax3EncodeState* sp = EncoderState(tif);
putspan(TIFF* tif, int32 span, const tableentry* tab)
{
Fax3EncodeState* sp = EncoderState(tif);
/*
* This is necessary for Group 4; otherwise it isn't
* needed because the first scanline of each strip ends
/*
* This is necessary for Group 4; otherwise it isn't
* needed because the first scanline of each strip ends
Fax3Encode1DRow(TIFF* tif, u_char* bp, uint32 bits)
{
Fax3EncodeState* sp = EncoderState(tif);
Fax3Encode1DRow(TIFF* tif, u_char* bp, uint32 bits)
{
Fax3EncodeState* sp = EncoderState(tif);
Fax3Encode2DRow(TIFF* tif, u_char* bp, u_char* rp, uint32 bits)
{
#define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1)
Fax3Encode2DRow(TIFF* tif, u_char* bp, u_char* rp, uint32 bits)
{
#define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1)
Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
{
Fax3EncodeState* sp = EncoderState(tif);
Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
{
Fax3EncodeState* sp = EncoderState(tif);
} else {
if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels))
return (0);
sp->k--;
}
if (sp->k == 0) {
} else {
if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels))
return (0);
sp->k--;
}
if (sp->k == 0) {
Fax3PrintDir(TIFF* tif, FILE* fd, long flags)
{
Fax3BaseState* sp = Fax3State(tif);
Fax3PrintDir(TIFF* tif, FILE* fd, long flags)
{
Fax3BaseState* sp = Fax3State(tif);
tif->tif_data = _TIFFmalloc(sizeof (Fax3DecodeState));
else
tif->tif_data = _TIFFmalloc(sizeof (Fax3EncodeState));
tif->tif_data = _TIFFmalloc(sizeof (Fax3DecodeState));
else
tif->tif_data = _TIFFmalloc(sizeof (Fax3EncodeState));
if (tif->tif_data == NULL) {
TIFFError("TIFFInitCCITTFax3",
"%s: No space for state block", tif->tif_name);
if (tif->tif_data == NULL) {
TIFFError("TIFFInitCCITTFax3",
"%s: No space for state block", tif->tif_name);
Fax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE_2D(tif, sp, "Fax4Decode");
Fax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE_2D(tif, sp, "Fax4Decode");
Fax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
{
Fax3EncodeState *sp = EncoderState(tif);
Fax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
{
Fax3EncodeState *sp = EncoderState(tif);
Fax3DecodeRLE(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
Fax3DecodeRLE(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE(tif, sp, "Fax3DecodeRLE");