home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / xloadimg.zip / xloadimage.4.1 / tiff / tif_fax3.h < prev    next >
C/C++ Source or Header  |  1993-10-21  |  3KB  |  80 lines

  1. /* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_fax3.h,v 1.8 92/02/10 19:06:37 sam Exp $ */
  2.  
  3. /*
  4.  * Copyright (c) 1990, 1991, 1992 Sam Leffler
  5.  * Copyright (c) 1991, 1992 Silicon Graphics, Inc.
  6.  *
  7.  * Permission to use, copy, modify, distribute, and sell this software and 
  8.  * its documentation for any purpose is hereby granted without fee, provided
  9.  * that (i) the above copyright notices and this permission notice appear in
  10.  * all copies of the software and related documentation, and (ii) the names of
  11.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  12.  * publicity relating to the software without the specific, prior written
  13.  * permission of Sam Leffler and Silicon Graphics.
  14.  * 
  15.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  18.  * 
  19.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24.  * OF THIS SOFTWARE.
  25.  */
  26.  
  27. #ifndef _FAX3_
  28. #define    _FAX3_
  29. /*
  30.  * CCITT Group 3 compression/decompression definitions.
  31.  */
  32. #define    FAX3_CLASSF    TIFF_OPT0    /* use Class F protocol */
  33. /* the following are for use by Compression=2, 32771, and 4 (T.6) algorithms */
  34. #define    FAX3_NOEOL    TIFF_OPT1    /* no EOL code at end of row */
  35. #define    FAX3_BYTEALIGN    TIFF_OPT2    /* force byte alignment at end of row */
  36. #define    FAX3_WORDALIGN    TIFF_OPT3    /* force word alignment at end of row */
  37.  
  38. /*
  39.  * Compression+decompression state blocks are
  40.  * derived from this ``base state'' block.
  41.  */
  42. typedef struct {
  43.     short    data;            /* current i/o byte */
  44.     short    bit;            /* current i/o bit in byte */
  45.     short    white;            /* value of the color ``white'' */
  46.     u_long    rowbytes;        /* XXX maybe should be a long? */
  47.     u_long    rowpixels;        /* XXX maybe should be a long? */
  48.     enum {                 /* decoding/encoding mode */
  49.         G3_1D,            /* basic 1-d mode */
  50.         G3_2D            /* optional 2-d mode */
  51.     } tag;
  52. #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST
  53.     u_char const *bitmap;        /* bit reversal table */
  54. #else
  55.     u_char    *bitmap;        /* bit reversal table */
  56. #endif
  57.     u_char    *refline;        /* reference line for 2d decoding */
  58. } Fax3BaseState;
  59.  
  60. /* these routines are used for Group 4 (T.6) */
  61. #if USE_PROTOTYPES
  62. extern    int Fax3Decode2DRow(TIFF*, u_char *, int);
  63. extern    int Fax3Encode2DRow(TIFF*, u_char *, u_char *, int);
  64. extern    void Fax3PutEOL(TIFF*);
  65. #else
  66. extern    int Fax3Decode2DRow();
  67. extern    int Fax3Encode2DRow();
  68. extern    void Fax3PutEOL();
  69. #endif
  70.  
  71. #define    Fax3FlushBits(tif, sp) {            \
  72.     if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize)    \
  73.         (void) TIFFFlushData1(tif);        \
  74.     *(tif)->tif_rawcp++ = (sp)->bitmap[(sp)->data];    \
  75.     (tif)->tif_rawcc++;                \
  76.     (sp)->data = 0;                    \
  77.     (sp)->bit = 8;                    \
  78. }
  79. #endif /* _FAX3_ */
  80.