/* * 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. */ #include "tiffiop.h" #include <assert.h> #ifdef THUNDER_SUPPORT /* * TIFF Library. * * ThunderScan 4-bit Compression Algorithm Support */ /* * ThunderScan uses an encoding scheme designed for * 4-bit pixel values. Data is encoded in bytes, with * each byte split into a 2-bit code word and a 6-bit * data value. The encoding gives raw data, runs of * pixels, or pixel values encoded as a delta from the * previous pixel value. For the latter, either 2-bit * or 3-bit delta values are used, with the deltas packed * into a single byte. */ #define THUNDER_DATA … #define THUNDER_CODE … /* code values */ #define THUNDER_RUN … #define THUNDER_2BITDELTAS … #define DELTA2_SKIP … #define THUNDER_3BITDELTAS … #define DELTA3_SKIP … #define THUNDER_RAW … static const int twobitdeltas[4] = …; static const int threebitdeltas[8] = …; #define SETPIXEL(op, v) … static int ThunderSetupDecode(TIFF *tif) { … } static int ThunderDecode(TIFF *tif, uint8_t *op, tmsize_t maxpixels) { … } static int ThunderDecodeRow(TIFF *tif, uint8_t *buf, tmsize_t occ, uint16_t s) { … } int TIFFInitThunderScan(TIFF *tif, int scheme) { … } #endif /* THUNDER_SUPPORT */